diff --git a/.cspell.json b/.cspell.json index f26e6fdb..cdc34be1 100644 --- a/.cspell.json +++ b/.cspell.json @@ -49,7 +49,6 @@ "oneline", "pytest", "PYTHONHASHSEED", - "repoma", "sympy", "toctree", "Zenodo" diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 54c3690a..d07146a0 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,4 +1,4 @@ -name-template: ComPWA Repository Maintenance $NEXT_PATCH_VERSION +name-template: ComPWA repository policy $NEXT_PATCH_VERSION tag-template: $NEXT_PATCH_VERSION references: @@ -34,4 +34,4 @@ sort-direction: ascending template: | $CHANGES - _The full changelog as commits can be found [here](https://github.com/ComPWA/repo-maintenance/compare/$PREVIOUS_TAG...$NEXT_PATCH_VERSION)._ + _The full changelog as commits can be found [here](https://github.com/ComPWA/policy/compare/$PREVIOUS_TAG...$NEXT_PATCH_VERSION)._ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 406eaf2b..24ff2e6d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: pytest: uses: ComPWA/actions/.github/workflows/pytest.yml@v1 with: - coverage-target: repoma + coverage-target: compwa_policy macos-python-version: "3.9" specific-pip-packages: ${{ inputs.specific-pip-packages }} style: diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index cda71285..aaf841ba 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -22,12 +22,12 @@ jobs: pip install labels - name: Sync general issue labels run: | + labels sync --filename labels/default.toml --owner ComPWA --repo RUB-EP1-AG labels sync --filename labels/default.toml --owner ComPWA --repo ampform labels sync --filename labels/default.toml --owner ComPWA --repo benchmarks labels sync --filename labels/default.toml --owner ComPWA --repo compwa-org - labels sync --filename labels/default.toml --owner ComPWA --repo RUB-EP1-AG + labels sync --filename labels/default.toml --owner ComPWA --repo policy labels sync --filename labels/default.toml --owner ComPWA --repo qrules - labels sync --filename labels/default.toml --owner ComPWA --repo repo-maintenance labels sync --filename labels/default.toml --owner ComPWA --repo sphinxcontrib-hep-pdgref labels sync --filename labels/default.toml --owner ComPWA --repo tensorwaves labels sync --filename labels/default.toml --owner ComPWA --repo update-pip-constraints diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 57387f32..b498a94d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ ci: - mypy - prettier - pyright - - repoma-self-check + - self-check - taplo repos: @@ -47,12 +47,12 @@ repos: - --no-notebooks - --no-prettierrc - --no-pypi - - --repo-name=repo-maintenance - - --repo-title=ComPWA Repository Maintenance + - --repo-name=policy + - --repo-title=ComPWA repository policy - - id: repoma-self-check - name: repoma-self-check - entry: repoma-self-check + - id: self-check + name: self-check + entry: self-check language: python files: ^\.pre\-commit\-(config|hooks)\.yaml$ diff --git a/.vscode/settings.json b/.vscode/settings.json index 31c5a4ab..4f87c4bc 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -60,11 +60,11 @@ ".github/workflows/cd.yml": true, ".github/workflows/ci.yml": true, ".taplo.toml": true, - "src/repoma/.github/workflows/clean-caches.yml": true, - "src/repoma/.github/workflows/pr-linting.yml": true, - "src/repoma/.github/workflows/release-drafter.yml": true, - "src/repoma/.template/.gitpod.yml": true, - "src/repoma/.template/.prettierrc": true + "src/compwa_policy/.github/workflows/clean-caches.yml": true, + "src/compwa_policy/.github/workflows/pr-linting.yml": true, + "src/compwa_policy/.github/workflows/release-drafter.yml": true, + "src/compwa_policy/.template/.gitpod.yml": true, + "src/compwa_policy/.template/.prettierrc": true }, "yaml.schemas": { "https://citation-file-format.github.io/1.2.0/schema.json": "CITATION.cff", diff --git a/README.md b/README.md index 5a6e6fcb..85624e1e 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,15 @@ -# Repository maintenance +# ComPWA repository policy [![BSD 3-Clause license](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) [![Spelling checked](https://img.shields.io/badge/cspell-checked-brightgreen.svg)](https://github.com/streetsidesoftware/cspell/tree/master/packages/cspell) -[![GitPod](https://img.shields.io/badge/gitpod-open-blue?logo=gitpod)](https://gitpod.io/#https://github.com/ComPWA/repo-maintenance) +[![GitPod](https://img.shields.io/badge/gitpod-open-blue?logo=gitpod)](https://gitpod.io/#https://github.com/ComPWA/policy) [![pytest](https://github.com/ComPWA/qrules/workflows/pytest/badge.svg)](https://github.com/ComPWA/qrules/actions?query=branch%3Amain+workflow%3Apytest) -[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/ComPWA/repo-maintenance/main.svg)](https://results.pre-commit.ci/latest/github/ComPWA/repo-maintenance/main) +[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/ComPWA/policy/main.svg)](https://results.pre-commit.ci/latest/github/ComPWA/policy/main) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) -This repository is to standardize the developer environment of Python packages by the -[ComPWA organization](https://github.com/ComPWA). The maintenance is performed through -[pre-commit](https://pre-commit.com). - -See also the [develop](https://compwa-org.readthedocs.io/en/stable/develop.html) page. +This repository sets the policies for developer environment in repositories if the [ComPWA organization](https://github.com/ComPWA) (See our [Help developing](https://compwa-org.readthedocs.io/en/stable/develop.html) page). The policies are automatically enforced through [pre-commit](https://pre-commit.com). ## Usage @@ -21,7 +17,7 @@ Add a `.pre-commit-config.yaml` file to your repository with the following conte ```yaml repos: - - repo: https://github.com/ComPWA/repo-maintenance + - repo: https://github.com/ComPWA/policy rev: "" hooks: - id: check-dev-files @@ -34,7 +30,7 @@ repos: then run ```shell -pre-commit autoupdate --repo=https://github.com/ComPWA/repo-maintenance +pre-commit autoupdate --repo=https://github.com/ComPWA/policy ``` This example lists [all available hooks](./.pre-commit-hooks.yaml) (listed here as `id`s) ― you can remove some of them. diff --git a/docs/check-dev-files.md b/docs/check-dev-files.md index cb329716..9c447336 100644 --- a/docs/check-dev-files.md +++ b/docs/check-dev-files.md @@ -6,7 +6,7 @@ The `check-dev-files` hook can also be used as a **cookie cutter** for new repos ```yaml repos: - - repo: https://github.com/ComPWA/repo-maintenance + - repo: https://github.com/ComPWA/policy rev: "" hooks: - id: check-dev-files @@ -17,7 +17,7 @@ repos: and running ```shell -pre-commit autoupdate --repo=https://github.com/ComPWA/repo-maintenance +pre-commit autoupdate --repo=https://github.com/ComPWA/policy pre-commit run check-dev-files -a ``` @@ -28,7 +28,7 @@ For more implementation details of this hook, check the {mod}`.check_dev_files` The `check-dev-files` hook can be configured with by adding any of the following flags to the [`args`](https://pre-commit.com/#config-args) key in your `.pre-commit-config.yaml` file. ```{argparse} -:module: repoma.check_dev_files +:module: compwa_policy.check_dev_files :func: _create_argparse :prog: check-dev-files ``` diff --git a/docs/conf.py b/docs/conf.py index ae0196b7..947c0baa 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -3,8 +3,9 @@ from sphinx_api_relink.helpers import get_package_version ORGANIZATION = "ComPWA" -REPO_NAME = "repo-maintenance" -PACKAGE_NAME = "repoma" +REPO_NAME = "policy" +REPO_TITLE = "ComPWA repository policy" +PACKAGE_NAME = "compwa_policy" api_github_repo = f"{ORGANIZATION}/{REPO_NAME}" api_target_substitutions: dict[str, str | tuple[str, str]] = { @@ -54,7 +55,7 @@ html_static_path = ["_static"] html_theme = "sphinx_book_theme" html_theme_options = { - "logo": {"text": REPO_NAME}, + "logo": {"text": "ComPWA policy"}, "repository_url": f"https://github.com/{ORGANIZATION}/{REPO_NAME}", "repository_branch": "main", "path_to_docs": "docs", @@ -62,7 +63,7 @@ "show_navbar_depth": 2, "show_toc_level": 2, } -html_title = REPO_NAME +html_title = REPO_TITLE intersphinx_mapping = { "attrs": ("https://www.attrs.org/en/stable", None), "nbformat": ("https://nbformat.readthedocs.io/en/stable", None), @@ -81,6 +82,6 @@ ] nitpicky = True primary_domain = "py" -project = REPO_NAME -release = get_package_version(REPO_NAME) -version = get_package_version(REPO_NAME) +project = PACKAGE_NAME +release = get_package_version(PACKAGE_NAME) +version = get_package_version(PACKAGE_NAME) diff --git a/docs/index.md b/docs/index.md index e781affa..f9c0e8e2 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,9 +1,9 @@ -# ComPWA repo maintenance! +# ComPWA repository policy :::{title} Welcome ::: -This package standardizes and synchronizes the developer environment of repositories by the [ComPWA organization](https://github.com/ComPWA). The maintenance is performed through [pre-commit](https://pre-commit.com) with the use of a number of pre-commit hooks as defined by [`.pre-commit-hooks.yaml`](../.pre-commit-hooks.yaml). The [`check-dev-files`](./check-dev-files.md) in particular can be used as a **cookie cutter** for new repositories. +This repository sets policies for [repositories of the ComPWA organization](https://github.com/orgs/ComPWA/repositories). The policies are enforced through [pre-commit](https://pre-commit.com) with the use of a number of pre-commit hooks as defined by [`.pre-commit-hooks.yaml`](../.pre-commit-hooks.yaml). The [`check-dev-files`](./check-dev-files.md) in particular can be used as a **cookie cutter** for new repositories. ## Usage @@ -11,7 +11,7 @@ Add a [`.pre-commit-config.yaml`](https://pre-commit.com/index.html#adding-pre-c ```yaml repos: - - repo: https://github.com/ComPWA/repo-maintenance + - repo: https://github.com/ComPWA/policy rev: "" hooks: - id: check-dev-files @@ -28,11 +28,11 @@ and install and activate [`pre-commit`](https://pre-commit.com/#install) as foll ```shell pip install pre-commit -pre-commit autoupdate --repo=https://github.com/ComPWA/repo-maintenance +pre-commit autoupdate --repo=https://github.com/ComPWA/policy pre-commit install ``` -The `repo-maintenance` repository provides the following hooks: +The **ComPWA/policy** repository provides the following hooks: - [`check-dev-files`](./check-dev-files.md) - {mod}`colab-toc-visible <.colab_toc_visible>` @@ -44,8 +44,8 @@ The `repo-maintenance` repository provides the following hooks: ```{toctree} :hidden: check-dev-files -API -Changelog -Upcoming features +API +Changelog +Upcoming features Help developing ``` diff --git a/environment.yml b/environment.yml index a924cf81..9a272fcd 100644 --- a/environment.yml +++ b/environment.yml @@ -1,4 +1,4 @@ -name: repo-maintenance +name: compwa-policy channels: - defaults dependencies: diff --git a/pyproject.toml b/pyproject.toml index 6e4cd514..b7af7581 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,15 +38,15 @@ description = "Pre-commit hooks that ensure that ComPWA repositories have a simi dynamic = ["version"] license = {text = "BSD 3-Clause License"} maintainers = [{email = "compwa-admin@ep1.rub.de"}] -name = "repo-maintenance" +name = "compwa-policy" requires-python = ">=3.7" [project.optional-dependencies] dev = [ + "compwa-policy[doc]", + "compwa-policy[sty]", + "compwa-policy[test]", "labels", - "repo-maintenance[doc]", - "repo-maintenance[sty]", - "repo-maintenance[test]", "sphinx-autobuild", "tox >=1.9", # for skip_install, use_develop ] @@ -63,8 +63,8 @@ format = [ "black", ] lint = [ + "compwa-policy[mypy]", "radon", - "repo-maintenance[mypy]", "ruff", ] mypy = [ @@ -74,10 +74,10 @@ mypy = [ "types-toml", ] sty = [ + "compwa-policy[format]", + "compwa-policy[lint]", + "compwa-policy[test]", # for pytest type hints "pre-commit >=1.4.0", - "repo-maintenance[format]", - "repo-maintenance[lint]", - "repo-maintenance[test]", # for pytest type hints ] test = [ "pytest", @@ -90,17 +90,17 @@ content-type = "text/markdown" file = "README.md" [project.scripts] -check-dev-files = "repoma.check_dev_files:main" -colab-toc-visible = "repoma.colab_toc_visible:main" -fix-nbformat-version = "repoma.fix_nbformat_version:main" -format-setup-cfg = "repoma.format_setup_cfg:main" -pin-nb-requirements = "repoma.pin_nb_requirements:main" -repoma-self-check = "repoma.self_check:main" -set-nb-cells = "repoma.set_nb_cells:main" +check-dev-files = "compwa_policy.check_dev_files:main" +colab-toc-visible = "compwa_policy.colab_toc_visible:main" +fix-nbformat-version = "compwa_policy.fix_nbformat_version:main" +format-setup-cfg = "compwa_policy.format_setup_cfg:main" +pin-nb-requirements = "compwa_policy.pin_nb_requirements:main" +self-check = "compwa_policy.self_check:main" +set-nb-cells = "compwa_policy.set_nb_cells:main" [project.urls] -Source = "https://github.com/ComPWA/repo-maintenance" -Tracker = "https://github.com/ComPWA/repo-maintenance/issues" +Source = "https://github.com/ComPWA/policy" +Tracker = "https://github.com/ComPWA/policy/issues" [tool.setuptools] include-package-data = false @@ -108,7 +108,7 @@ license-files = ["LICENSE"] package-dir = {"" = "src"} [tool.setuptools.package-data] -repoma = [ +compwa_policy = [ ".github/*", ".github/**/*", ".template/*", @@ -121,7 +121,7 @@ namespaces = false where = ["src"] [tool.setuptools_scm] -write_to = "src/repoma/version.py" +write_to = "src/compwa_policy/version.py" [tool.black] exclude = ''' @@ -155,7 +155,7 @@ source = ["src"] [tool.mypy] disallow_incomplete_defs = true disallow_untyped_defs = true -exclude = '.*/repoma/__init__\.py' +exclude = '.*/compwa_policy/__init__\.py' files = ["**/*.py"] show_error_codes = true warn_unused_configs = true @@ -294,7 +294,7 @@ target-version = "py37" task-tags = ["cspell"] [tool.ruff.isort] -known-first-party = ["repoma"] +known-first-party = ["compwa_policy"] [tool.ruff.per-file-ignores] "docs/*" = [ diff --git a/src/repoma/.github/release-drafter.yml b/src/compwa_policy/.github/release-drafter.yml similarity index 100% rename from src/repoma/.github/release-drafter.yml rename to src/compwa_policy/.github/release-drafter.yml diff --git a/src/repoma/.github/workflows/cd.yml b/src/compwa_policy/.github/workflows/cd.yml similarity index 100% rename from src/repoma/.github/workflows/cd.yml rename to src/compwa_policy/.github/workflows/cd.yml diff --git a/src/repoma/.github/workflows/ci.yml b/src/compwa_policy/.github/workflows/ci.yml similarity index 100% rename from src/repoma/.github/workflows/ci.yml rename to src/compwa_policy/.github/workflows/ci.yml diff --git a/src/repoma/.github/workflows/clean-caches.yml b/src/compwa_policy/.github/workflows/clean-caches.yml similarity index 100% rename from src/repoma/.github/workflows/clean-caches.yml rename to src/compwa_policy/.github/workflows/clean-caches.yml diff --git a/src/repoma/.github/workflows/pr-linting.yml b/src/compwa_policy/.github/workflows/pr-linting.yml similarity index 100% rename from src/repoma/.github/workflows/pr-linting.yml rename to src/compwa_policy/.github/workflows/pr-linting.yml diff --git a/src/repoma/.github/workflows/release-drafter.yml b/src/compwa_policy/.github/workflows/release-drafter.yml similarity index 100% rename from src/repoma/.github/workflows/release-drafter.yml rename to src/compwa_policy/.github/workflows/release-drafter.yml diff --git a/src/repoma/.github/workflows/requirements.yml b/src/compwa_policy/.github/workflows/requirements.yml similarity index 100% rename from src/repoma/.github/workflows/requirements.yml rename to src/compwa_policy/.github/workflows/requirements.yml diff --git a/src/repoma/.gitignore b/src/compwa_policy/.gitignore similarity index 100% rename from src/repoma/.gitignore rename to src/compwa_policy/.gitignore diff --git a/src/repoma/.template/.cspell.json b/src/compwa_policy/.template/.cspell.json similarity index 99% rename from src/repoma/.template/.cspell.json rename to src/compwa_policy/.template/.cspell.json index 40593884..efe4a740 100644 --- a/src/repoma/.template/.cspell.json +++ b/src/compwa_policy/.template/.cspell.json @@ -65,7 +65,6 @@ "mypy", "pytest", "PYTHONHASHSEED", - "repoma", "toctree", "Zenodo" ], diff --git a/src/repoma/.template/.gitpod.yml b/src/compwa_policy/.template/.gitpod.yml similarity index 100% rename from src/repoma/.template/.gitpod.yml rename to src/compwa_policy/.template/.gitpod.yml diff --git a/src/repoma/.template/.prettierrc b/src/compwa_policy/.template/.prettierrc similarity index 100% rename from src/repoma/.template/.prettierrc rename to src/compwa_policy/.template/.prettierrc diff --git a/src/repoma/.template/.taplo.toml b/src/compwa_policy/.template/.taplo.toml similarity index 100% rename from src/repoma/.template/.taplo.toml rename to src/compwa_policy/.template/.taplo.toml diff --git a/src/repoma/__init__.py b/src/compwa_policy/__init__.py similarity index 100% rename from src/repoma/__init__.py rename to src/compwa_policy/__init__.py diff --git a/src/repoma/check_dev_files/__init__.py b/src/compwa_policy/check_dev_files/__init__.py similarity index 97% rename from src/repoma/check_dev_files/__init__.py rename to src/compwa_policy/check_dev_files/__init__.py index 32b40264..d6b2bd64 100644 --- a/src/repoma/check_dev_files/__init__.py +++ b/src/compwa_policy/check_dev_files/__init__.py @@ -7,8 +7,8 @@ from argparse import ArgumentParser from typing import TYPE_CHECKING, Any, Sequence -from repoma.check_dev_files.deprecated import remove_deprecated_tools -from repoma.utilities.executor import Executor +from compwa_policy.check_dev_files.deprecated import remove_deprecated_tools +from compwa_policy.utilities.executor import Executor from . import ( black, @@ -39,7 +39,7 @@ ) if TYPE_CHECKING: - from repoma.utilities.project_info import PythonVersion + from compwa_policy.utilities.project_info import PythonVersion def main(argv: Sequence[str] | None = None) -> int: diff --git a/src/repoma/check_dev_files/black.py b/src/compwa_policy/check_dev_files/black.py similarity index 90% rename from src/repoma/check_dev_files/black.py rename to src/compwa_policy/check_dev_files/black.py index fb379111..28f2b26f 100644 --- a/src/repoma/check_dev_files/black.py +++ b/src/compwa_policy/check_dev_files/black.py @@ -3,15 +3,15 @@ from ruamel.yaml import YAML from ruamel.yaml.comments import CommentedMap -from repoma.errors import PrecommitError -from repoma.utilities import CONFIG_PATH, vscode -from repoma.utilities.executor import Executor -from repoma.utilities.precommit import ( +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities import CONFIG_PATH, vscode +from compwa_policy.utilities.executor import Executor +from compwa_policy.utilities.precommit import ( remove_precommit_hook, update_single_hook_precommit_repo, ) -from repoma.utilities.project_info import get_supported_python_versions -from repoma.utilities.pyproject import ( +from compwa_policy.utilities.project_info import get_supported_python_versions +from compwa_policy.utilities.pyproject import ( complies_with_subset, get_sub_table, load_pyproject, diff --git a/src/repoma/check_dev_files/citation.py b/src/compwa_policy/check_dev_files/citation.py similarity index 97% rename from src/repoma/check_dev_files/citation.py rename to src/compwa_policy/check_dev_files/citation.py index a72ac3e2..b5e132e2 100644 --- a/src/repoma/check_dev_files/citation.py +++ b/src/compwa_policy/check_dev_files/citation.py @@ -14,10 +14,10 @@ PreservedScalarString, ) -from repoma.errors import PrecommitError -from repoma.utilities import CONFIG_PATH, vscode -from repoma.utilities.executor import Executor -from repoma.utilities.precommit import ( +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities import CONFIG_PATH, vscode +from compwa_policy.utilities.executor import Executor +from compwa_policy.utilities.precommit import ( find_repo, load_round_trip_precommit_config, update_single_hook_precommit_repo, diff --git a/src/repoma/check_dev_files/commitlint.py b/src/compwa_policy/check_dev_files/commitlint.py similarity index 80% rename from src/repoma/check_dev_files/commitlint.py rename to src/compwa_policy/check_dev_files/commitlint.py index 057d9145..d6319dd7 100644 --- a/src/repoma/check_dev_files/commitlint.py +++ b/src/compwa_policy/check_dev_files/commitlint.py @@ -1,12 +1,12 @@ """Remove :file:`commitlint.config.js` config file. -See https://github.com/ComPWA/repo-maintenance/issues/177. +See https://github.com/ComPWA/policy/issues/177. """ import os from textwrap import dedent -from repoma.errors import PrecommitError +from compwa_policy.errors import PrecommitError def main() -> None: diff --git a/src/repoma/check_dev_files/conda.py b/src/compwa_policy/check_dev_files/conda.py similarity index 91% rename from src/repoma/check_dev_files/conda.py rename to src/compwa_policy/check_dev_files/conda.py index a76f7e22..29e74152 100644 --- a/src/repoma/check_dev_files/conda.py +++ b/src/compwa_policy/check_dev_files/conda.py @@ -6,14 +6,14 @@ from ruamel.yaml.scalarstring import PlainScalarString -from repoma.errors import PrecommitError -from repoma.utilities import CONFIG_PATH -from repoma.utilities.project_info import ( +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities import CONFIG_PATH +from compwa_policy.utilities.project_info import ( PythonVersion, get_constraints_file, is_package, ) -from repoma.utilities.yaml import create_prettier_round_trip_yaml +from compwa_policy.utilities.yaml import create_prettier_round_trip_yaml if TYPE_CHECKING: from ruamel.yaml.comments import CommentedMap, CommentedSeq diff --git a/src/repoma/check_dev_files/cspell.py b/src/compwa_policy/check_dev_files/cspell.py similarity index 95% rename from src/repoma/check_dev_files/cspell.py rename to src/compwa_policy/check_dev_files/cspell.py index 90dcf9ba..89834323 100644 --- a/src/repoma/check_dev_files/cspell.py +++ b/src/compwa_policy/check_dev_files/cspell.py @@ -13,15 +13,15 @@ from ruamel.yaml.comments import CommentedMap -from repoma.errors import PrecommitError -from repoma.utilities import CONFIG_PATH, REPOMA_DIR, rename_file, vscode -from repoma.utilities.executor import Executor -from repoma.utilities.precommit import ( +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities import COMPWA_POLICY_DIR, CONFIG_PATH, rename_file, vscode +from compwa_policy.utilities.executor import Executor +from compwa_policy.utilities.precommit import ( PrecommitConfig, load_round_trip_precommit_config, update_single_hook_precommit_repo, ) -from repoma.utilities.readme import add_badge, remove_badge +from compwa_policy.utilities.readme import add_badge, remove_badge if TYPE_CHECKING: from pathlib import Path @@ -39,7 +39,7 @@ __REPO_URL = "https://github.com/streetsidesoftware/cspell-cli" -with open(REPOMA_DIR / ".template" / CONFIG_PATH.cspell) as __STREAM: +with open(COMPWA_POLICY_DIR / ".template" / CONFIG_PATH.cspell) as __STREAM: __EXPECTED_CONFIG = json.load(__STREAM) diff --git a/src/repoma/check_dev_files/deprecated.py b/src/compwa_policy/check_dev_files/deprecated.py similarity index 83% rename from src/repoma/check_dev_files/deprecated.py rename to src/compwa_policy/check_dev_files/deprecated.py index 296aa6f6..b9873d77 100644 --- a/src/repoma/check_dev_files/deprecated.py +++ b/src/compwa_policy/check_dev_files/deprecated.py @@ -2,10 +2,10 @@ import os -from repoma.errors import PrecommitError -from repoma.utilities import remove_configs, remove_from_gitignore, vscode -from repoma.utilities.executor import Executor -from repoma.utilities.precommit import remove_precommit_hook +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities import remove_configs, remove_from_gitignore, vscode +from compwa_policy.utilities.executor import Executor +from compwa_policy.utilities.precommit import remove_precommit_hook def remove_deprecated_tools(keep_issue_templates: bool) -> None: diff --git a/src/repoma/check_dev_files/editorconfig.py b/src/compwa_policy/check_dev_files/editorconfig.py similarity index 88% rename from src/repoma/check_dev_files/editorconfig.py rename to src/compwa_policy/check_dev_files/editorconfig.py index 5beb4ae4..456cc00f 100644 --- a/src/repoma/check_dev_files/editorconfig.py +++ b/src/compwa_policy/check_dev_files/editorconfig.py @@ -10,8 +10,8 @@ from ruamel.yaml.comments import CommentedMap from ruamel.yaml.scalarstring import FoldedScalarString -from repoma.utilities import CONFIG_PATH -from repoma.utilities.precommit import update_single_hook_precommit_repo +from compwa_policy.utilities import CONFIG_PATH +from compwa_policy.utilities.precommit import update_single_hook_precommit_repo def main(no_python: bool) -> None: diff --git a/src/repoma/check_dev_files/github_labels.py b/src/compwa_policy/check_dev_files/github_labels.py similarity index 92% rename from src/repoma/check_dev_files/github_labels.py rename to src/compwa_policy/check_dev_files/github_labels.py index 5eb8a215..08b9af8e 100644 --- a/src/repoma/check_dev_files/github_labels.py +++ b/src/compwa_policy/check_dev_files/github_labels.py @@ -1,7 +1,7 @@ """Check whether the repository (still) contains a :file:`labels.toml` file. If it's still there remove it, because it is now managed through -https://github.com/ComPWA/repo-maintenance. +https://github.com/ComPWA/policy. """ from __future__ import annotations @@ -9,8 +9,8 @@ import os import pathlib -from repoma.errors import PrecommitError -from repoma.utilities import CONFIG_PATH +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities import CONFIG_PATH __LABELS_CONFIG_FILE = "labels.toml" @@ -22,7 +22,7 @@ def main() -> None: f'Repository contains a file "{__LABELS_CONFIG_FILE}" for the labels' " package (see https://pypi.org/project/labels). This file should not be" " there, because labels are maintained through" - " https://github.com/ComPWA/repo-maintenance. It has been removed." + " https://github.com/ComPWA/policy. It has been removed." ) raise PrecommitError(msg) faulty_req_files = [ diff --git a/src/repoma/check_dev_files/github_workflows.py b/src/compwa_policy/check_dev_files/github_workflows.py similarity index 92% rename from src/repoma/check_dev_files/github_workflows.py rename to src/compwa_policy/check_dev_files/github_workflows.py index b43a61f5..beea8a29 100644 --- a/src/repoma/check_dev_files/github_workflows.py +++ b/src/compwa_policy/check_dev_files/github_workflows.py @@ -9,12 +9,18 @@ from ruamel.yaml.scalarstring import DoubleQuotedScalarString -from repoma.errors import PrecommitError -from repoma.utilities import CONFIG_PATH, REPOMA_DIR, hash_file, vscode, write -from repoma.utilities.executor import Executor -from repoma.utilities.precommit import PrecommitConfig -from repoma.utilities.project_info import PythonVersion, get_pypi_name -from repoma.utilities.yaml import create_prettier_round_trip_yaml +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities import ( + COMPWA_POLICY_DIR, + CONFIG_PATH, + hash_file, + vscode, + write, +) +from compwa_policy.utilities.executor import Executor +from compwa_policy.utilities.precommit import PrecommitConfig +from compwa_policy.utilities.project_info import PythonVersion, get_pypi_name +from compwa_policy.utilities.yaml import create_prettier_round_trip_yaml if TYPE_CHECKING: from pathlib import Path @@ -55,7 +61,7 @@ def _update_cd_workflow(no_pypi: bool, no_version_branches: bool) -> None: def update() -> None: yaml = create_prettier_round_trip_yaml() workflow_path = CONFIG_PATH.github_workflow_dir / "cd.yml" - expected_data = yaml.load(REPOMA_DIR / workflow_path) + expected_data = yaml.load(COMPWA_POLICY_DIR / workflow_path) if no_pypi or not CONFIG_PATH.setup_cfg.exists(): del expected_data["jobs"]["pypi"] if no_version_branches: @@ -77,7 +83,7 @@ def update() -> None: def _update_pr_linting() -> None: filename = "pr-linting.yml" - input_path = REPOMA_DIR / CONFIG_PATH.github_workflow_dir / filename + input_path = COMPWA_POLICY_DIR / CONFIG_PATH.github_workflow_dir / filename output_path = CONFIG_PATH.github_workflow_dir / filename output_path.parent.mkdir(exist_ok=True) if not output_path.exists() or hash_file(input_path) != hash_file(output_path): @@ -97,7 +103,7 @@ def _update_ci_workflow( ) -> None: def update() -> None: yaml, expected_data = _get_ci_workflow( - REPOMA_DIR / CONFIG_PATH.github_workflow_dir / "ci.yml", + COMPWA_POLICY_DIR / CONFIG_PATH.github_workflow_dir / "ci.yml", doc_apt_packages, no_macos, python_version, @@ -231,7 +237,9 @@ def __get_package_name() -> str: def _copy_workflow_file(filename: str) -> None: - expected_workflow_path = REPOMA_DIR / CONFIG_PATH.github_workflow_dir / filename + expected_workflow_path = ( + COMPWA_POLICY_DIR / CONFIG_PATH.github_workflow_dir / filename + ) with open(expected_workflow_path) as stream: expected_content = stream.read() if not CONFIG_PATH.pip_constraints.exists(): diff --git a/src/repoma/check_dev_files/gitpod.py b/src/compwa_policy/check_dev_files/gitpod.py similarity index 85% rename from src/repoma/check_dev_files/gitpod.py rename to src/compwa_policy/check_dev_files/gitpod.py index 2f2fdef3..fe06bb5e 100644 --- a/src/repoma/check_dev_files/gitpod.py +++ b/src/compwa_policy/check_dev_files/gitpod.py @@ -5,15 +5,15 @@ import yaml -from repoma.errors import PrecommitError -from repoma.utilities import CONFIG_PATH, REPOMA_DIR -from repoma.utilities.project_info import ( +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities import COMPWA_POLICY_DIR, CONFIG_PATH +from compwa_policy.utilities.project_info import ( PythonVersion, get_constraints_file, get_repo_url, ) -from repoma.utilities.readme import add_badge -from repoma.utilities.yaml import write_yaml +from compwa_policy.utilities.readme import add_badge +from compwa_policy.utilities.yaml import write_yaml def main(no_gitpod: bool, python_version: PythonVersion) -> None: @@ -53,7 +53,7 @@ def _extract_extensions() -> dict: def _generate_gitpod_config(python_version: PythonVersion) -> dict: - with open(REPOMA_DIR / ".template" / CONFIG_PATH.gitpod) as stream: + with open(COMPWA_POLICY_DIR / ".template" / CONFIG_PATH.gitpod) as stream: gitpod_config = yaml.load(stream, Loader=yaml.SafeLoader) tasks = gitpod_config["tasks"] tasks[0]["init"] = f"pyenv local {python_version}" diff --git a/src/repoma/check_dev_files/jupyter.py b/src/compwa_policy/check_dev_files/jupyter.py similarity index 76% rename from src/repoma/check_dev_files/jupyter.py rename to src/compwa_policy/check_dev_files/jupyter.py index cd10b370..61b3e3bc 100644 --- a/src/repoma/check_dev_files/jupyter.py +++ b/src/compwa_policy/check_dev_files/jupyter.py @@ -1,8 +1,11 @@ """Update the developer setup when using Jupyter notebooks.""" -from repoma.utilities.executor import Executor -from repoma.utilities.project_info import get_supported_python_versions, is_package -from repoma.utilities.pyproject import add_dependency +from compwa_policy.utilities.executor import Executor +from compwa_policy.utilities.project_info import ( + get_supported_python_versions, + is_package, +) +from compwa_policy.utilities.pyproject import add_dependency def main() -> None: diff --git a/src/repoma/check_dev_files/mypy.py b/src/compwa_policy/check_dev_files/mypy.py similarity index 86% rename from src/repoma/check_dev_files/mypy.py rename to src/compwa_policy/check_dev_files/mypy.py index 5db79b8b..0a608872 100644 --- a/src/repoma/check_dev_files/mypy.py +++ b/src/compwa_policy/check_dev_files/mypy.py @@ -5,10 +5,14 @@ import tomlkit from ini2toml.api import Translator -from repoma.errors import PrecommitError -from repoma.utilities import CONFIG_PATH, vscode -from repoma.utilities.executor import Executor -from repoma.utilities.pyproject import get_sub_table, load_pyproject, write_pyproject +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities import CONFIG_PATH, vscode +from compwa_policy.utilities.executor import Executor +from compwa_policy.utilities.pyproject import ( + get_sub_table, + load_pyproject, + write_pyproject, +) def main() -> None: diff --git a/src/repoma/check_dev_files/nbstripout.py b/src/compwa_policy/check_dev_files/nbstripout.py similarity index 94% rename from src/repoma/check_dev_files/nbstripout.py rename to src/compwa_policy/check_dev_files/nbstripout.py index 1dbdac52..0dbef261 100644 --- a/src/repoma/check_dev_files/nbstripout.py +++ b/src/compwa_policy/check_dev_files/nbstripout.py @@ -3,8 +3,8 @@ from ruamel.yaml.comments import CommentedMap from ruamel.yaml.scalarstring import LiteralScalarString -from repoma.utilities import CONFIG_PATH -from repoma.utilities.precommit import ( +from compwa_policy.utilities import CONFIG_PATH +from compwa_policy.utilities.precommit import ( find_repo, load_round_trip_precommit_config, update_single_hook_precommit_repo, diff --git a/src/repoma/check_dev_files/precommit.py b/src/compwa_policy/check_dev_files/precommit.py similarity index 94% rename from src/repoma/check_dev_files/precommit.py rename to src/compwa_policy/check_dev_files/precommit.py index da6b650e..0b663419 100644 --- a/src/repoma/check_dev_files/precommit.py +++ b/src/compwa_policy/check_dev_files/precommit.py @@ -8,11 +8,14 @@ from ruamel.yaml.comments import CommentedMap, CommentedSeq from ruamel.yaml.scalarstring import DoubleQuotedScalarString -from repoma.errors import PrecommitError -from repoma.utilities import CONFIG_PATH -from repoma.utilities.executor import Executor -from repoma.utilities.precommit import PrecommitConfig, load_round_trip_precommit_config -from repoma.utilities.yaml import create_prettier_round_trip_yaml +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities import CONFIG_PATH +from compwa_policy.utilities.executor import Executor +from compwa_policy.utilities.precommit import ( + PrecommitConfig, + load_round_trip_precommit_config, +) +from compwa_policy.utilities.yaml import create_prettier_round_trip_yaml def main() -> None: diff --git a/src/repoma/check_dev_files/prettier.py b/src/compwa_policy/check_dev_files/prettier.py similarity index 91% rename from src/repoma/check_dev_files/prettier.py rename to src/compwa_policy/check_dev_files/prettier.py index 84ff4465..c5dfad80 100644 --- a/src/repoma/check_dev_files/prettier.py +++ b/src/compwa_policy/check_dev_files/prettier.py @@ -5,11 +5,11 @@ import os from typing import Iterable -from repoma.errors import PrecommitError -from repoma.utilities import CONFIG_PATH, REPOMA_DIR, vscode -from repoma.utilities.executor import Executor -from repoma.utilities.precommit import PrecommitConfig -from repoma.utilities.readme import add_badge, remove_badge +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities import COMPWA_POLICY_DIR, CONFIG_PATH, vscode +from compwa_policy.utilities.executor import Executor +from compwa_policy.utilities.precommit import PrecommitConfig +from compwa_policy.utilities.readme import add_badge, remove_badge # cspell:ignore esbenp rettier __VSCODE_EXTENSION_NAME = "esbenp.prettier-vscode" @@ -20,7 +20,7 @@ __BADGE_PATTERN = r"\[\!\[[Pp]rettier.*\]\(.*prettier.*\)\]\(.*prettier.*\)\n?" -with open(REPOMA_DIR / ".template" / CONFIG_PATH.prettier) as __STREAM: +with open(COMPWA_POLICY_DIR / ".template" / CONFIG_PATH.prettier) as __STREAM: __EXPECTED_CONFIG = __STREAM.read() diff --git a/src/repoma/check_dev_files/pyright.py b/src/compwa_policy/check_dev_files/pyright.py similarity index 89% rename from src/repoma/check_dev_files/pyright.py rename to src/compwa_policy/check_dev_files/pyright.py index d2513e9d..539250e6 100644 --- a/src/repoma/check_dev_files/pyright.py +++ b/src/compwa_policy/check_dev_files/pyright.py @@ -6,10 +6,10 @@ import os from typing import TYPE_CHECKING -from repoma.errors import PrecommitError -from repoma.utilities import CONFIG_PATH -from repoma.utilities.executor import Executor -from repoma.utilities.pyproject import ( +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities import CONFIG_PATH +from compwa_policy.utilities.executor import Executor +from compwa_policy.utilities.pyproject import ( complies_with_subset, get_sub_table, load_pyproject, diff --git a/src/repoma/check_dev_files/pytest.py b/src/compwa_policy/check_dev_files/pytest.py similarity index 93% rename from src/repoma/check_dev_files/pytest.py rename to src/compwa_policy/check_dev_files/pytest.py index bf3d00da..1e32158a 100644 --- a/src/repoma/check_dev_files/pytest.py +++ b/src/compwa_policy/check_dev_files/pytest.py @@ -8,11 +8,11 @@ import tomlkit from ini2toml.api import Translator -from repoma.errors import PrecommitError -from repoma.utilities import CONFIG_PATH -from repoma.utilities.cfg import open_config -from repoma.utilities.executor import Executor -from repoma.utilities.pyproject import ( +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities import CONFIG_PATH +from compwa_policy.utilities.cfg import open_config +from compwa_policy.utilities.executor import Executor +from compwa_policy.utilities.pyproject import ( get_sub_table, load_pyproject, to_toml_array, diff --git a/src/repoma/check_dev_files/pyupgrade.py b/src/compwa_policy/check_dev_files/pyupgrade.py similarity index 88% rename from src/repoma/check_dev_files/pyupgrade.py rename to src/compwa_policy/check_dev_files/pyupgrade.py index 8e67b294..1487ba97 100644 --- a/src/repoma/check_dev_files/pyupgrade.py +++ b/src/compwa_policy/check_dev_files/pyupgrade.py @@ -3,14 +3,14 @@ from ruamel.yaml import YAML from ruamel.yaml.comments import CommentedMap, CommentedSeq -from repoma.utilities import natural_sorting -from repoma.utilities.executor import Executor -from repoma.utilities.precommit import ( +from compwa_policy.utilities import natural_sorting +from compwa_policy.utilities.executor import Executor +from compwa_policy.utilities.precommit import ( remove_precommit_hook, update_precommit_hook, update_single_hook_precommit_repo, ) -from repoma.utilities.project_info import get_supported_python_versions +from compwa_policy.utilities.project_info import get_supported_python_versions def main(no_ruff: bool) -> None: diff --git a/src/repoma/check_dev_files/readthedocs.py b/src/compwa_policy/check_dev_files/readthedocs.py similarity index 89% rename from src/repoma/check_dev_files/readthedocs.py rename to src/compwa_policy/check_dev_files/readthedocs.py index d126f4e0..887f1596 100644 --- a/src/repoma/check_dev_files/readthedocs.py +++ b/src/compwa_policy/check_dev_files/readthedocs.py @@ -6,11 +6,11 @@ from ruamel.yaml.scalarstring import DoubleQuotedScalarString -from repoma.errors import PrecommitError -from repoma.utilities import CONFIG_PATH -from repoma.utilities.executor import Executor -from repoma.utilities.project_info import PythonVersion, get_constraints_file -from repoma.utilities.yaml import create_prettier_round_trip_yaml +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities import CONFIG_PATH +from compwa_policy.utilities.executor import Executor +from compwa_policy.utilities.project_info import PythonVersion, get_constraints_file +from compwa_policy.utilities.yaml import create_prettier_round_trip_yaml if TYPE_CHECKING: from ruamel.yaml.comments import CommentedMap, CommentedSeq diff --git a/src/repoma/check_dev_files/release_drafter.py b/src/compwa_policy/check_dev_files/release_drafter.py similarity index 83% rename from src/repoma/check_dev_files/release_drafter.py rename to src/compwa_policy/check_dev_files/release_drafter.py index d2571c7f..9a044709 100644 --- a/src/repoma/check_dev_files/release_drafter.py +++ b/src/compwa_policy/check_dev_files/release_drafter.py @@ -5,9 +5,9 @@ import os from typing import Any -from repoma.errors import PrecommitError -from repoma.utilities import CONFIG_PATH, REPOMA_DIR, update_file -from repoma.utilities.yaml import create_prettier_round_trip_yaml +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities import COMPWA_POLICY_DIR, CONFIG_PATH, update_file +from compwa_policy.utilities.yaml import create_prettier_round_trip_yaml def main(repo_name: str, repo_title: str) -> None: @@ -32,7 +32,7 @@ def _update_draft(repo_name: str, repo_title: str) -> None: def _get_expected_config(repo_name: str, repo_title: str) -> dict[str, Any]: yaml = create_prettier_round_trip_yaml() - config = yaml.load(REPOMA_DIR / CONFIG_PATH.release_drafter_config) + config = yaml.load(COMPWA_POLICY_DIR / CONFIG_PATH.release_drafter_config) key = "name-template" config[key] = config[key].replace("<>", repo_title) key = "template" diff --git a/src/repoma/check_dev_files/ruff.py b/src/compwa_policy/check_dev_files/ruff.py similarity index 97% rename from src/repoma/check_dev_files/ruff.py rename to src/compwa_policy/check_dev_files/ruff.py index 82f27c44..84f77307 100644 --- a/src/repoma/check_dev_files/ruff.py +++ b/src/compwa_policy/check_dev_files/ruff.py @@ -9,23 +9,23 @@ from ruamel.yaml import YAML from ruamel.yaml.comments import CommentedMap -from repoma.check_dev_files.setup_cfg import ( +from compwa_policy.check_dev_files.setup_cfg import ( has_pyproject_build_system, has_setup_cfg_build_system, ) -from repoma.errors import PrecommitError -from repoma.utilities import CONFIG_PATH, natural_sorting, remove_configs, vscode -from repoma.utilities.executor import Executor -from repoma.utilities.precommit import ( +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities import CONFIG_PATH, natural_sorting, remove_configs, vscode +from compwa_policy.utilities.executor import Executor +from compwa_policy.utilities.precommit import ( remove_precommit_hook, update_single_hook_precommit_repo, ) -from repoma.utilities.project_info import ( +from compwa_policy.utilities.project_info import ( get_project_info, get_supported_python_versions, open_setup_cfg, ) -from repoma.utilities.pyproject import ( +from compwa_policy.utilities.pyproject import ( add_dependency, complies_with_subset, get_sub_table, @@ -33,7 +33,7 @@ to_toml_array, write_pyproject, ) -from repoma.utilities.readme import add_badge, remove_badge +from compwa_policy.utilities.readme import add_badge, remove_badge if TYPE_CHECKING: from tomlkit.items import Array, Table diff --git a/src/repoma/check_dev_files/setup_cfg.py b/src/compwa_policy/check_dev_files/setup_cfg.py similarity index 95% rename from src/repoma/check_dev_files/setup_cfg.py rename to src/compwa_policy/check_dev_files/setup_cfg.py index 1cdeea14..9df8b265 100644 --- a/src/repoma/check_dev_files/setup_cfg.py +++ b/src/compwa_policy/check_dev_files/setup_cfg.py @@ -18,19 +18,19 @@ from tomlkit.container import Container from tomlkit.items import Array, Table -from repoma.errors import PrecommitError -from repoma.format_setup_cfg import write_formatted_setup_cfg -from repoma.utilities import CONFIG_PATH -from repoma.utilities.executor import Executor -from repoma.utilities.precommit import remove_precommit_hook -from repoma.utilities.project_info import ( +from compwa_policy.errors import PrecommitError +from compwa_policy.format_setup_cfg import write_formatted_setup_cfg +from compwa_policy.utilities import CONFIG_PATH +from compwa_policy.utilities.executor import Executor +from compwa_policy.utilities.precommit import remove_precommit_hook +from compwa_policy.utilities.project_info import ( ProjectInfo, get_project_info, get_pypi_name, get_supported_python_versions, open_setup_cfg, ) -from repoma.utilities.pyproject import ( +from compwa_policy.utilities.pyproject import ( get_sub_table, load_pyproject, write_pyproject, diff --git a/src/repoma/check_dev_files/toml.py b/src/compwa_policy/check_dev_files/toml.py similarity index 91% rename from src/repoma/check_dev_files/toml.py rename to src/compwa_policy/check_dev_files/toml.py index ade27983..c841183b 100644 --- a/src/repoma/check_dev_files/toml.py +++ b/src/compwa_policy/check_dev_files/toml.py @@ -11,11 +11,11 @@ from ruamel.yaml import YAML from ruamel.yaml.comments import CommentedMap -from repoma.errors import PrecommitError -from repoma.utilities import CONFIG_PATH, REPOMA_DIR, vscode -from repoma.utilities.executor import Executor -from repoma.utilities.precommit import update_single_hook_precommit_repo -from repoma.utilities.pyproject import ( +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities import COMPWA_POLICY_DIR, CONFIG_PATH, vscode +from compwa_policy.utilities.executor import Executor +from compwa_policy.utilities.precommit import update_single_hook_precommit_repo +from compwa_policy.utilities.pyproject import ( get_sub_table, load_pyproject, to_toml_array, @@ -103,7 +103,7 @@ def _rename_taplo_config() -> None: def _update_taplo_config() -> None: - template_path = REPOMA_DIR / ".template" / CONFIG_PATH.taplo + template_path = COMPWA_POLICY_DIR / ".template" / CONFIG_PATH.taplo if not CONFIG_PATH.taplo.exists(): shutil.copyfile(template_path, CONFIG_PATH.taplo) msg = f"Added {CONFIG_PATH.taplo} config for TOML formatting" diff --git a/src/repoma/check_dev_files/tox.py b/src/compwa_policy/check_dev_files/tox.py similarity index 92% rename from src/repoma/check_dev_files/tox.py rename to src/compwa_policy/check_dev_files/tox.py index 656dbfe3..34f89f31 100644 --- a/src/repoma/check_dev_files/tox.py +++ b/src/compwa_policy/check_dev_files/tox.py @@ -5,8 +5,8 @@ from configparser import ConfigParser from pathlib import Path -from repoma.errors import PrecommitError -from repoma.utilities import CONFIG_PATH +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities import CONFIG_PATH def main(has_notebooks: bool) -> None: diff --git a/src/repoma/check_dev_files/update_pip_constraints.py b/src/compwa_policy/check_dev_files/update_pip_constraints.py similarity index 85% rename from src/repoma/check_dev_files/update_pip_constraints.py rename to src/compwa_policy/check_dev_files/update_pip_constraints.py index 151f3fb1..601265b1 100644 --- a/src/repoma/check_dev_files/update_pip_constraints.py +++ b/src/compwa_policy/check_dev_files/update_pip_constraints.py @@ -9,12 +9,15 @@ import sys -from repoma.check_dev_files.github_workflows import remove_workflow, update_workflow -from repoma.errors import PrecommitError -from repoma.utilities import CONFIG_PATH, REPOMA_DIR -from repoma.utilities.executor import Executor -from repoma.utilities.precommit import load_round_trip_precommit_config -from repoma.utilities.yaml import create_prettier_round_trip_yaml +from compwa_policy.check_dev_files.github_workflows import ( + remove_workflow, + update_workflow, +) +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities import COMPWA_POLICY_DIR, CONFIG_PATH +from compwa_policy.utilities.executor import Executor +from compwa_policy.utilities.precommit import load_round_trip_precommit_config +from compwa_policy.utilities.yaml import create_prettier_round_trip_yaml if sys.version_info < (3, 8): from typing_extensions import Literal @@ -61,7 +64,7 @@ def _remove_script(script_name: str) -> None: def _update_requirement_workflow(frequency: Frequency) -> None: def overwrite_workflow(workflow_file: str) -> None: expected_workflow_path = ( - REPOMA_DIR / CONFIG_PATH.github_workflow_dir / workflow_file + COMPWA_POLICY_DIR / CONFIG_PATH.github_workflow_dir / workflow_file ) yaml = create_prettier_round_trip_yaml() expected_data = yaml.load(expected_workflow_path) diff --git a/src/repoma/check_dev_files/vscode.py b/src/compwa_policy/check_dev_files/vscode.py similarity index 97% rename from src/repoma/check_dev_files/vscode.py rename to src/compwa_policy/check_dev_files/vscode.py index a6a73149..fc64d6b2 100644 --- a/src/repoma/check_dev_files/vscode.py +++ b/src/compwa_policy/check_dev_files/vscode.py @@ -2,8 +2,8 @@ import os -from repoma.utilities import vscode -from repoma.utilities.executor import Executor +from compwa_policy.utilities import vscode +from compwa_policy.utilities.executor import Executor def main(has_notebooks: bool) -> None: diff --git a/src/repoma/colab_toc_visible.py b/src/compwa_policy/colab_toc_visible.py similarity index 88% rename from src/repoma/colab_toc_visible.py rename to src/compwa_policy/colab_toc_visible.py index e44d4797..94df3539 100644 --- a/src/repoma/colab_toc_visible.py +++ b/src/compwa_policy/colab_toc_visible.py @@ -1,7 +1,7 @@ """Add notebook metadata to open the TOC sidebar on Google Colab. -See `ComPWA/repo-maintenance#40 `_ -for more information. +See `ComPWA/policy#40 `_ for more +information. """ from __future__ import annotations @@ -12,7 +12,7 @@ import nbformat -from repoma.utilities.notebook import load_notebook +from compwa_policy.utilities.notebook import load_notebook from .errors import PrecommitError from .utilities.executor import Executor diff --git a/src/repoma/errors.py b/src/compwa_policy/errors.py similarity index 100% rename from src/repoma/errors.py rename to src/compwa_policy/errors.py diff --git a/src/repoma/fix_nbformat_version.py b/src/compwa_policy/fix_nbformat_version.py similarity index 97% rename from src/repoma/fix_nbformat_version.py rename to src/compwa_policy/fix_nbformat_version.py index fa122b35..414f3918 100644 --- a/src/repoma/fix_nbformat_version.py +++ b/src/compwa_policy/fix_nbformat_version.py @@ -13,7 +13,7 @@ import nbformat -from repoma.utilities.notebook import load_notebook +from compwa_policy.utilities.notebook import load_notebook from .errors import PrecommitError from .utilities.executor import Executor diff --git a/src/repoma/format_setup_cfg.py b/src/compwa_policy/format_setup_cfg.py similarity index 89% rename from src/repoma/format_setup_cfg.py rename to src/compwa_policy/format_setup_cfg.py index 8b82f7dc..e6442185 100644 --- a/src/repoma/format_setup_cfg.py +++ b/src/compwa_policy/format_setup_cfg.py @@ -7,9 +7,9 @@ import sys from typing import TYPE_CHECKING, Sequence -from repoma.utilities import CONFIG_PATH -from repoma.utilities.cfg import format_config -from repoma.utilities.project_info import open_setup_cfg +from compwa_policy.utilities import CONFIG_PATH +from compwa_policy.utilities.cfg import format_config +from compwa_policy.utilities.project_info import open_setup_cfg if TYPE_CHECKING: import io diff --git a/src/repoma/pin_nb_requirements.py b/src/compwa_policy/pin_nb_requirements.py similarity index 98% rename from src/repoma/pin_nb_requirements.py rename to src/compwa_policy/pin_nb_requirements.py index 6d5430cd..20c88c02 100644 --- a/src/repoma/pin_nb_requirements.py +++ b/src/compwa_policy/pin_nb_requirements.py @@ -18,8 +18,8 @@ import nbformat from nbformat import NotebookNode -from repoma.utilities.executor import Executor -from repoma.utilities.notebook import load_notebook +from compwa_policy.utilities.executor import Executor +from compwa_policy.utilities.notebook import load_notebook from .errors import PrecommitError diff --git a/src/repoma/py.typed b/src/compwa_policy/py.typed similarity index 100% rename from src/repoma/py.typed rename to src/compwa_policy/py.typed diff --git a/src/repoma/self_check.py b/src/compwa_policy/self_check.py similarity index 87% rename from src/repoma/self_check.py rename to src/compwa_policy/self_check.py index ac4cd7df..e06e8874 100644 --- a/src/repoma/self_check.py +++ b/src/compwa_policy/self_check.py @@ -1,4 +1,4 @@ -"""Checks to be performed locally on the ComPWA/repo-maintenance repository.""" +"""Checks to be performed locally on the ComPWA/policy repository itself.""" from __future__ import annotations @@ -8,9 +8,9 @@ import yaml -from repoma.errors import PrecommitError -from repoma.utilities.executor import Executor -from repoma.utilities.precommit import Hook, PrecommitConfig, asdict, fromdict +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities.executor import Executor +from compwa_policy.utilities.precommit import Hook, PrecommitConfig, asdict, fromdict __HOOK_DEFINITION_FILE = ".pre-commit-hooks.yaml" __IGNORE_KEYS = {"args"} diff --git a/src/repoma/set_nb_cells.py b/src/compwa_policy/set_nb_cells.py similarity index 97% rename from src/repoma/set_nb_cells.py rename to src/compwa_policy/set_nb_cells.py index 0033feca..5765aef1 100644 --- a/src/repoma/set_nb_cells.py +++ b/src/compwa_policy/set_nb_cells.py @@ -28,8 +28,8 @@ import nbformat -from repoma.utilities.notebook import load_notebook -from repoma.utilities.project_info import get_pypi_name +from compwa_policy.utilities.notebook import load_notebook +from compwa_policy.utilities.project_info import get_pypi_name __CONFIG_CELL_CONTENT = """ import os diff --git a/src/repoma/utilities/__init__.py b/src/compwa_policy/utilities/__init__.py similarity index 94% rename from src/repoma/utilities/__init__.py rename to src/compwa_policy/utilities/__init__.py index cfafac28..619c106e 100644 --- a/src/repoma/utilities/__init__.py +++ b/src/compwa_policy/utilities/__init__.py @@ -11,9 +11,9 @@ from shutil import copyfile from typing import NamedTuple -import repoma -from repoma.errors import PrecommitError -from repoma.utilities.executor import Executor +import compwa_policy +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities.executor import Executor class _ConfigFilePaths(NamedTuple): @@ -42,7 +42,7 @@ class _ConfigFilePaths(NamedTuple): CONFIG_PATH = _ConfigFilePaths() -REPOMA_DIR = Path(repoma.__file__).parent.absolute() +COMPWA_POLICY_DIR = Path(compwa_policy.__file__).parent.absolute() def hash_file(path: Path | str) -> str: @@ -133,9 +133,9 @@ def natural_sorting(text: str) -> list[float | str]: def update_file(relative_path: Path, in_template_folder: bool = False) -> None: if in_template_folder: - template_dir = REPOMA_DIR / ".template" + template_dir = COMPWA_POLICY_DIR / ".template" else: - template_dir = REPOMA_DIR + template_dir = COMPWA_POLICY_DIR template_path = template_dir / relative_path if not os.path.exists(relative_path): copyfile(template_path, relative_path) diff --git a/src/repoma/utilities/cfg.py b/src/compwa_policy/utilities/cfg.py similarity index 98% rename from src/repoma/utilities/cfg.py rename to src/compwa_policy/utilities/cfg.py index ff7ec208..21d4d273 100644 --- a/src/repoma/utilities/cfg.py +++ b/src/compwa_policy/utilities/cfg.py @@ -9,7 +9,7 @@ from pathlib import Path from typing import Callable, Iterable -from repoma.errors import PrecommitError +from compwa_policy.errors import PrecommitError from . import CONFIG_PATH, read, write diff --git a/src/repoma/utilities/executor.py b/src/compwa_policy/utilities/executor.py similarity index 96% rename from src/repoma/utilities/executor.py rename to src/compwa_policy/utilities/executor.py index a7fc2027..0c77cd47 100644 --- a/src/repoma/utilities/executor.py +++ b/src/compwa_policy/utilities/executor.py @@ -7,7 +7,7 @@ import attr -from repoma.errors import PrecommitError +from compwa_policy.errors import PrecommitError if sys.version_info >= (3, 10): from typing import ParamSpec diff --git a/src/repoma/utilities/notebook.py b/src/compwa_policy/utilities/notebook.py similarity index 100% rename from src/repoma/utilities/notebook.py rename to src/compwa_policy/utilities/notebook.py diff --git a/src/repoma/utilities/precommit.py b/src/compwa_policy/utilities/precommit.py similarity index 99% rename from src/repoma/utilities/precommit.py rename to src/compwa_policy/utilities/precommit.py index 09bae52b..8712c741 100644 --- a/src/repoma/utilities/precommit.py +++ b/src/compwa_policy/utilities/precommit.py @@ -14,7 +14,7 @@ from pre_commit.commands.autoupdate import autoupdate as precommit_autoupdate from ruamel.yaml.scalarstring import PlainScalarString -from repoma.errors import PrecommitError +from compwa_policy.errors import PrecommitError from . import CONFIG_PATH from .yaml import create_prettier_round_trip_yaml diff --git a/src/repoma/utilities/project_info.py b/src/compwa_policy/utilities/project_info.py similarity index 97% rename from src/repoma/utilities/project_info.py rename to src/compwa_policy/utilities/project_info.py index 0b74d72d..f4e785a6 100644 --- a/src/repoma/utilities/project_info.py +++ b/src/compwa_policy/utilities/project_info.py @@ -10,8 +10,8 @@ from attrs import field, frozen -from repoma.errors import PrecommitError -from repoma.utilities.pyproject import get_sub_table, load_pyproject +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities.pyproject import get_sub_table, load_pyproject from . import CONFIG_PATH from .cfg import open_config @@ -116,7 +116,7 @@ def get_pypi_name(pyproject: TOMLDocument | None = None) -> str: """Extract package name for PyPI from :file:`setup.cfg`. >>> get_pypi_name() - 'repo-maintenance' + 'compwa-policy' """ project_info = get_project_info(pyproject) if project_info.name is None: diff --git a/src/repoma/utilities/pyproject.py b/src/compwa_policy/utilities/pyproject.py similarity index 96% rename from src/repoma/utilities/pyproject.py rename to src/compwa_policy/utilities/pyproject.py index 7abad9e7..483cabcb 100644 --- a/src/repoma/utilities/pyproject.py +++ b/src/compwa_policy/utilities/pyproject.py @@ -10,10 +10,13 @@ import tomlkit from tomlkit.toml_document import TOMLDocument -from repoma.errors import PrecommitError -from repoma.utilities import CONFIG_PATH -from repoma.utilities.executor import Executor -from repoma.utilities.precommit import find_repo, load_round_trip_precommit_config +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities import CONFIG_PATH +from compwa_policy.utilities.executor import Executor +from compwa_policy.utilities.precommit import ( + find_repo, + load_round_trip_precommit_config, +) if TYPE_CHECKING: from tomlkit.container import Container diff --git a/src/repoma/utilities/readme.py b/src/compwa_policy/utilities/readme.py similarity index 97% rename from src/repoma/utilities/readme.py rename to src/compwa_policy/utilities/readme.py index 1bb28ccc..fb031e78 100644 --- a/src/repoma/utilities/readme.py +++ b/src/compwa_policy/utilities/readme.py @@ -3,7 +3,7 @@ import os.path import re -from repoma.errors import PrecommitError +from compwa_policy.errors import PrecommitError __README_PATH = "README.md" diff --git a/src/repoma/utilities/vscode.py b/src/compwa_policy/utilities/vscode.py similarity index 98% rename from src/repoma/utilities/vscode.py rename to src/compwa_policy/utilities/vscode.py index 2490035e..14ca185b 100644 --- a/src/repoma/utilities/vscode.py +++ b/src/compwa_policy/utilities/vscode.py @@ -8,8 +8,8 @@ from copy import deepcopy from typing import TYPE_CHECKING, Iterable, OrderedDict, TypeVar, overload -from repoma.errors import PrecommitError -from repoma.utilities.executor import Executor +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities.executor import Executor from . import CONFIG_PATH diff --git a/src/repoma/utilities/yaml.py b/src/compwa_policy/utilities/yaml.py similarity index 100% rename from src/repoma/utilities/yaml.py rename to src/compwa_policy/utilities/yaml.py diff --git a/tests/check_dev_files/test_cspell.py b/tests/check_dev_files/test_cspell.py index a422c894..0e17a337 100644 --- a/tests/check_dev_files/test_cspell.py +++ b/tests/check_dev_files/test_cspell.py @@ -3,9 +3,9 @@ import pytest import yaml -from repoma.check_dev_files.cspell import _update_cspell_repo_url -from repoma.errors import PrecommitError -from repoma.utilities.precommit import PrecommitConfig, fromdict +from compwa_policy.check_dev_files.cspell import _update_cspell_repo_url +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities.precommit import PrecommitConfig, fromdict @pytest.fixture(scope="session") diff --git a/tests/check_dev_files/test_gitpod.py b/tests/check_dev_files/test_gitpod.py index 503e7ac9..9788167d 100644 --- a/tests/check_dev_files/test_gitpod.py +++ b/tests/check_dev_files/test_gitpod.py @@ -1,4 +1,7 @@ -from repoma.check_dev_files.gitpod import _extract_extensions, _generate_gitpod_config +from compwa_policy.check_dev_files.gitpod import ( + _extract_extensions, + _generate_gitpod_config, +) def test_get_gitpod_content(): diff --git a/tests/test_format_setup_cfg.py b/tests/test_format_setup_cfg.py index 514f3d2d..c46e80e6 100644 --- a/tests/test_format_setup_cfg.py +++ b/tests/test_format_setup_cfg.py @@ -3,7 +3,7 @@ import pytest -from repoma.format_setup_cfg import _format_setup_cfg +from compwa_policy.format_setup_cfg import _format_setup_cfg @pytest.mark.parametrize( diff --git a/tests/utilities/test_cfg.py b/tests/utilities/test_cfg.py index ffa79577..aad81f6b 100644 --- a/tests/utilities/test_cfg.py +++ b/tests/utilities/test_cfg.py @@ -3,9 +3,9 @@ import pytest -from repoma.errors import PrecommitError -from repoma.utilities.cfg import format_config, open_config -from repoma.utilities.project_info import get_repo_url +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities.cfg import format_config, open_config +from compwa_policy.utilities.project_info import get_repo_url @pytest.mark.parametrize( @@ -26,11 +26,11 @@ ( # remove spaces before comments """\ [metadata] - name = repo-maintenance # comment + name = compwa-policy # comment """, """\ [metadata] - name = repo-maintenance # comment + name = compwa-policy # comment """, ), ( # remove trailing white-space @@ -46,13 +46,13 @@ ( # end file with one and only one newline """\ [metadata] - name = repo-maintenance + name = compwa-policy """, """\ [metadata] - name = repo-maintenance + name = compwa-policy """, ), ( # only two linebreaks @@ -83,7 +83,7 @@ def test_format_config(unformatted: str, expected: str): def test_get_repo_url(): - assert get_repo_url() == "https://github.com/ComPWA/repo-maintenance" + assert get_repo_url() == "https://github.com/ComPWA/policy" def test_open_config_exception(): diff --git a/tests/utilities/test_executor.py b/tests/utilities/test_executor.py index fb2482cd..1405ecc6 100644 --- a/tests/utilities/test_executor.py +++ b/tests/utilities/test_executor.py @@ -1,7 +1,7 @@ from textwrap import dedent -from repoma.errors import PrecommitError -from repoma.utilities.executor import Executor +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities.executor import Executor class TestExecutor: diff --git a/tests/utilities/test_precommit.py b/tests/utilities/test_precommit.py index 45abe850..3c7d84f3 100644 --- a/tests/utilities/test_precommit.py +++ b/tests/utilities/test_precommit.py @@ -2,7 +2,7 @@ import pytest -from repoma.utilities.precommit import ( +from compwa_policy.utilities.precommit import ( Hook, PrecommitCi, PrecommitConfig, diff --git a/tests/utilities/test_pyproject.py b/tests/utilities/test_pyproject.py index ffe9a3de..030f2ee3 100644 --- a/tests/utilities/test_pyproject.py +++ b/tests/utilities/test_pyproject.py @@ -7,8 +7,8 @@ import pytest from tomlkit.items import Table -from repoma.errors import PrecommitError -from repoma.utilities.pyproject import ( +from compwa_policy.errors import PrecommitError +from compwa_policy.utilities.pyproject import ( add_dependency, get_package_name_safe, get_sub_table, @@ -17,7 +17,7 @@ write_pyproject, ) -REPOMA_DIR = Path(__file__).absolute().parent.parent.parent +POLICY_REPO_DIR = Path(__file__).absolute().parent.parent.parent def test_add_dependency(): @@ -136,7 +136,7 @@ def test_get_package_name_safe(): _ = get_package_name_safe(io.StringIO()) -@pytest.mark.parametrize("path", [None, REPOMA_DIR / "pyproject.toml"]) +@pytest.mark.parametrize("path", [None, POLICY_REPO_DIR / "pyproject.toml"]) def test_load_pyproject(path: Path | None): if path is None: pyproject = load_pyproject() diff --git a/tox.ini b/tox.ini index 6878d77f..1fc0494a 100644 --- a/tox.ini +++ b/tox.ini @@ -24,7 +24,7 @@ commands = --cov-fail-under=40 \ --cov-report=html \ --cov-report=xml \ - --cov=repoma + --cov=compwa_policy description = Compute test coverage @@ -110,7 +110,7 @@ setenv = [testenv:pydeps] changedir = src commands = - pydeps repoma \ + pydeps compwa_policy \ -o module_structure.svg \ --exclude *._* \ --max-bacon=1 \