Skip to main content

Fetch selected part of cpython source repository.

Project description

Fetch selected part of cpython source repository.

PyPI Python Versions CI License

This project is part of phy.

Install

pip install fetch-cpy-src

List the files to be fetched

Make a manifest toml file with scheme like the following example:

# git repo tag
tag = "3.12"


# Specify items of source to fetch.

# This is a demo item specification for fetch single file of source repo.
#
# There are two REQUIRED fields:
# `path`: path of the file to be fetched;
# `type`: set to "file" for fetching single file.
[[items]]
path = 'Parser/asdl_c.py'
type = 'file'

# `rename` is OPTIONAL. Specifying this field can rename fetched file or move to 
# another directory.
rename = 'asdl_c.py'

# The `xxx_adapters` are OPTIONAL fields. Adapters will make pre-defined modification
# to fetched source files. 
#
#  + `file_adapters` will apply modification to fetch file (if type = 'file') or 
#    any files within fetched directory (if type = 'dir').
#  + `dir_adapters` will apply modification to the directory of the fetched file 
#    (if type = 'file') or the fetched directory (if type = 'dir').
# 
# In this example, 
#  + `TopLevelScriptImportAdapter` will refactor the fetched python script file to 
#    importable submodules.
#  + `AddDunderInitAdapter` will put an empty `__init__.py` at fetched directory, 
#    and thus make it a package.
file_adapters = ['TopLevelScriptImportAdapter']
dir_adapters = ['AddDunderInitAdapter']


# This is a demo item specification for fetch sub-directory of source repo.
# `path`: path of the directory to be fetched;
# `type`: set to "dir" for fetching entire sub-directory.
[[items]]
path = 'Grammar/'
type = 'dir'

Fetch files

Supposing the manifest file is demo.toml, fetch the files within the manifest by this command:

fetch-cpy-src fetch demo.toml

The full manual of the fetch-cpy-src command:

Usage: fetch-cpy-src [OPTIONS] COMMAND [ARGS]...

  group all sub commands

Options:
  --help  Show this message and exit.

Commands:
  fetch         Fetch files listed in manifest to destinition directory.
  new-manifest  Create a new manifest of cpython source files to be fetched.

API docs

These markdown docs are generated by pydoc-markdown:

pydoc-markdown -I src -m fetch_cpy_src --render-toc > docs/module.md

pydoc-markdown -I src -m fetch_cpy_src.adapter --render-toc > docs/adapter.md

pydoc-markdown -I src -m package_name.manifest --render-toc > docs/manifest.md

Develop

Build the package with uv:

uv build

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

fetch_cpy_src-0.1.9.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

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

fetch_cpy_src-0.1.9-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file fetch_cpy_src-0.1.9.tar.gz.

File metadata

  • Download URL: fetch_cpy_src-0.1.9.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fetch_cpy_src-0.1.9.tar.gz
Algorithm Hash digest
SHA256 093fef098ee4ea327677b762acc063352d9bc8a349a846fbcf9b08b9d62da698
MD5 47c19d0365d31a901c13a8cac3ed5030
BLAKE2b-256 6236c9d8cbfb6282deca812f0add7076f15e7221ba7a268544b7f9045a6a0159

See more details on using hashes here.

Provenance

The following attestation bundles were made for fetch_cpy_src-0.1.9.tar.gz:

Publisher: python-publish.yml on phy-precompiler/fetch-cpy-src

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fetch_cpy_src-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: fetch_cpy_src-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fetch_cpy_src-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 41bf898c01b43ddd3c1460d4845b785b49a7097fcbdb56e3c370c328227ef2d9
MD5 a852f1beefd35851a312c7c71d56b1bc
BLAKE2b-256 f93bfc442d20b414af7e8abd4e51bcb3e2e85f62baa2eb8f003ec1ea5c3ae825

See more details on using hashes here.

Provenance

The following attestation bundles were made for fetch_cpy_src-0.1.9-py3-none-any.whl:

Publisher: python-publish.yml on phy-precompiler/fetch-cpy-src

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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