Skip to content

A template repository for Python development

License

Notifications You must be signed in to change notification settings

maxxxuu/python-template

 
 

Repository files navigation

python-template

A template repository for Python development

pre-commit static analysis workflow test workflow

First Steps

  1. Install pyenv:

    curl https://pyenv.run | bash

    Then install a Python interpreter in pyenv:

    pyenv install 3.12
    pyenv global 3.12

    To allow multi-version testing, install multiple versions, e.g.:

    pyenv install 3.12 3.11 3.10
    pyenv global 3.12 3.11 3.10
  2. Install the development dependencies:

    pip install -r requirements-dev.txt
  3. Install the pre-commit hooks:

    pre-commit install
  4. If your IDE or editor doesn't do it for you, create virtual environment:

    python -m venv venv

    Then activate it (do this every time you work on the project):

    . venv/bin/activate

    After you're done, deactivate the virtual environment:

    deactivate
  5. Change pyproject.toml to match your needs (in particular project name, description, keywords, authors, and maintainers).

  6. Change the multiplier directory to your project name, write your project code, your tests, and your example scripts.

  7. Install your package locally:

    pip install -e .
  8. After programming, put all packages you used into the requirements.txt file:

    pip freeze > requirements.txt

    Then remove the local package from the file (line starts with -e).

  9. Test your code:

    tox
  10. Add all new files via git add.

  11. Do a dry-run of all pre-commit checks:

    pre-commit run --all-files
  12. Commit and push your code, then check result of GitHub actions.

About

A template repository for Python development

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%