Skip to content

bosenqu/hello-world-python

Repository files navigation

Python 3.8 Actions status codecov Ruff Checked with mypy

hello-world-python

Template code for python project.

Virtual Environment & Dependency Management

Virtual environment

In order to setup python virtual environment, run:

make setup

Dependency management

The code dependency is listed in requirements.in and dev dependency is specified under the project.optional-dependencies section in pyproject.toml. Note that requirements.txt and reqruiements-dev.txt are autogenerated by pip-compile with versions pinned. For more information, visit https://pypi.org/project/pip-tools/.

Configs for pip-compile can be found under the tool.pip-tools section in pyproject.toml.

In order to regenerate requirements.txt and reqruiements-dev.txt, run:

make compile-dependency

In order to install dependency, run:

make install         # install only project dependency
make install-dev     # install both project and dev dependency

Testing

pytest is used for unit testing and behave is used for intergration testing. All tests are located in the tests/ folder.

For CI runs, coverage is used to collect code coverage. JUnit XML reports are also generated. All reports are located under the reports/ folder.

Configs for pytest can be found under the tool.pytest.ini_options section in pyproject.toml. Configs for behave can be found in behave.ini. Configs for coverage can be found under the tool.coverage.run section in pyproject.toml.

In order to run all tests, run:

make test          # run all tests
make test-ci       # run all tests, and collect test (junit xml) and coverage (cobertura xml) reports

Formatting & Linting

Formatting

isort and ruff is used to format code. reformat-gherkin is used to format .feature files.

Configs for isort can be found under the tool.isort section in pyproject.toml. Configs for ruff formatter can be found under the tool.ruff.format section in pyproject.toml.

In order to run all formatter, run:

make format

Linting

mypy is used to perform type checking.

ruff is used to perform code format checks. reformat-gherkin is used to perform format checks on .feature files.

Configs for mypy can be found under the tool.mypy section in pyproject.toml. Configs for ruff linter can be found under the tool.ruff section in pyproject.toml.

In order to run all linting checks, run:

make lint         # run all linting checks
make lint-ci      # run all linting checks with more verbose messages 

About

Hello world python project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published