Skip to main content

👷‍♀️ PyMender

Perform entire codebase refactors in a way that is reproducible, testable and reviewable. Obeys .gitignore by default.

Usage

pip install pymender==0.2.2

pymender <codemod> <path_to_project>

What codemods are available?

⚡ FastAPIAnnotated

Converts FastAPI endpoints to use the preferred Annotated[<type>, Depends(<dependency>)] syntax rather than : <type> = Depends(<dependency>).

Why?

  • Default value of the function parameter is the actual default value.
  • Reuse of the function is now possible.
  • Type-safe usage of the functions, previously 'default' values where not type checked.
  • Multi-purpose e.g. Annotated[str, fastapi.Query(), typer.Argument()] is now possible.
pymender FastAPIAnnotated <folder-to-upgrade>
Before After
@router.get('/example')
def example_function(
value: int,
query: str = Query("foo"),
zar: str = Query(default="bar", alias="z"),
foo: str = Depends(get_foo),
*,
bar: str = Depends(get_bar),
body: str = Body(...),
) -> str:
return 'example'
@router.get('/example')
def example_function(
value: int,
foo: Annotated[str, Depends(get_foo)],
query: Annotated[str, Query()] = "foo",
zar: Annotated[str, Query(alias="z")] = "bar",
*,
bar: Annotated[str, Depends(get_bar)],
body: Annotated[str, Body()],
) -> str:
return 'example'

Developer Guide

# Run a particular codemod
python3 -m pymender <codemod> <path_to_project>
# e.g.
python3 -m pymender FastAPIAnnotated <path_to_project>

# Run the codemod directly
python3 -m libcst.tool codemode fastapi_annotated.FastAPIAnnotated <path_to_project>

# Run tests
pytest -vv

Thanks to:

  • libCST which does a lot of the hardwork for this.
  • autotyping for showing what was possible.

Metadata

Release files for pymender 0.2.2

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

Source distribution (sdist)

Source distribution for pymender 0.2.2
File Size Uploaded
pymender-0.2.2.tar.gz 6.7 kB Details

Built distribution (wheel)

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

Total release size: 13.7 kB

Release files / pymender-0.2.2.tar.gz

Download URL pymender-0.2.2.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d1e136799fa6bedebfca385bc7f1859334382b0e78500a412725f5ba514bc8f8
BLAKE2b-256 checksum
How to use checksums
f922160081027933908d609ca8397b7907c63b4ee122fa2a9a7ed8c49a9536d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 22, 2026.

Transparency log

Release files / pymender-0.2.2-py3-none-any.whl

Download URL pymender-0.2.2-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1dab6507df87e4ec6eed14f192a7445b63c5050058e188f5c5d283597a08becc
BLAKE2b-256 checksum
How to use checksums
73644d1b9bb18052b3184e52c52a2b96ef72d7fd853ef6a6e8eb7ad25957ebc7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 22, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.0.4

2 release files

0.0.3

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