Skip to main content

No project description provided

Project description

rcmt

pypi python docs

rcmt automates refactorings across many repositories.

Write Python code to define how the content of files should look like. Then let rcmt apply the changes across repositories and create pull requests.

Features

  • Mass Refactoring - create, update or delete files across many repositories.
  • Automation - automatic creation of merge requests in repositories; optionally merge them automatically if approved and all checks have passed.
  • Flexibility - call third-party APIs or integrate libraries.

The Task file

A Task file tells rcmt which repositories to modify. It is written in Python.

from rcmt import Task, Context, register_task


# Replace with your repository.
REPOSITORY = "github.com/wndhydrnt/rcmt-example"

# A Task bundles the code that determines which repositories to modify and how to modify
# them. It is a regular Python class that extends the base class `Task`.
class HelloWorld(Task):
    name = "hello-world"
    pr_title = "rcmt Hello World"
    pr_body = """This pull request has been created as part of the how-to guide:

https://rcmt.readthedocs.io/get-started/create-a-task/
"""

    # The `filter` method determines which repositories to modify. It is called by rcmt
    # for each repository.
    def filter(self, ctx: Context) -> bool:
        return ctx.repo.full_name == REPOSITORY

    # The `apply` method contains the code that modifies files in a repository. In this
    # example, the `own` function creates the file `hello-world.txt` with the content
    # `Hello World` in the root of the repository. `target` is not an absolute path
    # because rcmt automatically sets the current working directory (`cwd`) to the
    # checkout of the repository.
    def apply(self, ctx: Context) -> None:
        with open("hello-world.txt", "w+") as f:
            f.write("Hello World")


# Register the task with rcmt so rcmt knows about it.
register_task(HelloWorld())

What's next

Contributing

Learn how to contribute code to rcmt

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

rcmt-0.30.0.tar.gz (36.5 kB view details)

Uploaded Source

Built Distribution

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

rcmt-0.30.0-py3-none-any.whl (48.9 kB view details)

Uploaded Python 3

File details

Details for the file rcmt-0.30.0.tar.gz.

File metadata

  • Download URL: rcmt-0.30.0.tar.gz
  • Upload date:
  • Size: 36.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.7 Linux/6.2.0-1018-azure

File hashes

Hashes for rcmt-0.30.0.tar.gz
Algorithm Hash digest
SHA256 fdab03f5269abc84b255fb737fe7fb8d75f635f44497efd500ae39f575ea662a
MD5 9bba9d0e6371c7eb6e78dced4159e20d
BLAKE2b-256 b45df205ce64e23d02c619d03aad7a707b0af15381d169350fd6281379375ebc

See more details on using hashes here.

File details

Details for the file rcmt-0.30.0-py3-none-any.whl.

File metadata

  • Download URL: rcmt-0.30.0-py3-none-any.whl
  • Upload date:
  • Size: 48.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.7 Linux/6.2.0-1018-azure

File hashes

Hashes for rcmt-0.30.0-py3-none-any.whl
Algorithm Hash digest
SHA256 65b0e8f633b072be42582baa985cbbe84b666338174fbec3d20cdd105afaccb4
MD5 167980df34d80c36e16200df9b480cc8
BLAKE2b-256 0f7892a688dc1d0c6f9bd4c6f90a3d4f742465415f9d4d33d487fb5bf909a26b

See more details on using hashes here.

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