Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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=python
package_dir=cmem_plugin_python

11 changes: 6 additions & 5 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: sebastian.tramp@eccenca.com
author_name: Sebastian Tramp
github_page: ''
author_mail: cmempy-developer@eccenca.com
author_name: eccenca GmbH
github_page: https://github.com/eccenca/cmem-plugin-python
project_description: Write ad-hoc transformations and workflow tasks with Python.
project_slug: python
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
2 changes: 1 addition & 1 deletion .idea/cmem-plugin-python.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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_python*.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-python
- poetry run cmemc admin workspace python list-plugins
18 changes: 15 additions & 3 deletions README-public.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,24 @@

Write ad-hoc transformations and workflow tasks with Python.

This is a plugin for [eccenca](https://eccenca.com) [Corporate Memory](https://documentation.eccenca.com).
[![eccenca Corporate Memory][cmem-shield]][cmem-link]

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-python
```
[![workflow](https://github.com/eccenca/cmem-plugin-python/actions/workflows/check.yml/badge.svg)](https://github.com/eccenca/cmem-plugin-python/actions) [![pypi version](https://img.shields.io/pypi/v/cmem-plugin-python)](https://pypi.org/project/cmem-plugin-python) [![license](https://img.shields.io/pypi/l/cmem-plugin-python)](https://pypi.org/project/cmem-plugin-python)
[![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

32 changes: 21 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,34 @@

Write ad-hoc transformations and workflow tasks with Python.

[![eccenca Corporate Memory](https://img.shields.io/badge/eccenca-Corporate%20Memory-orange)](https://documentation.eccenca.com)

## Development

- Run [task](https://taskfile.dev/) to see all major development tasks.
- Use [pre-commit](https://pre-commit.com/) to avoid errors before commit.
- This repository was created with [this copier template](https://github.com/eccenca/cmem-plugin-template).

## Usage

Do not use in production!

```
eval $(cmemc -c my-cmem config eval)
task clean check deploy
task clean check plugin:install
```

😈

![Usage](./usage.png)
[![eccenca Corporate Memory][cmem-shield]][cmem-link][![workflow](https://github.com/eccenca/cmem-plugin-python/actions/workflows/check.yml/badge.svg)](https://github.com/eccenca/cmem-plugin-python/actions) [![pypi version](https://img.shields.io/pypi/v/cmem-plugin-python)](https://pypi.org/project/cmem-plugin-python) [![license](https://img.shields.io/pypi/l/cmem-plugin-python)](https://pypi.org/project/cmem-plugin-python)
[![poetry][poetry-shield]][poetry-link] [![ruff][ruff-shield]][ruff-link] [![mypy][mypy-shield]][mypy-link] [![copier][copier-shield]][copier]

## Development

- Run [task](https://taskfile.dev/) to see all major development tasks.
- Use [pre-commit](https://pre-commit.com/) to avoid errors before commit.
- This repository was created with [this copier template](https://github.com/eccenca/cmem-plugin-template).


[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_python/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""python - main package"""
"""cmem-plugin-python"""
1 change: 1 addition & 0 deletions cmem_plugin_python/transform.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Python code transform plugin module"""

from collections.abc import Sequence
from typing import Any

Expand Down
Loading
Loading