Skip to main content

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. This will add the last released version to you project:

pip install --upgrade cerbernetix.toolbox

For getting the last unstable version, the package needs to be installed from the source code. The following command will grab the last develop version:

pip install --upgrade git+https://github.com/cerbernetix/py-toolbox.git@develop

If you prefer using ssh:

pip install --upgrade git+ssh://git@github.com/cerbernetix/py-toolbox.git@develop

Usage

py-toolbox offers several utilities per domain.

Please refer to the documentation for more information.

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

Document

Docstrings are written following the Google docstrings format.

The documentation is generated using lazydocs.

The script ./pydoc.sh can be used to regenerate it.

License

Copyright (c) 2023 Jean-Sébastien CONAN Distributed under the MIT License (See LICENSE file or copy at http://opensource.org/licenses/MIT).

Release files for cerbernetix.toolbox 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cerbernetix.toolbox 0.10.0
File Size Uploaded
cerbernetix_toolbox-0.10.0.tar.gz 37.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cerbernetix.toolbox 0.10.0
File Interpreter ABI Platform
cerbernetix.toolbox-0.10.0-py3-none-any.whl Python 3 none any Details

Total release size: 86.7 kB

Release files / cerbernetix_toolbox-0.10.0.tar.gz

Download URL cerbernetix_toolbox-0.10.0.tar.gz
Size 37.7 kB
Tags Source
SHA-256 checksum
How to use checksums
337da680309ef2184801859f12fc248edfc58c1f89a9cb0b1557eb9c3dfea3d9
BLAKE2b-256 checksum
How to use checksums
8715acb54e0ca425148f28e0cf7a9f556bb4c660467cc5f906dbd84b974b1555
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / cerbernetix.toolbox-0.10.0-py3-none-any.whl

Download URL cerbernetix.toolbox-0.10.0-py3-none-any.whl
Size 49.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4cb63b66670536611b22cd787c417e05d1ba137c61c419dd90df7560b44e27e8
BLAKE2b-256 checksum
How to use checksums
f508d91561798b15939f83b60548eee7f27dd77c46346ad105780b393213f358
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.10.0 This release

2 release files

0.9.1

2 release files

0.9.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page