Skip to main content

modify-repos

Clone, modify, and create pull requests across multiple repositories at once.

[!WARNING] This is under development, and how it's used may change at any time.

Documentation: https://modify-repos.readthedocs.io/

Example Use

Use uv to create a script that depends on this library.

$ uv init --script mod.py
$ uv add --script mod.py modify-repos

Subclass modify_repos.GitHubScript to define the repositories to change and what changes to make. This uses the gh GitHub CLI, which must already be installed and logged in.

from modify_repos import GitHubScript, GitHubRepo

class MyScript(GitHubScript):
    # title used in commit and PR
    title = "..."
    # description used in commit and PR
    body = "..."
    # branch to merge into, defaults to main
    target = "main"
    # branch to create and PR
    branch = "my-changes"
    # one or more users/orgs to clone repos from
    orgs = ["username"]

    def select_for_clone(self, repo: GitHubRepo) -> bool:
        # filter to only clone some of the available repos
        return repo.name in {"a", "b", "d"}

    def modify(self, repo: GitHubRepo) -> None:
        # make any changes, such as add/remove files, here
        ...

if __name__ == "__main__":
    MyScript().run()

Call uv run mod.py, and it will clone and modify all the selected repos. PRs will not be created unless you use MyScript(submit=True) instead, so you can develop and preview your changes first.

Develop

This project uses uv to manage the development environment and tox to define different tests and management scripts.

# set up env
$ uv sync
$ uv run pre-commit install --install-hooks

# run tests and checks
$ uv run tox p

# develop docs with auto build and serve
$ uv run tox r -e docs-auto

# update dependencies
$ uv run tox r -m update

Release files for modify-repos 0.2.0

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

Source distribution (sdist)

Source distribution for modify-repos 0.2.0
File Size Uploaded
modify_repos-0.2.0.tar.gz 9.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for modify-repos 0.2.0
File Interpreter ABI Platform
modify_repos-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.3 kB

Release files / modify_repos-0.2.0.tar.gz

Download URL modify_repos-0.2.0.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3fe0425aee76a1ef5999edd9dda834b1b2fb9dc20d1f01b4b6cc5b68fd32d3bf
BLAKE2b-256 checksum
How to use checksums
f1b5478c6e29b687337ee814aaf9af2b6abb0c761cd9be68bacd8d9da1f7c5ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

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 Jan 14, 2025.

Transparency log

Release files / modify_repos-0.2.0-py3-none-any.whl

Download URL modify_repos-0.2.0-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ace7cbb3a1cb3119f109a76d09b13842890c35345039bcb43a6aef6b97d39e13
BLAKE2b-256 checksum
How to use checksums
9b2336acc29f5670f566cd0321ff97976fca538e3f2158bd7411cc17b89a6c88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

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 Jan 14, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

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