Skip to main content

Apply changes across multiple repos at once.

Project description

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

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

modify_repos-0.1.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

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

modify_repos-0.1.0-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file modify_repos-0.1.0.tar.gz.

File metadata

  • Download URL: modify_repos-0.1.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for modify_repos-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d90b1dda3ba7ec007ebf223a81c95b1809d60404fa4f4836a58d3ffde5f48c62
MD5 7353754f23847c4aa2b73ffe667eaf18
BLAKE2b-256 20f73ac4573877b5e86fef8b304404a9a312bbe9c1ff7ffdd65420dda07adc80

See more details on using hashes here.

Provenance

The following attestation bundles were made for modify_repos-0.1.0.tar.gz:

Publisher: publish.yaml on davidism/modify-repos

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

File details

Details for the file modify_repos-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: modify_repos-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for modify_repos-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 29798265d1583536b38529a74a4415a18c854ae3044f3213f77728c6e3125d73
MD5 03e83585e3064ff29d7150bade1a4f7f
BLAKE2b-256 b7e885b62f9ce44c419be138b3c96ba76e21ba8cee2920ad35b6426d8a38dd5e

See more details on using hashes here.

Provenance

The following attestation bundles were made for modify_repos-0.1.0-py3-none-any.whl:

Publisher: publish.yaml on davidism/modify-repos

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