Skip to content

hotohoto/python-example-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An opinionated example project in Python

Features

  • Poetry
  • src layout
  • Flake8 + Black
  • pytest
  • config file for logging

Setup virtual environment

With the venv module:

python3 -m venv venv
source venv/bin/activate

With the pyenv

pyenv virtualenv 3.8.3 my-venv
pyenv local my-venv

Do further setup with poetry

Note that running poetry install is to install dependencies, but it's also to recognize src directory.

pip install -U pip
poetry install # to install dependencies, recognize src directory, and update scripts
poetry hello

Run tests

pytest

Run scripts

poe my_script
poe hello
poe main
python src/main.py

Example VS Code configuration

settings.json:

{
    "python.linting.enabled": true,
    "python.linting.flake8Enabled": true,
    "python.linting.pylintEnabled": false,
    "python.testing.nosetestsEnabled": false,
    "python.testing.pytestArgs": [
        "tests"
    ],
    "python.testing.pytestEnabled": true,
    "python.testing.unittestEnabled": false
}

References

About

An opinionated example project in Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published