multi-repo-automation


Namemulti-repo-automation JSON
Version 1.5.0 PyPI version JSON
download
home_pagehttps://github.com/sbrunner/multi-repo-automation
SummaryLibrary for automation updates on multiple repositories.
upload_time2024-12-04 09:47:01
maintainerNone
docs_urlNone
authorStéphane Brunner
requires_python>=3.9
licenseBSD-2-Clause
keywords pre-commit
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Multi repo automation

## Configuration

To be able to apply your changes on multiple repository you should create a file with something like this:

```yaml
- dir: /home/user/src/my-repo
  name: user/my-repo
  types: ['javascript', 'python', 'docker']
  master_branch: master
  stabilization_branches: [1.0, 1.1]
  folders_to_clean: []
```

The main configuration is a YAML file `~/.config/multi-repo-automation.yaml` with the following options:

`repos_filename`: the filename of the files with the repositories definitions create above, default is `repos.yaml`.
`browser`: the browser to use to open the pull requests, default is `xdg-open`.
`editor`: the editor to use to edit files, default is `xdg-open`.

## Migration script base

```python
#!/usr/bin/env python3

import multi_repo_automation as mra

def _do() -> None:
    # Your actions

if __name__ == "__main__":
    mra.main(
        _do,
        config={
        # pull_request_on_stabilization_branches: To apply the action on all stabilization (including master) branches.
        # pull_request_title: The pull request title.
        # pull_request_body: The pull request body.
        # branch: The created branch branch name.
        # pull_request_branch_prefix: The created branch prefix (used when we run it on all the stabilization branches).
        },
    )
```

Use the `--help` option to see the available options.

## Utilities

```python
import multi_repo_automation as mra

# Test if a file exists
if mra.run(["git", "ls-files", "**/*.txt"], stdout=subprocess.PIPE).stdout.strip() != "":
  print("Found")
# Get all YAML files:
mra.all_filenames_identify("yaml")
# Test if a file exists and contains a text
if mra.git_grep(file, r"\<text\>"]):
  print("Found")
# Edit a files manually
mra.edit(["file"])
```

### Edit file programmatically

```python
   with mra.Edit('my-file.txt') as edit:
      edit.content = edit.content.replace('<from>', '<to>')
```

### Edit YAML file programmatically

```python
   with mra.EditYAML('my-file.yaml') as edit:
      edit.setdefault('dict', {})['prop'] = 'value'
```

### Edit TOML file programmatically

```python
   with mra.EditTOML('my-file.toml') as edit:
      edit.setdefault('dict', {})['prop'] = 'value'
```

### Edit Config file programmatically

```python
   with mra.EditConfigL('my-file.ini') as edit:
      edit.setdefault('dict', {})['prop'] = 'value'
```

## Contributing

Install the pre-commit hooks:

```bash
pip install pre-commit
pre-commit install --allow-missing-config
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/sbrunner/multi-repo-automation",
    "name": "multi-repo-automation",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "pre-commit",
    "author": "St\u00e9phane Brunner",
    "author_email": "stephane.brunner@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/2e/9d/24f555af37e273b853a21ab3468f8b649cad4f7e67ac00f487a9bfed6f8c/multi_repo_automation-1.5.0.tar.gz",
    "platform": null,
    "description": "# Multi repo automation\n\n## Configuration\n\nTo be able to apply your changes on multiple repository you should create a file with something like this:\n\n```yaml\n- dir: /home/user/src/my-repo\n  name: user/my-repo\n  types: ['javascript', 'python', 'docker']\n  master_branch: master\n  stabilization_branches: [1.0, 1.1]\n  folders_to_clean: []\n```\n\nThe main configuration is a YAML file `~/.config/multi-repo-automation.yaml` with the following options:\n\n`repos_filename`: the filename of the files with the repositories definitions create above, default is `repos.yaml`.\n`browser`: the browser to use to open the pull requests, default is `xdg-open`.\n`editor`: the editor to use to edit files, default is `xdg-open`.\n\n## Migration script base\n\n```python\n#!/usr/bin/env python3\n\nimport multi_repo_automation as mra\n\ndef _do() -> None:\n    # Your actions\n\nif __name__ == \"__main__\":\n    mra.main(\n        _do,\n        config={\n        # pull_request_on_stabilization_branches: To apply the action on all stabilization (including master) branches.\n        # pull_request_title: The pull request title.\n        # pull_request_body: The pull request body.\n        # branch: The created branch branch name.\n        # pull_request_branch_prefix: The created branch prefix (used when we run it on all the stabilization branches).\n        },\n    )\n```\n\nUse the `--help` option to see the available options.\n\n## Utilities\n\n```python\nimport multi_repo_automation as mra\n\n# Test if a file exists\nif mra.run([\"git\", \"ls-files\", \"**/*.txt\"], stdout=subprocess.PIPE).stdout.strip() != \"\":\n  print(\"Found\")\n# Get all YAML files:\nmra.all_filenames_identify(\"yaml\")\n# Test if a file exists and contains a text\nif mra.git_grep(file, r\"\\<text\\>\"]):\n  print(\"Found\")\n# Edit a files manually\nmra.edit([\"file\"])\n```\n\n### Edit file programmatically\n\n```python\n   with mra.Edit('my-file.txt') as edit:\n      edit.content = edit.content.replace('<from>', '<to>')\n```\n\n### Edit YAML file programmatically\n\n```python\n   with mra.EditYAML('my-file.yaml') as edit:\n      edit.setdefault('dict', {})['prop'] = 'value'\n```\n\n### Edit TOML file programmatically\n\n```python\n   with mra.EditTOML('my-file.toml') as edit:\n      edit.setdefault('dict', {})['prop'] = 'value'\n```\n\n### Edit Config file programmatically\n\n```python\n   with mra.EditConfigL('my-file.ini') as edit:\n      edit.setdefault('dict', {})['prop'] = 'value'\n```\n\n## Contributing\n\nInstall the pre-commit hooks:\n\n```bash\npip install pre-commit\npre-commit install --allow-missing-config\n```\n\n",
    "bugtrack_url": null,
    "license": "BSD-2-Clause",
    "summary": "Library for automation updates on multiple repositories.",
    "version": "1.5.0",
    "project_urls": {
        "Homepage": "https://github.com/sbrunner/multi-repo-automation",
        "Repository": "https://github.com/sbrunner/multi-repo-automation"
    },
    "split_keywords": [
        "pre-commit"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7855d23e2ed70d74e1fb1833dd7fd79eca24ce7689773d215e9c1de2b2c128c5",
                "md5": "cf7bd89cdb745f2112bf46c72a8f78ef",
                "sha256": "60590e3a0fd5c67bb1525340d0f25f02d4e7304576cd7cfc596f182ec343220c"
            },
            "downloads": -1,
            "filename": "multi_repo_automation-1.5.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cf7bd89cdb745f2112bf46c72a8f78ef",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 21221,
            "upload_time": "2024-12-04T09:46:57",
            "upload_time_iso_8601": "2024-12-04T09:46:57.351097Z",
            "url": "https://files.pythonhosted.org/packages/78/55/d23e2ed70d74e1fb1833dd7fd79eca24ce7689773d215e9c1de2b2c128c5/multi_repo_automation-1.5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2e9d24f555af37e273b853a21ab3468f8b649cad4f7e67ac00f487a9bfed6f8c",
                "md5": "1baf9f77bcb7517e453fc2ced312e2b8",
                "sha256": "a64fa7a7134eaa42c3bf5cfc7cac3d143cfa0607cb06c3da9c77edc23e067f2b"
            },
            "downloads": -1,
            "filename": "multi_repo_automation-1.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1baf9f77bcb7517e453fc2ced312e2b8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 20262,
            "upload_time": "2024-12-04T09:47:01",
            "upload_time_iso_8601": "2024-12-04T09:47:01.755580Z",
            "url": "https://files.pythonhosted.org/packages/2e/9d/24f555af37e273b853a21ab3468f8b649cad4f7e67ac00f487a9bfed6f8c/multi_repo_automation-1.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-04 09:47:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sbrunner",
    "github_project": "multi-repo-automation",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "multi-repo-automation"
}
        
Elapsed time: 0.41904s