Skip to content

Latest commit

 

History

History
88 lines (67 loc) · 2.54 KB

README.md

File metadata and controls

88 lines (67 loc) · 2.54 KB

Python Starter Kit

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/

Dependencies

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.

Out of Docker

Here's how to install and run the code on your local OS X machine (out of docker).

Install

  1. Install or update pyenv (and python-build to get access to recent releases of python).
    brew update && brew install python-build pyenv
    brew update && brew upgrade python-build pyenv
    
  2. Install python.
    pyenv install $(cat ./.python-version)
    
  3. Install poetry.
    curl -sSL https://install.python-poetry.org | python -
    
  4. Install python packages.
    poetry install
    

Run

  • Run the tests.
    poetry run pytest
  • Run the python_starter module.
    poetry run python -m python_starter
  • Run the auto formatter.
    poetry run pre-commit run --all-files

In Docker

Here's how to install and run the code in docker.

Install

  1. Build the image:
    docker-compose build

Run

Debug

  • Documentation here.
  • Set a breakpoint with import pdb; pdb.set_trace().
  • Show where you are with list.
  • Continue with continue.
  • Quit with quit.

Add a new python package

This app makes use of poetry to manage packages. See docs there for how to add packages.

Contributing

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.

License

This project is licensed under the MIT License. See the LICENSE file for more information.