Coder Social home page Coder Social logo

python-poetry-with-pytest's Introduction

Python poetry with pytest

This is a boilerplate for building dockerised python projects using packaging with poetry including python unit testing with pytest. The project is provided with simple python code and a unit test that goes with it. Please delete those as required and implement your own code.

To run the code we use the Makefile. The idea is to build the code using the local directories as mount volumes to the docker container.

Once building the code is completed it can be packaged without volumes mounted and code packaged into the container (this part is to be implemented)

The python version and the poetry version to be used are provided in .python_version and .poetry_version files respectively. A .bashrc file is provided for the container for ease.

The code can also be locally without using the docker container if required.

How to run the code:

In development mode running the make command will build the container, run it and give a shell and keeps the container running for a period of time.

To run the code execute the below command poetry run python src/main.py (or use the alias: pr src/main.py)

How to run unit tests:

Running make test will restart the container, execute the tests and exit.

Alternatively from inside the container in the root folder of the project execute the following commands:

  poetry install
  poetry run pytest   (or use the alias: `pt`)

How to package the completed project:

to be implemented ...

Refs:

poetry: https://python-poetry.org/docs/basic-usage/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.