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

Uploaded Python 3

File details

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

File metadata

  • Download URL: modify_repos-0.1.1.tar.gz
  • Upload date:
  • Size: 9.6 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.1.tar.gz
Algorithm Hash digest
SHA256 9c877f2860bbc98d5d41395e307e36f6049c1eb2b1bbaf2c936e8a313b50b478
MD5 f4cc2869b44efe976dd4876d779122eb
BLAKE2b-256 0ef63612a16b592ccd9858bcf939deb54f15c881ea7917e2fb13a562b004454a

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: modify_repos-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8d1e20572434ae7e1b9f36be3b1a64dd374d55eae61b9dbb7b8e75735ff1756c
MD5 f20eb324ba71cc1597ef70a032a1f905
BLAKE2b-256 f8304254c4e597e30d2c09b064def7b833de6c654b298aed20776a87852b33bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for modify_repos-0.1.1-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