diff --git a/.github/workflows/build-test-publish.yml b/.github/workflows/build-test-publish.yml index 8452d95..745682d 100644 --- a/.github/workflows/build-test-publish.yml +++ b/.github/workflows/build-test-publish.yml @@ -18,13 +18,10 @@ jobs: matrix: os: [ubuntu-latest] python_version: - - "3.9" - - "3.10" - "3.11" - - "3.12" include: - os: windows-latest - python_version: "3.9" + python_version: "3.11" steps: - uses: actions/checkout@v2 - name: Set up Python ${{matrix.python_version}} @@ -46,7 +43,7 @@ jobs: python -m pip install '.[test]' - name: Run unit tests run: |- - python -m pytest --cov-report=term --cov=model_diffsummary --rootdir=. + python -m pytest --cov-report=term --cov=capella_diff_tools --rootdir=. publish: name: Publish artifacts @@ -57,7 +54,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v2 with: - python-version: "3.9" + python-version: "3.11" - name: Install dependencies run: |- python -m pip install -U pip diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 53da3d1..4e63d8d 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -18,7 +18,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@v2 with: - python-version: "3.9" + python-version: "3.11" - name: Upgrade pip run: | python -m pip install -U pip diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d80dc9c..96b4af5 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: "3.9" + python-version: "3.11" - name: Upgrade pip run: |- python -m pip install -U pip @@ -30,7 +30,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: "3.9" + python-version: "3.11" - name: Upgrade pip run: |- python -m pip install -U pip @@ -39,4 +39,4 @@ jobs: python -m pip install pylint - name: Run pylint run: |- - pylint -dfixme model_diffsummary || exit $(($? & ~24)) + pylint -dfixme capella_diff_tools || exit $(($? & ~24)) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7b02f3b..e276aef 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ default_install_hook_types: [commit-msg, pre-commit] default_stages: [commit, merge-commit] repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-added-large-files - id: check-ast @@ -25,7 +25,7 @@ repos: - id: fix-byte-order-marker - id: trailing-whitespace - repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.9.1 + rev: 23.11.0 hooks: - id: black - repo: https://github.com/PyCQA/isort @@ -46,13 +46,13 @@ repos: additional_dependencies: - pydocstyle[toml] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.5.1 + rev: v1.7.1 hooks: - id: mypy additional_dependencies: - types-pyyaml - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.4.2 + rev: v1.5.4 hooks: - id: insert-license name: Insert license headers (shell-style comments) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a8227b6..b210f6f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,8 +16,8 @@ reduce the burden on our maintainers, please make sure that your code follows our style guidelines outlined below. -[open an issue]: https://github.com/DSD-DBS/model-diffsummary/issues -[open a pull request]: https://github.com/DSD-DBS/model-diffsummary/pulls +[open an issue]: https://github.com/DSD-DBS/capella-diff-tools/issues +[open a pull request]: https://github.com/DSD-DBS/capella-diff-tools/pulls ## Developing @@ -123,14 +123,7 @@ The key differences are: writing `from typing import SomeName`, use `import typing as t` and access typing related classes like `t.TypedDict`. - - - Use the new syntax and classes for typing introduced with Python 3.10 and available using - `from __future__ import annotations` since Python 3.8. - - Be aware however that this only works in the context of annotations; the code - still needs to run on Python 3.9! This means that in some (rare) cases, you _must_ use the - old-style type hints. + Use the new syntax and classes for typing introduced with Python 3.10. - Instead of `t.Tuple`, `t.List` etc. use the builtin classes `tuple`, `list` etc. diff --git a/README.md b/README.md index 7a7c85d..2dfb6c9 100644 --- a/README.md +++ b/README.md @@ -3,31 +3,31 @@ ~ SPDX-License-Identifier: Apache-2.0 --> -# Model-Diff Summary Tool +# Capella Diff Tools -![image](https://github.com/DSD-DBS/model-diffsummary/actions/workflows/build-test-publish.yml/badge.svg) -![image](https://github.com/DSD-DBS/model-diffsummary/actions/workflows/lint.yml/badge.svg) +![image](https://github.com/DSD-DBS/capella-diff-tools/actions/workflows/build-test-publish.yml/badge.svg) +![image](https://github.com/DSD-DBS/capella-diff-tools/actions/workflows/lint.yml/badge.svg) -Produce a summary of the differences between model versions +Tools for comparing different versions of a Capella model # Documentation -Read the [full documentation on Github pages](https://dsd-dbs.github.io/model-diffsummary). +Read the [full documentation on Github pages](https://dsd-dbs.github.io/capella-diff-tools). # Installation You can install the latest released version directly from PyPI. ```sh -pip install model-diffsummary +pip install capella-diff-tools ``` To set up a development environment, clone the project and install it into a virtual environment. ```sh -git clone https://github.com/DSD-DBS/model-diffsummary -cd model-diffsummary +git clone https://github.com/DSD-DBS/capella-diff-tools +cd capella-diff-tools python -m venv .venv source .venv/bin/activate.sh # for Linux / Mac diff --git a/model_diffsummary/__init__.py b/capella_diff_tools/__init__.py similarity index 69% rename from model_diffsummary/__init__.py rename to capella_diff_tools/__init__.py index 428f31a..0401787 100644 --- a/model_diffsummary/__init__.py +++ b/capella_diff_tools/__init__.py @@ -1,10 +1,10 @@ # Copyright DB Netz AG and contributors # SPDX-License-Identifier: Apache-2.0 -"""The model_diffsummary package.""" +"""The capella_diff_tools package.""" from importlib import metadata try: - __version__ = metadata.version("model_diffsummary") + __version__ = metadata.version("capella_diff_tools") except metadata.PackageNotFoundError: # pragma: no cover __version__ = "0.0.0+unknown" del metadata diff --git a/model_diffsummary/__main__.py b/capella_diff_tools/__main__.py similarity index 96% rename from model_diffsummary/__main__.py rename to capella_diff_tools/__main__.py index a1da5c0..b617d32 100644 --- a/model_diffsummary/__main__.py +++ b/capella_diff_tools/__main__.py @@ -1,6 +1,6 @@ # Copyright DB Netz AG and contributors # SPDX-License-Identifier: Apache-2.0 -"""Main entry point into model_diffsummary.""" +"""Main entry point into capella_diff_tools.""" from __future__ import annotations import datetime @@ -16,7 +16,7 @@ from capellambse.filehandler import git as gitfh from capellambse.model import common as c -import model_diffsummary +import capella_diff_tools from . import types @@ -25,8 +25,8 @@ @click.command() @click.version_option( - version=model_diffsummary.__version__, - prog_name="Model-Diff Summary Tool", + version=capella_diff_tools.__version__, + prog_name="Capella Diff Tools", message="%(prog)s %(version)s", ) @click.argument("model", type=capellambse.cli_helpers.ModelInfoCLI()) @@ -94,7 +94,12 @@ def _compare_all_diagrams( old: capellambse.MelodyModel, new: capellambse.MelodyModel, ) -> types.DiagramChanges: - result: dict[str, types.DiagramLayer] = {"oa": {}, "sa": {}} + result: dict[str, types.DiagramLayer] = { + "oa": {}, + "sa": {}, + "la": {}, + "pa": {}, + } for layer, diagtype in ( ("oa", m.modeltypes.DiagramType.COC), ("oa", m.modeltypes.DiagramType.OAIB), @@ -116,7 +121,9 @@ def _compare_diagram_type( layer: str, diag_type: m.modeltypes.DiagramType, ) -> types.DiagramChange: - logger.debug("Collecting diagrams of type %s", diag_type.name) + logger.debug( + "Collecting diagrams of type %s (%s)", diag_type.value, diag_type.name + ) changes: types.DiagramChange = {} old_diags = getattr(old, layer).diagrams.by_type(diag_type) diff --git a/model_diffsummary/types.py b/capella_diff_tools/types.py similarity index 100% rename from model_diffsummary/types.py rename to capella_diff_tools/types.py diff --git a/docs/source/conf.py b/docs/source/conf.py index 80364d3..3841a87 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -11,21 +11,18 @@ # import os import sys +import tomllib sys.path.insert(0, os.path.abspath("../..")) -import model_diffsummary +import capella_diff_tools # -- Project information ----------------------------------------------------- -if sys.version_info >= (3, 11): - import tomllib -else: - import tomli as tomllib with open("../../pyproject.toml", "rb") as f: _metadata = tomllib.load(f)["project"] -project = "Model-Diff Summary Tool" +project = "Capella Diff Tools" author = _metadata["authors"][0]["name"] copyright = f"{author} and the {_metadata['name']} contributors" @@ -58,7 +55,7 @@ # built documents. # The full version, including alpha/beta/rc tags. -version = model_diffsummary.__version__ +version = capella_diff_tools.__version__ rst_epilog = f""" .. |Project| replace:: {project} .. |Version| replace:: {version} @@ -95,7 +92,7 @@ "footer_icons": [ { "name": "GitHub", - "url": "https://github.com/DSD-DBS/model-diffsummary", + "url": "https://github.com/DSD-DBS/capella-diff-tools", "html": '', "class": "", }, diff --git a/docs/source/index.rst b/docs/source/index.rst index fabb9f0..819e174 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -2,8 +2,8 @@ Copyright DB Netz AG and contributors SPDX-License-Identifier: Apache-2.0 -Welcome to Model-Diff Summary Tool's documentation! -=================================================== +Welcome to Capella Diff Tools's documentation! +============================================== .. toctree:: :maxdepth: 2 diff --git a/notes.md b/notes.md deleted file mode 100644 index 7b15846..0000000 --- a/notes.md +++ /dev/null @@ -1,91 +0,0 @@ - - -End goal: - -- Commit-based "news feed" in collab manager -- Also viewable as standalone HTML report -- Run in pipeline for newest changes of each commit -- Run for any arbitrary two commits (e.g. tag BL_10 vs. tag BL_11) - -- Something like: python -m whatevermod --previous COMMITISH --current COMMITISH - -- Produces JSON or YAML report, which can be displayed interactively - -- Some tree structure, commit as tree root - - drill down into changed objects: - - Commit ABCDEF0 by Guy 1 on - - Changed diagrams: - > [SAB] System: 20 changes (click to expand...) - > ... - v [CDC] Mission - Introduced: - - Capability 1 - Removed: - - Capability 7 - > ... - - Changes on OA: - > OperationalActivity: 3 created, 5 deleted, 1 modified (click to expand...) - > ... - v OperationalCapability: - | Created: - | > New thing A (click to show details) - | v New thing B - | uuid: 13579BDF-... - | name: New thing B - | description:

...

- | ... - | - | Deleted: - | - Old Name 1 (12345678-...) - | - Old Name 2 (9ABCDEF0-...) - | ... - | - | Modified: - | - Capsoup (2468ACE0-...) - | Name changed from X to Capsoup - - Changes on SA: - ... - - Changes on LA: - ... - - ------------------------------------ - - Changed objects: - - Function ABC - > new input: ... - > input deleted: ... - > name changed: ... - - > child change: - - ... - > ... - - Changed diagrams: - - Diagram XYZ - > Box "Function ABC" added - (only semantic changes, layout is ignored / summarized as "layout changes") - -> link to diagram cache, or left / right display, visual diff tool, w/e - - ... and other changes (which we don't know how to show yet) :) // (XML tree diff?) - - Commit 1234567 by Guy 2 on : Changed 200 objects and 20 diagrams (click to expand...) - -Objects of interest: - - For OA: OperationalActivity, FunctionalExchange, OperationalCapability - Diagrams (OA): COC, OAIB, OPD, OAB, O.MSM, O.STM(?), O.CDB (low-prio) - - For SA: SystemComponent (+ Parts) -> distinguish between actor/non-actor; + allocated SystemFunctions - Capabilities + Involvements - Diagrams (SA): CC, SDFB, MCB, SAB - -Start with OperationalActivity diff --git a/pyproject.toml b/pyproject.toml index a768ade..6f8272a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,33 +8,32 @@ build-backend = "setuptools.build_meta" [project] dynamic = ["version"] -name = "model-diffsummary" -description = "Produce a summary of the differences between model versions" +name = "capella-diff-tools" +description = "Tools for comparing different versions of a Capella model" readme = "README.md" -requires-python = ">=3.9, <3.13" +requires-python = ">=3.11, <3.13" license = { text = "Apache-2.0" } authors = [ { name = "DB Netz AG" }, ] keywords = [] classifiers = [ - "Development Status :: 1 - Planning", + "Development Status :: 4 - Beta", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", ] dependencies = [ "click", + "capellambse>=0.5.39", ] [project.urls] -Homepage = "https://github.com/DSD-DBS/model-diffsummary" -Documentation = "https://dsd-dbs.github.io/model-diffsummary" +Homepage = "https://github.com/DSD-DBS/capella-diff-tools" +Documentation = "https://dsd-dbs.github.io/capella-diff-tools" [project.optional-dependencies] docs = [ @@ -51,12 +50,12 @@ test = [ [tool.black] line-length = 79 -target-version = ["py39"] +target-version = ["py311"] [tool.coverage.run] branch = true command_line = "-m pytest" -source = ["model_diffsummary"] +source = ["capella_diff_tools"] [tool.coverage.report] exclude_also = [ @@ -81,7 +80,7 @@ no_implicit_optional = true show_error_codes = true warn_redundant_casts = true warn_unreachable = true -python_version = "3.9" +python_version = "3.11" [[tool.mypy.overrides]] module = ["tests.*"] @@ -198,7 +197,7 @@ zip-safe = false "*" = ["py.typed"] [tool.setuptools.packages.find] -include = ["model_diffsummary", "model_diffsummary.*"] +include = ["capella_diff_tools", "capella_diff_tools.*"] [tool.setuptools_scm] # This section must exist for setuptools_scm to work diff --git a/tests/test_model_diffsummary.py b/tests/test_model_diffsummary.py index b7da2b0..3e7a83f 100644 --- a/tests/test_model_diffsummary.py +++ b/tests/test_model_diffsummary.py @@ -1,7 +1,7 @@ # Copyright DB Netz AG and contributors # SPDX-License-Identifier: Apache-2.0 -import model_diffsummary +import capella_diff_tools def test_add_some_tests_here():