This app is a starter kit for writing code and tests in python. Use it as a seed for starting a new python project. Use the following command to copy this app's code to a new directory:
mkdir -p path/to/new
cp -r path/to/this/directory/ path/to/new/directory/This codebase supports two ways of running code: in and out of docker. In docker, the only local dependency you need to configure to use this codebase is docker-compose. Out of docker, this codebase assumes you're able to install python via brew, although of course a different package manager could work just as well.
Here's how to install and run the code on your local OS X machine (out of docker).
- Install or update
pyenv(andpython-buildto get access to recent releases of python).brew update && brew install python-build pyenv brew update && brew upgrade python-build pyenv - Install python.
pyenv install $(cat ./.python-version) - Install poetry.
curl -sSL https://install.python-poetry.org | python - - Install python packages.
poetry install
- Run the tests.
poetry run pytest - Run the
python_startermodule.poetry run python -m python_starter - Run the auto formatter.
poetry run pre-commit run --all-files- For more usage instructions, see the pre-commit documentation.
Here's how to install and run the code in docker.
- Build the image:
docker-compose build
- Open a long-running session inside the container:
docker-compose run --rm app bash - From here, you can run the same commands as described in the respective out of docker section.
- Documentation here.
- Set a breakpoint with
import pdb; pdb.set_trace(). - Show where you are with
list. - Continue with
continue. - Quit with
quit.
This app makes use of poetry to manage packages. See docs there for how to add packages.
If you'd like to contribute to the project, please feel free to submit a pull request or open an issue to discuss your ideas.
This project is licensed under the MIT License. See the LICENSE file for more information.