A set of utilities for Python projects
Project description
py-toolbox
py-toolbox
is a set of utilities for Python projects
Requirements
The toolbox has been written in Python 3
, and it needs version 3.7
.
The dependencies are managed by pip
using the file requirements.txt
.
Installation
To add py-toolbox
to your project, run the following command:
pip install git+https://github.com/cerbernetix/py-toolbox.git
Usage
py-toolbox
offers several utilities per domain.
Please refer to the documentation for more information.
The documentation is generated using lazydocs.
The script ./pydoc.sh
can be used to regenerate it.
Development
Check out the repository:
git clone git@github.com:cerbernetix/py-toolbox.git
Then, create the virtual env and install the dependencies:
cd py-toolbox
python3 -m venv ".venv"
source "./venv/bin/activate"
pip install -r requirements.txt
pip install -e .
Note: For deactivating the virtual env, call the command deactivate
.
Automating the environment activation/deactivation
For activating the virtual env automatically when entering the project folder, and deactivating it when leaving the folder, you can add this snippet to you shell profile:
cd() {
builtin cd "$@"
local venv=".venv"
# If a Python virtualenv is active, deactivate it if the new folder is outside
if [[ -v VIRTUAL_ENV ]] ; then
local parent=$(dirname "${VIRTUAL_ENV}")
if [[ "${PWD}"/ != "${parent}"/* ]] ; then
deactivate
fi
fi
# If a Python env folder is found then activate the virtualenv
if [[ -d "./${venv}" ]] ; then
# Is it a Python venv?
if [[ -f "./${venv}/bin/activate" ]] ; then
source "./${venv}/bin/activate"
fi
fi
}
Code style
Code is linted using PyLint and formatted using Black. The docstrings are validated using pydocstyle.
Testing
Each module comes with unit tests, by convention, a test
folder must be added to each package
Unit tests are made using unittest
. To run them:
python3 -m unittest
License
Copyright (c) 2023 Jean-Sébastien CONAN Distributed under the MIT License (See LICENSE file or copy at http://opensource.org/licenses/MIT).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for cerbernetix.toolbox-0.9.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f59ad66bb8e1c25db12cb53f537976b496200956051718719b6b689bce8efd24 |
|
MD5 | 13d860c6868a3abce5096bda45f47161 |
|
BLAKE2b-256 | 6e0ff1363eab7bc4ff4adccb118f24aec6ba924bc9b64a667ce7fba08539c503 |
Hashes for cerbernetix.toolbox-0.9.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3955e8815b9802dce5e281649915d4a4c5fd42e6fb4b69e13a604baf04a9269 |
|
MD5 | 30180c31174a45ecae9a912d9ccf1fe9 |
|
BLAKE2b-256 | 6103550212e394b33e2d89be3f62deb44355ed1653109a58b9a4764875f5afad |