Skip to main content

Shared development tools for Python projects - character validation, circular import detection, and more

Project description

apdev (Python)

General-purpose development tools for Python projects.

Installation

pip install apdev

For development:

pip install apdev[dev]

Tools

check-chars

Validate that files contain only allowed characters (ASCII, common emoji, and technical symbols like arrows and box-drawing characters).

# Check default project directories (src/, tests/, examples/) and config files
apdev check-chars

# Check a directory recursively
apdev check-chars src/

# Check specific files
apdev check-chars src/mypackage/*.py

# Enable extra charset (e.g. Chinese characters)
apdev check-chars --charset chinese src/

Options:

  • --charset <name> — Enable a built-in charset preset (repeatable, e.g. chinese)
  • --charset-file <path> — Load a custom charset JSON file (repeatable)
  • Environment variable APDEV_EXTRA_CHARS — Comma-separated list of charset names or file paths, used when no --charset/--charset-file is given

check-imports

Detect circular imports in a Python package.

# Specify package explicitly
apdev check-imports --package mypackage --src-dir src

# Or configure in pyproject.toml (see Configuration below)
apdev check-imports

release

Interactive release automation for publishing Python packages to PyPI and GitHub. Auto-detects project name from pyproject.toml and GitHub repo from git remote.

# Run with auto-detected version from pyproject.toml
apdev release

# Or specify version explicitly
apdev release 0.2.0

The command provides an interactive menu with steps:

  1. Version verification (checks pyproject.toml and __init__.py match)
  2. Status check (tag, build files, PyPI)
  3. Clean build files
  4. Build package (python -m build)
  5. Check package (twine check)
  6. Create git tag and push
  7. Create GitHub release (via gh CLI or API)
  8. Upload to PyPI (twine upload)

Override auto-detection with environment variables:

PROJECT_NAME=mypackage GITHUB_REPO=owner/repo apdev release

Configuration

Add to your project's pyproject.toml so commands can run without CLI arguments:

[tool.apdev]
base_package = "mypackage"   # Required by check-imports
src_dir = "src"              # Source directory (default: "src")

With this config, both commands work out of the box:

apdev check-chars    # Checks default project directories and config files
apdev check-imports  # Reads base_package / src_dir from pyproject.toml

Pre-commit Integration

repos:
  - repo: https://github.com/aipartnerup/apdev
    rev: python/v0.1.0
    hooks:
      - id: check-chars
      - id: check-imports

Or use as a local hook with the pip-installed package:

repos:
  - repo: local
    hooks:
      - id: check-chars
        name: apdev check-chars
        entry: apdev check-chars
        language: system
        types_or: [text, python]

      - id: check-imports
        name: apdev check-imports
        entry: apdev check-imports
        language: system
        pass_filenames: false
        always_run: true

License

Apache-2.0

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

apdev-0.2.2.tar.gz (25.1 kB view details)

Uploaded Source

Built Distribution

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

apdev-0.2.2-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

Details for the file apdev-0.2.2.tar.gz.

File metadata

  • Download URL: apdev-0.2.2.tar.gz
  • Upload date:
  • Size: 25.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for apdev-0.2.2.tar.gz
Algorithm Hash digest
SHA256 81aab2402eab523d4cbaa205adcdce4e582e21ec88e601b4b252e56f13ab9a9e
MD5 c5aad02dc9b6cdd942b51fba81477a3e
BLAKE2b-256 5343f631a05edda4451336d2083c30755665fc3f1d806e82c03ac3187b5bbe69

See more details on using hashes here.

File details

Details for the file apdev-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: apdev-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 20.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for apdev-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 27cde182081412bc65f14259fb7c8df8483dda1233c14197b44f706eece41238
MD5 c5ecf0e5224b8d8713e48040d4c147e5
BLAKE2b-256 8b94aba16c635f4f9fccc286e76e37237d33295e1fce80faeb72ff331d29443d

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