Skip to content

Commit

Permalink
update template
Browse files Browse the repository at this point in the history
  • Loading branch information
seebi committed Jan 6, 2025
1 parent 8723dae commit f7c3eaf
Show file tree
Hide file tree
Showing 17 changed files with 534 additions and 112 deletions.
2 changes: 1 addition & 1 deletion .copier-answers.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Changes here will be overwritten by Copier
project_slug=irdi
package_dir=cmem_plugin_irdi

13 changes: 7 additions & 6 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Changes here will be overwritten by Copier
_commit: v6.0.1
_commit: v7.0.0
_src_path: gh:eccenca/cmem-plugin-template
author_mail: robert.klose@eccenca.com
author_name: Robert Klose
github_page: ''
project_description: Create unique IRDIs
author_mail: cmempy-developer@eccenca.com
author_name: eccenca GmbH
github_page: https://gitlab.eccenca.com/elds/plugins/cmem-plugin-irdi
project_description: Create unique International Registration Data Identifier (IRDI).
project_slug: irdi
pypi: false
project_type: plugin
pypi: true

4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ jobs:
uses: actions/checkout@v4

- name: Install Task
uses: arduino/setup-task@v1
uses: arduino/setup-task@v2

- name: Set up python
id: setup-python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.11'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ jobs:
uses: actions/checkout@v4

- name: Install Task
uses: arduino/setup-task@v1
uses: arduino/setup-task@v2

- name: Set up python
id: setup-python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.11'

Expand Down
19 changes: 19 additions & 0 deletions .tasks-plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# https://taskfile.dev
---
version: '3'

tasks:

install:
desc: Install plugin package in Corporate Memory
cmds:
- task build
- poetry run cmemc admin workspace python install dist/cmem_plugin_irdi*.tar.gz
- poetry run cmemc admin workspace python list-plugins

uninstall:
desc: Unnstall plugin package in Corporate Memory
cmds:
- task build
- poetry run cmemc admin workspace python uninstall cmem-plugin-irdi
- poetry run cmemc admin workspace python list-plugins
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

## [Unreleased]

## [0.6.0] - 2025-01-06
...

## [0.6.0] 2025-01-06

### Changed

- Changed counter ontology upload to use `post_streamed` instead of `post`

## [0.5.0] - 2024-01-03
## [0.5.0] 2024-01-03

### Added

Expand Down
24 changes: 18 additions & 6 deletions README-public.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
# cmem-plugin-irdi

Create unique [ECLASS](https://eclass.eu/support/technical-specification/structure-and-elements/irdi) IRDIs
Create unique International Registration Data Identifier (IRDI).

[![eccenca Corporate Memory][cmem-shield]][cmem-link]

This is a plugin for [eccenca](https://eccenca.com) [Corporate Memory](https://documentation.eccenca.com).

You can install it with the [cmemc](https://eccenca.com/go/cmemc) command line
clients like this:
This is a plugin for [eccenca](https://eccenca.com) [Corporate Memory](https://documentation.eccenca.com). You can install it with the [cmemc](https://eccenca.com/go/cmemc) command line clients like this:

```
cmemc admin workspace python install cmem-plugin-irdi
```
[![workflow](https://gitlab.eccenca.com/elds/plugins/cmem-plugin-irdi/actions/workflows/check.yml/badge.svg)](https://gitlab.eccenca.com/elds/plugins/cmem-plugin-irdi/actions) [![pypi version](https://img.shields.io/pypi/v/cmem-plugin-irdi)](https://pypi.org/project/cmem-plugin-irdi) [![license](https://img.shields.io/pypi/l/cmem-plugin-irdi)](https://pypi.org/project/cmem-plugin-irdi)
[![poetry][poetry-shield]][poetry-link] [![ruff][ruff-shield]][ruff-link] [![mypy][mypy-shield]][mypy-link] [![copier][copier-shield]][copier]

[cmem-link]: https://documentation.eccenca.com
[cmem-shield]: https://img.shields.io/endpoint?url=https://dev.documentation.eccenca.com/badge.json
[poetry-link]: https://python-poetry.org/
[poetry-shield]: https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json
[ruff-link]: https://docs.astral.sh/ruff/
[ruff-shield]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&label=Code%20Style
[mypy-link]: https://mypy-lang.org/
[mypy-shield]: https://www.mypy-lang.org/static/mypy_badge.svg
[copier]: https://copier.readthedocs.io/
[copier-shield]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-inverted-border-purple.json

## Plugin Usage

- All fields of the IRDI are configurable, minus `Item Code`, which is created by the plugin
- Created IRDIs are unique per configuration
- Specify a graph that stores the state of `Item Codes`
- Input and output paths are configurable
- if no input path is configured, values are read from the URIs of the input (Transformation Input)
- if no input path is configured, values are read from the URIs of the input (Transformation Input)

17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# cmem-plugin-irdi

Create unique [ECLASS](https://eclass.eu/support/technical-specification/structure-and-elements/irdi) IRDIs
Create unique International Registration Data Identifier (IRDI).

[![eccenca Corporate Memory](https://img.shields.io/badge/eccenca-Corporate%20Memory-orange)](https://documentation.eccenca.com)
[![eccenca Corporate Memory][cmem-shield]][cmem-link][![workflow](https://gitlab.eccenca.com/elds/plugins/cmem-plugin-irdi/actions/workflows/check.yml/badge.svg)](https://gitlab.eccenca.com/elds/plugins/cmem-plugin-irdi/actions) [![pypi version](https://img.shields.io/pypi/v/cmem-plugin-irdi)](https://pypi.org/project/cmem-plugin-irdi) [![license](https://img.shields.io/pypi/l/cmem-plugin-irdi)](https://pypi.org/project/cmem-plugin-irdi)
[![poetry][poetry-shield]][poetry-link] [![ruff][ruff-shield]][ruff-link] [![mypy][mypy-shield]][mypy-link] [![copier][copier-shield]][copier]

## Development

Expand All @@ -17,3 +18,15 @@ Create unique [ECLASS](https://eclass.eu/support/technical-specification/structu
- Specify a graph that stores the state of `Item Codes`
- Input and output paths are configurable
- if no input path is configured, values are read from the URIs of the input (Transformation Input)

[cmem-link]: https://documentation.eccenca.com
[cmem-shield]: https://img.shields.io/endpoint?url=https://dev.documentation.eccenca.com/badge.json
[poetry-link]: https://python-poetry.org/
[poetry-shield]: https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json
[ruff-link]: https://docs.astral.sh/ruff/
[ruff-shield]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&label=Code%20Style
[mypy-link]: https://mypy-lang.org/
[mypy-shield]: https://www.mypy-lang.org/static/mypy_badge.svg
[copier]: https://copier.readthedocs.io/
[copier-shield]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-inverted-border-purple.json

39 changes: 21 additions & 18 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# https://taskfile.dev
#
# This is a generated file. We dot not suggest to edit it.
# Instead, create a file `TaskfileCustom.yml` and add your additions there.
---
version: '3'

Expand All @@ -10,13 +13,16 @@ dotenv: ['.copier-answers.env', '.env']
- check:prepare

vars:
PACKAGE: cmem_plugin_$project_slug
PACKAGE: $package_dir
DIST_DIR: dist

includes:
custom:
taskfile: ./TaskfileCustom.yaml
optional: true
plugin:
taskfile: .tasks-plugin.yml
optional: true

tasks:

Expand All @@ -43,6 +49,10 @@ tasks:
Check poetry versioning plugin. Currently not under Windows
run: once
preconditions:
- sh: '[ -d .git ]'
msg: >
Your newly created project directory needs to be initialized
as a git repository.
- sh: '[[ {{.PDV_VERSION}} > {{.PDV_VERSION_MIN}} ]]'
msg: >
This project needs the poetry-dynamic-versioning
Expand Down Expand Up @@ -113,23 +123,26 @@ tasks:
poetry run pytest --junitxml={{.JUNIT_FILE}}
--cov-report term --cov-report xml:{{.COVERAGE_FILE}}
--cov-report html:{{.COVERAGE_DIR}} --cov={{.PACKAGE}}
--html={{.HTML_FILE}} --self-contained-html
- platforms: [darwin, linux]
cmd: >
poetry run pytest --memray --junitxml={{.JUNIT_FILE}}
--cov-report term --cov-report xml:{{.COVERAGE_FILE}}
--cov-report html:{{.COVERAGE_DIR}} --cov={{.PACKAGE}}
--html={{.HTML_FILE}} --self-contained-html
- cmd: >
poetry run genbadge coverage -l
-i {{.COVERAGE_FILE}} -o {{.BADGE_COVERAGE}}
- cmd: >
poetry run genbadge tests -l
-i {{.JUNIT_FILE}} -o {{.BADGE_TESTS}}
vars:
JUNIT_FILE: ./{{.DIST_DIR}}/junit-pytest.xml
COVERAGE_FILE: ./{{.DIST_DIR}}/coverage.xml
COVERAGE_DIR: ./{{.DIST_DIR}}/coverage
BADGE_COVERAGE: ./{{.DIST_DIR}}/badge-coverage.svg
BADGE_TESTS: ./{{.DIST_DIR}}/badge-tests.svg
COVERAGE_DIR: ./{{.DIST_DIR}}/coverage
COVERAGE_FILE: ./{{.DIST_DIR}}/coverage.xml
HTML_FILE: ./{{.DIST_DIR}}/pytest.html
JUNIT_FILE: ./{{.DIST_DIR}}/junit-pytest.xml

check:mypy:
desc: Complain about typing errors
Expand All @@ -144,30 +157,22 @@ tasks:
<<: *preparation
cmds:
# ignore 51358 safety - dev dependency only
# ignore 61489 pillow - dev dependency only
- poetry run safety check -i 51358 -i 61489
# ignore 67599 pip - dev dependency only
# ignore 70612 jinja2 - dev dependency only
- poetry run safety check -i 51358 -i 67599 -i 70612

check:ruff:
desc: Complain about everything else
<<: *preparation
cmds:
- poetry run ruff check --show-source tests {{.PACKAGE}}
- poetry run ruff check --exit-zero tests {{.PACKAGE}} {{.XML_PARAMS}}
- poetry run ruff check --output-format=concise tests {{.PACKAGE}}
- poetry run ruff format --check tests {{.PACKAGE}}
vars:
JUNIT_FILE: ./{{.DIST_DIR}}/junit-ruff.xml
XML_PARAMS: --output-format junit --output-file {{.JUNIT_FILE}}

# }}}
# {{{ build and deploy tasks

deploy:
desc: Install plugin package in Corporate Memory
deps:
- build
cmds:
- cmemc admin workspace python install dist/*.tar.gz
- cmemc admin workspace python list-plugins

build:
desc: Build a tarball and a wheel package
Expand All @@ -178,5 +183,3 @@ tasks:
cmds:
- poetry build

# }}}

2 changes: 1 addition & 1 deletion cmem_plugin_irdi/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""irdi - main package"""
"""cmem-plugin-irdi"""
1 change: 1 addition & 0 deletions cmem_plugin_irdi/components.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PluginParameters and validation regex's for IRDI components"""

from cmem_plugin_base.dataintegration.description import PluginParameter

components = {
Expand Down
1 change: 1 addition & 0 deletions cmem_plugin_irdi/item_code.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Create unique item codes"""

from pathlib import Path

from cmem.cmempy.dp.proxy.graph import post_streamed
Expand Down
1 change: 1 addition & 0 deletions cmem_plugin_irdi/workflow/irdi_plugin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""IRDI creation Plugin"""

import re
from typing import Sequence # noqa: UP035

Expand Down
Loading

0 comments on commit f7c3eaf

Please sign in to comment.