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 poetry:

poetry 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.8.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.8-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fetch_cpy_src-0.1.8.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.8.tar.gz
Algorithm Hash digest
SHA256 784ef0af6db79eaa80e86a71392e2c63c3111c4ef5c4b42f46916d51db28dce6
MD5 f8b518f20a646979c263e2ff1606142f
BLAKE2b-256 bc208d5f1fd0ba1371b2de53dc970ddd4de92e455841f02673e539a4415ec709

See more details on using hashes here.

Provenance

The following attestation bundles were made for fetch_cpy_src-0.1.8.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.8-py3-none-any.whl.

File metadata

  • Download URL: fetch_cpy_src-0.1.8-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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 fed1a1dc65e1e3345e169e52d13a787b2501bfbab8d5616ec48d97f2e2740906
MD5 b681f1c80444801b2df2e30cb362a3a5
BLAKE2b-256 10bbba6b980aa58c17a242a95c6ee39c80a1e37e2a2816bc75a42d5633a9f409

See more details on using hashes here.

Provenance

The following attestation bundles were made for fetch_cpy_src-0.1.8-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