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.2.0.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.

modify_repos-0.2.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: modify_repos-0.2.0.tar.gz
  • Upload date:
  • Size: 9.9 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.2.0.tar.gz
Algorithm Hash digest
SHA256 3fe0425aee76a1ef5999edd9dda834b1b2fb9dc20d1f01b4b6cc5b68fd32d3bf
MD5 c154d2bd4d1dcd9ab01bfa36280814d8
BLAKE2b-256 f1b5478c6e29b687337ee814aaf9af2b6abb0c761cd9be68bacd8d9da1f7c5ba

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: modify_repos-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 12.4 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ace7cbb3a1cb3119f109a76d09b13842890c35345039bcb43a6aef6b97d39e13
MD5 0275f030ec42f6c82d65d57598a79af8
BLAKE2b-256 9b2336acc29f5670f566cd0321ff97976fca538e3f2158bd7411cc17b89a6c88

See more details on using hashes here.

Provenance

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