-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from bosenqu/update-readme
Initialize contents in README.md and add config for isort and ruff formatter
- Loading branch information
Showing
3 changed files
with
74 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,70 @@ | ||
[![Python 3.8](https://img.shields.io/badge/python-3.8-blue.svg)](https://www.python.org/downloads/release/python-380/) | ||
[![Actions status](https://github.com/bosenqu/hello-world-python/actions/workflows/ci.yml/badge.svg)](https://github.com/bosenqu/hello-world-python/actions) | ||
[![codecov](https://codecov.io/gh/bosenqu/hello-world-python/graph/badge.svg?token=4LJAVKJ4VM)](https://codecov.io/gh/bosenqu/hello-world-python) | ||
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) | ||
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/) | ||
|
||
# hello-world-python | ||
Hello world python project | ||
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](https://pypi.org/project/pytest/) is used for unit testing and [behave](https://pypi.org/project/behave/) is used for intergration testing. All tests are located in the `tests/` folder. | ||
|
||
For CI runs, [coverage](https://pypi.org/project/coverage/) is used to collect code coverage. [JUnit XML reports](https://www.ibm.com/docs/en/developer-for-zos/14.1?topic=formats-junit-xml-format) 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](https://pypi.org/project/isort/) and [ruff](https://pypi.org/project/ruff/) is used to format code. [reformat-gherkin](https://pypi.org/project/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](https://pypi.org/project/mypy/) is used to perform type checking. | ||
|
||
[ruff](https://pypi.org/project/ruff/) is used to perform code format checks. [reformat-gherkin](https://pypi.org/project/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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters