-
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 #7 from markvilar/dev
Dev
- Loading branch information
Showing
17 changed files
with
419 additions
and
746 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
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 |
---|---|---|
|
@@ -132,3 +132,7 @@ dmypy.json | |
*.swa | ||
*.swo | ||
*.swp | ||
|
||
# env files | ||
*.env | ||
.env* |
This file was deleted.
Oops, something went wrong.
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,75 +1,74 @@ | ||
# Python Project Template | ||
# Python Template Project | ||
|
||
![ci](https://github.com/markvilar/python_project_template/actions/workflows/ci.yml/badge.svg) | ||
![pylint](https://github.com/markvilar/python_project_template/actions/workflows/pylint.yml/badge.svg) | ||
|
||
Repository template for Python projects. The repository includes support for | ||
the following tools: | ||
* pipenv - management of virtual environments and dependencies | ||
* setuptools - management of package setup | ||
* pytest - unit tests | ||
* twine - remote repository interaction | ||
This is a small template repository for creating python projects with a modern toolchain. | ||
The repository includes support for the following tools: | ||
- poetry - package management and build system | ||
- pytest - unit tests | ||
- black - code linting | ||
|
||
## Setting up a virtual environment | ||
|
||
### Install pipenv | ||
## Getting started | ||
|
||
```sh | ||
# Install pipenv | ||
pip3 install --user pipenv | ||
### Install poetry | ||
|
||
```shell | ||
# Install poetry | ||
pip3 install --user poetry | ||
``` | ||
|
||
### Install dependencies and activate shell | ||
### Configure the project environment | ||
|
||
```sh | ||
# Install dependencies and setup environment | ||
pipenv install --dev | ||
```shell | ||
# Set the Python version | ||
poetry env use <python_version> | ||
|
||
# Activate an interactive shell for the virtual environment | ||
pipenv shell | ||
# Validate the environment configuration | ||
poetry env info | ||
``` | ||
|
||
## Executing pipenv scripts | ||
### Install dependencies and build the project | ||
|
||
```shell | ||
# Install dependencies | ||
poetry install | ||
|
||
# Build the project | ||
poetry build | ||
|
||
```sh | ||
pipenv run tests | ||
pipenv run main | ||
pipenv run build | ||
# Add new packages | ||
poetry add <package-name> | ||
``` | ||
|
||
## Building binaries and sources | ||
### Running unit tests | ||
|
||
```sh | ||
python setup.py bdist_wheel sdist | ||
```shell | ||
poetry run pytest | ||
``` | ||
|
||
## Running tests | ||
|
||
```sh | ||
# Run specific tests | ||
python -m unittest tests/test_common.py | ||
python -m unittest tests/test_math.py | ||
## Other uses | ||
|
||
# Run specific tests in verbose mode | ||
python -m unittest -v tests/test_common.py | ||
python -m unittest -v tests/test_math.py | ||
### Managing the project environment | ||
|
||
```shell | ||
poetry env info | ||
``` | ||
|
||
## Publishing the project | ||
```sh | ||
twine upload --repository python_template_project dist/* | ||
```shell | ||
poetry env remove | ||
``` | ||
|
||
## Troubleshooting | ||
### Activate the project environment in a shell | ||
|
||
### Reinstalling the virtual environment | ||
```shell | ||
poetry shell | ||
``` | ||
|
||
Reinstallation of the pipenv virtual environment can be necessary to update the | ||
python version of the environment. In order to do this, execute the following | ||
commands: | ||
### Removing dependencies | ||
|
||
```sh | ||
pipenv --rm | ||
pipenv install --python <python_version> | ||
pipenv install --dev | ||
```shell | ||
poetry remove <package> | ||
``` |
Oops, something went wrong.