multi-repo-automation


Namemulti-repo-automation JSON
Version 1.2.0 PyPI version JSON
download
home_pagehttps://github.com/sbrunner/multi-repo-automation
SummaryLibrary for automation updates on multiple repositories.
upload_time2024-03-06 13:48:13
maintainer
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": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "pre-commit",
    "author": "St\u00e9phane Brunner",
    "author_email": "stephane.brunner@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/2e/83/4a37740f3589391816aa079c8cfae2984f0aaafdabed3e4f915d477eb491/multi_repo_automation-1.2.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.2.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": "15dd71f02c8c2c6c39a04dfa82c472334ef27960ce22ffffc0cd9993aa40d2fc",
                "md5": "4729aae990376ccbc077c3c595bbbac2",
                "sha256": "d6f6dedfb5cb3b59b9fccd7046735a56406a3c8af4defb46ad96db2640669cb2"
            },
            "downloads": -1,
            "filename": "multi_repo_automation-1.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4729aae990376ccbc077c3c595bbbac2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 21158,
            "upload_time": "2024-03-06T13:48:11",
            "upload_time_iso_8601": "2024-03-06T13:48:11.319628Z",
            "url": "https://files.pythonhosted.org/packages/15/dd/71f02c8c2c6c39a04dfa82c472334ef27960ce22ffffc0cd9993aa40d2fc/multi_repo_automation-1.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2e834a37740f3589391816aa079c8cfae2984f0aaafdabed3e4f915d477eb491",
                "md5": "27e6cbc02dc8490e34cfbe7ca4307351",
                "sha256": "c6b5d67c0c3d85f4f8eae81dfbd0e71de0bd5bd06160d20fc5c609b1c1619d7f"
            },
            "downloads": -1,
            "filename": "multi_repo_automation-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "27e6cbc02dc8490e34cfbe7ca4307351",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 20234,
            "upload_time": "2024-03-06T13:48:13",
            "upload_time_iso_8601": "2024-03-06T13:48:13.008400Z",
            "url": "https://files.pythonhosted.org/packages/2e/83/4a37740f3589391816aa079c8cfae2984f0aaafdabed3e4f915d477eb491/multi_repo_automation-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-06 13:48:13",
    "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.21572s