https://github.com/f4str/python-package-template
Template Python package with linting, tests, and CI
https://github.com/f4str/python-package-template
continous-integration linting python template tox worflows
Last synced: 9 months ago
JSON representation
Template Python package with linting, tests, and CI
- Host: GitHub
- URL: https://github.com/f4str/python-package-template
- Owner: f4str
- License: mit
- Created: 2021-06-26T04:03:50.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-08-26T04:50:56.000Z (over 4 years ago)
- Last Synced: 2025-01-26T06:26:26.303Z (11 months ago)
- Topics: continous-integration, linting, python, template, tox, worflows
- Language: Python
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Python Package Template
Template git repository for creating Python packages. Includes the a sample project structure, linting, type checks, unit tests, formatting, and continuous integration.
## Installation
Clone the repository.
```bash
git clone https://github.com/f4str/python-package-template
```
Change directories into the cloned repository.
```bash
cd python-package-template
```
Install Python and create a virtual environment.
```bash
python3 -m venv venv
source venv/bin/activate
```
Install the dev dependencies using pip.
```bash
pip install -e .[dev]
```
## Development
The `tox` library is used to run all tests and code formatting. This is automatically installed with the dev requirements. The available options are as follows.
* Run linting checks using `flake8`.
```bash
tox -e lint
```
* Run type checks using `mypy`.
```bash
tox -e type
```
* Run unit tests `pytest`.
```bash
tox -e test
```
* Run all three of the tests above.
```bash
tox
```
* Format the code using `black` and `isort` to comply with linting conventions.
```bash
tox -e format
```
Upon pull request, merge, or push to the `master` branch, the three tests with `tox` will be run using GitHub Actions. The workflow will fail if any of the tests fail. See `.github/workflows/python-package.yml` for more information on how the CI works.