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.7.tar.gz (9.9 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.7-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fetch_cpy_src-0.1.7.tar.gz
  • Upload date:
  • Size: 9.9 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.7.tar.gz
Algorithm Hash digest
SHA256 838a253a33124cd61db4f2c64596e51ee331e943c27d79b0523f327f56884dfe
MD5 a40e685e9874a7b60a078ec4233d9dc9
BLAKE2b-256 79b3259fccae7e76e80dc6105bf4731bf1527a9f465fabc2b62d48e42cece6cc

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: fetch_cpy_src-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 12.6 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 3ddc6a33190ed11db07d51403122249ddd611f44a0eac08985d05e836ef81d9f
MD5 da9de36f464dad7535ce78ce5385e7df
BLAKE2b-256 3e96c343849fef95303992b5e4ec40f3d49e1c83962e0f7c7a11ed8516f8145b

See more details on using hashes here.

Provenance

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