Skip to content

Commit

Permalink
feat: Rework as capella-diff-tools
Browse files Browse the repository at this point in the history
  • Loading branch information
Wuestengecko committed Nov 29, 2023
1 parent 131fb21 commit a08b7ac
Show file tree
Hide file tree
Showing 14 changed files with 56 additions and 154 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/build-test-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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))
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand Down
13 changes: 3 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ reduce the burden on our maintainers, please make sure that your code follows
our style guidelines outlined below.

<!-- prettier-ignore -->
[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

Expand Down Expand Up @@ -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`.

<!-- prettier-ignore -->

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.
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
19 changes: 13 additions & 6 deletions model_diffsummary/__main__.py → capella_diff_tools/__main__.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

Expand All @@ -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())
Expand Down Expand Up @@ -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),
Expand All @@ -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)
Expand Down
File renamed without changes.
13 changes: 5 additions & 8 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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": '<img src="/_static/img/github-logo.svg"/>',
"class": "",
},
Expand Down
4 changes: 2 additions & 2 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
91 changes: 0 additions & 91 deletions notes.md

This file was deleted.

Loading

0 comments on commit a08b7ac

Please sign in to comment.