Skip to main content

Python API dumping and comparison tool

Dumps the public API of a Python module and its members to a file, which can then be used to show differences in the public API between two dumps, e.g. of different versions of the same module.

Command-line interface

$ py-api-dumper --help
  • To dump the public API of a module mymod:

    $ py-api-dumper dump -o mymod1.dump mymod
    

    mymod1.dump will record the public API of mymod in a reloadable format.

  • To print the API of mymod in text format:

    $ py-api-dumper dump mymod
    MODULE : mymod
        CLASS : myclass
            FUNCTION : __init__ : no-return-type
                REQUIRED : 0 : x : int
    ...
    

    The text format is a tree of entries of each nested class, class method, function, member variable, etc. in the public API.

  • To compare the API of mymod between different versions:

    $ py-api-dumper diff mymod-old.dump mymod-new.dump
    --- mymod-old.dump mymod=1.0
    +++ mymod-new.dump mymod=2.0
    +MODULE : mymod
    +    CLASS : myclass
    +        FUNCTION : __init__ : no-return-type
    +            REQUIRED : 1 : b : no-type
    

    The above output shows the expected output if, between mymod versions 1.0 and 2.0, an additional positional argument b had been added to the __init__ method of the class mymod.myclass.

    $ py-api-dumper diff -o mymod.diff ...
    

    This will write out the API differences to mymod.diff in JSON format:

    • the paths to the dumps of the old and new APIs, e.g. mymod-old.dump vs. mymod-new.dump;
    • the version of mymod at the old and new API dumps, e.g. mymod 1.0 vs. 2.0;
    • API entries which have been removed, i.e. present in the old API but not in the new API (e.g. none in the above example);
    • API entries which have been added, i.e. present in the new API but not in the old API (e.g. the b argument in the above example).
  • To filter out undesired entries from API dumps before comparison:

    $ py-api-dumper diff mymod-old.dump mymod-new.dump -i <filter>
    

    Given the following API:

    MODULE : mymod
        CLASS : myclass
            FUNCTION : __init__ : no-return-type
                REQUIRED : 0 : x : int
    

    the following filters would ignore the given entries:

    <filter> Ignore entries
    MODULE All modules
    MODULE:mymod All modules named mymod
    CLASS All classes
    CLASS:myclass All classes named myclass
    MODULE:mymod;CLASS All classes in modules named mymod
    MODULE:mymod;CLASS:myclass Class myclass in module mymod
    FUNCTION:__init__ All functions named __init__
    CLASS;FUNCTION:__init__ All functioned named __init__ in classes

Python interface

from py_api_dumper import APIDump, APIDiff
  • To dump the public API of a module mymod:

    import mymod
    dump = APIDump.from_modules(mymod)   # OR: APIDump.from_modules("mymod")
    dump.save_to_file("mymod.dump")
    
  • To print the API of mymod in text format:

    dump.print_as_text()
    
  • To compare the API of mymod between different versions:

    diff = APIDiff.from_files("mymod-old.dump", "mymod-new.dump")
    diff.print_as_text()
    diff.save_as_json("mymod.diff")
    
  • To filter out undesired entries from API dumps before comparison:

    filter = APIFilter(("CLASS", "myclass"))   # OR: APIFilter.from_str("CLASS:myclass")
    diff = APIDiff.from_files("mymod-old.dump", "mymod-new.dump", filter)
    

Metadata

Release files for py-api-dumper 4.2.3

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

Source distribution (sdist)

Source distribution for py-api-dumper 4.2.3
File Size Uploaded Provenance Actions
py_api_dumper-4.2.3.tar.gz 21.0 kB With provenance Details for py_api_dumper-4.2.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for py-api-dumper 4.2.3
File Interpreter ABI Platform Actions
py_api_dumper-4.2.3-py3-none-any.whl Python 3 none any Details for py_api_dumper-4.2.3-py3-none-any.whl

Total release size: 34.2 kB

Release files / py_api_dumper-4.2.3.tar.gz

Download URL py_api_dumper-4.2.3.tar.gz
Size 21.0 kB
Tags Source
SHA-256 checksum
How to use checksums
272650422f6a1c9a772e1f24018c92840a322c68bb83d21c642b455df0cae588
BLAKE2b-256 checksum
How to use checksums
ca65f2c1d58d6c561b8ff6d9f63c0f10b56bc0fc7bef2248314da43004462f8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 7, 2026.

Transparency log

Release files / py_api_dumper-4.2.3-py3-none-any.whl

Download URL py_api_dumper-4.2.3-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c524980fc883bf6f87954293048be4927c99049d51a49043e055a16fb28fe6b
BLAKE2b-256 checksum
How to use checksums
4fbf6e74fb55cd41aa0b18acfbc00aea0149989b818c97b07b9e8442f43c0916
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 7, 2026.

Transparency log

Security for py-api-dumper 4.2.3

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for py_api_dumper-4.2.3.tar.gz

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 Nov 7, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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