Skip to main content

Do You Know Every Selection?

dykes helps you get a handle on your tools.

It uses typing.NamedTuples or dataclasses to declaratively set up your argument parser and then returns an instance of your argument class.

An example usage, in example_application.py

from dataclasses import dataclass
from pathlib import Path
from typing import Annotated

import dykes

@dataclass
class ExampleApplication:
    path: Annotated[Path, "The paths to operate on."]
    dry_run: bool
    prompt: dykes.StoreFalse
    verbosity: dykes.Count

if __name__ == "__main__":
    arguments = dykes.parse_args(ExampleApplication)
    print(arguments)

Use this from the command line:

python example_application.py ~ -d -vv

And the output looks like:

ExampleApplication(path=Path('~'), dry_run=True, prompt=True, verbosity=2)

Inlining dykes

While dykes is packaged to be used with pip, it is self-contained and uses relative imports for its own code. If you would like to vendor it, take the files under src/dykes/ and include it in your own project.

What works

  • Positional parameters
  • Store True flags
    • Two variants: type a bool or use dykes.StoreTrue
  • Store False flags
  • Count flags
  • A StrEnum of Argparse actions. dykes.Action instances can be passed to directly to argparse.add_parameter
  • Parameter help strings: provide a bare string via Annotated
  • Application description via your dataclass or NamedTuple's docstring.
  • snake_case field names converted to --kebab-case long options.
  • Number of Args
    • Implicitly with arg: list[T]
    • explicitly via arg: Annotated[list[T], dykes.options.NArgs("+")]
    • Explicit can use positional arguments with a default factory via dataclasses.field as well.

What works but is underwhelming

  • Parameter defaults. (positional parameters can't use them, and the other supported fields have good ones.)

Coming Soon

  • More actions
    • Store Const
    • Append
    • Append Const
    • Extend
    • Version
  • More Options
    • Defining custom flags (currently derived from names)
    • const
    • choices
    • required
    • deprecated
  • Proper documentation

Coming Maybe

  • Application framework based on __call__
  • Subcommands

Isn't That Name Insensitive?

Author and maintainer here: I am a transgender lesbian and I find it funny. If you don't want that word in your project, that's fine! Please see instructions above on how to inline the project. Feel free to rename it.

Release files for dykes 0.5.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 dykes 0.5.0
File Size Uploaded
dykes-0.5.0.tar.gz 8.1 kB Details

Built distribution (wheel)

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

Total release size: 17.9 kB

Release files / dykes-0.5.0.tar.gz

Download URL dykes-0.5.0.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9cc966f3a8cbedf911c76ec127123701344eff1ed9f5045d0d32ee849828a590
BLAKE2b-256 checksum
How to use checksums
ef032dde60ec6ea87352fa1962c78cc2334e9e3048d3919b4f01af5fdc3ce21f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 17, 2026.

Transparency log

Release files / dykes-0.5.0-py3-none-any.whl

Download URL dykes-0.5.0-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
22f1c1df22c8e79978d9d5578d7d8d69dd2a7fd24abe8e91354262656e34881c
BLAKE2b-256 checksum
How to use checksums
f392a54a3bbd2c4df079fd73b255a4045976645a2ac9195792ba208badb6b647
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.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