Skip to main content

DSP shared toolkit for Python apps: CLI, logging, config, linting, plugins, and more.

Project description

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.py in 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"
      
  • Register additional plugins in your app's config:

    • For Flake8 plugins, add them to your app's setup.cfg or register via entry_points in pyproject.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

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dsp3_toolkit-1.0.4.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dsp3_toolkit-1.0.4-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file dsp3_toolkit-1.0.4.tar.gz.

File metadata

  • Download URL: dsp3_toolkit-1.0.4.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.12.12 Linux/6.14.0-1017-azure

File hashes

Hashes for dsp3_toolkit-1.0.4.tar.gz
Algorithm Hash digest
SHA256 5ea0f37917d7b9f7902733811df3a123f94a27e4642a98f8377d07b180c7a457
MD5 b84b30138cbf5cf0aad54ceb1b789295
BLAKE2b-256 5b00d2afd63592037b3d4420c5d3d251eb2740561b1f19f413abaa348e164ce5

See more details on using hashes here.

File details

Details for the file dsp3_toolkit-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: dsp3_toolkit-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.12.12 Linux/6.14.0-1017-azure

File hashes

Hashes for dsp3_toolkit-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5c281bb340fa69392a790286ed44ec0600748341972616175911886b3efdf026
MD5 3c6b5b4ebd63f76ad84dcc27c9300b58
BLAKE2b-256 1ada777005978414559af56cb025c0e7ef5bed13aedd0ccd7aab9c40844dd4a0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page