dsp-toolkit
Overview
This library is a toolkit for shared code between apps to try and make them consistent.
Installation
poetry add dsp-toolkit
NOTE: Requires Python >=3.12,<4.0.
Quickstart
from dsp_toolkit.logging import logger
logger.info("I am a logging statement")
Features
cli.py: Reusable CLI for test, lint, release.logging.py: Centralized logging config.env.py: Environment variable management.plugins/: Custom flake8 plugins.
CLI Usage
poetry run test [args]: Run tests with optional args.poetry run lint [args]: Run linting with optional args.poetry run release: Run semantic-release for publishing.
Extending & Overriding
-
Subclass toolkit modules in your app for custom behavior.
-
Extend CLI commands:
- Create your own
cli.pyin your app (e.g.,src/my_app/cli.py). - Import and reuse commands from
dsp_toolkit.cli, then add or override as needed:from dsp_toolkit.cli import test, lint_and_format, release def custom_command(): print("This is my custom command!") # You can add an argparse entry point or use Poetry scripts to expose your custom commands.
- In your
pyproject.toml, add a Poetry script for your CLI:[tool.poetry.scripts] test = "my_app.cli:test" custom = "my_app.cli:custom_command"
- Create your own
-
Register additional plugins in your app's config:
- For Flake8 plugins, add them to your app's
setup.cfgor register viaentry_pointsinpyproject.toml:[flake8:local-plugins] extension = MYPLUG = my_app.plugins.my_plugin:MyPlugin
- For pip-installable plugins, add them to your app's dependencies and Flake8 will auto-discover them.
- For custom plugin registration, see Flake8 documentation: https://flake8.pycqa.org/en/latest/user/configuration.html#local-plugins
- For Flake8 plugins, add them to your app's
Development Workflow
- Run tests:
poetry run test - Lint:
poetry run lint - Build:
poetry build
CI/CD & Release
Automated via GitHub Actions and semantic-release. See .github/workflows/ci.yml and .github/workflows/release.yml for details.
Troubleshooting & FAQ
- If you encounter dependency issues, check your Python version and Poetry config.
- For local testing, see the section below.
Local Development & Testing in Another App
You can test dsp-toolkit in another app before releasing to PyPI:
1. Editable Install (Recommended)
From your app directory:
poetry add ../path/to/dsp-toolkit --editable
or with pip:
pip install -e ../path/to/dsp-toolkit
2. Build and Install the Package
Build your library:
poetry build
Then install the wheel or sdist in your app (Recommended):
poetry add ../path/to/dsp-toolkit/dist/dsp_toolkit-0.1.0-py3-none-any.whl
or
pip install ../path/to/dsp-toolkit/dist/dsp_toolkit-0.1.0-py3-none-any.whl
3. Local Path Dependency in pyproject.toml
In your app’s pyproject.toml:
[tool.poetry.dependencies]
dsp-toolkit = { path = "../path/to/dsp-toolkit", develop = true }
Then run:
poetry install
Metadata
Release files for dsp3-toolkit 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dsp3_toolkit-1.0.5.tar.gz | 4.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dsp3_toolkit-1.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.0 kB
Release files / dsp3_toolkit-1.0.5.tar.gz
| Download URL | dsp3_toolkit-1.0.5.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d2a84de143b2b73635147d8c5aac3c7ae30c9026b6db2848391ebdad33c4ed91
|
|
BLAKE2b-256 checksum How to use checksums |
81d3d2690743babafe71d1ee61075ceb8c702496b40a5abe2b451ed86aafb628
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.2 CPython/3.12.12 Linux/6.14.0-1017-azure
|
Release files / dsp3_toolkit-1.0.5-py3-none-any.whl
| Download URL | dsp3_toolkit-1.0.5-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c4c2d0773cf435f19bf60a403992b8c9e2d6855c099616b727b4c1cd3daf6e9
|
|
BLAKE2b-256 checksum How to use checksums |
96de6c48f3a266ca2cd80fdc140ad840ad8f239eeb4c7e985c18746389a3ef90
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.2 CPython/3.12.12 Linux/6.14.0-1017-azure
|