Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prepare release 0.2.0 #17

Merged
merged 4 commits into from
Apr 30, 2024
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ dmypy.json
# ruff
.ruff_cache

# cruft
.cruft-pr-body
*.rej

# PyCharm
.idea/
.idea_modules/
Expand Down
30 changes: 28 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,43 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

### Changes

### Deprecated

### Removed

### Fixed

### Security

## [0.2.0] - 2024-04-30

### Added

- add review assignment to mex-template itself
- add code of conduct file to mex-template itself
- add badges for open-code and cookiecutter
- add renovate config and github action

### Changes

- improve prompt for project name
- switch from poetry to pdm

### Deprecated
- switch order of black and ruff linter, as ruff often complains about issues,
that are automatically fixed by black
- add tests and ruff cache to dockerignore
- use `WORKFLOW_TOKEN` in cookiecutter job for consistency
- switch json linting to 4-spaces and utf-8
- clean up and expand pdm scripts
- improve and simplify mex.bat and makefile
- update pdm, ruff and pre-commit
- switch version specifiers to exact matches for renovatebot

### Removed

- delete dependabot config

### Fixed

- fix finding of rejected cruft files
Expand Down
74 changes: 74 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and
maintainers pledge to make participation in our project and our community a
harassment-free experience for everyone, regardless of age, body size, disability,
ethnicity, sex characteristics, gender identity and expression, level of experience,
education, socio-economic status, nationality, personal appearance, race, religion,
or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project team members are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in response to
any instances of unacceptable behavior.

Project team members have the right and responsibility to remove, edit, or reject
comments, commits, code, and other contributions that are not aligned to this
Code of Conduct, or to ban temporarily or permanently any contributor for other
behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies within all project spaces, and it also applies when an
individual is representing the project or its community in public spaces. Examples of
representing a project or community include using an official project e-mail address,
appearing as a project maintainer, or acting as an appointed representative at an online
or offline event. Representation of a project may be further defined and clarified by
the project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by
contacting the project team at [email protected]. All complaints will be reviewed and
investigated and will result in a response that is deemed necessary and appropriate to
the circumstances. The project team is obligated to maintain confidentiality with regard
to the reporter of an incident. Further details of specific enforcement policies may be
posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may
face temporary or permanent repercussions as determined by project, departmental
or organizational leadership roles.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Cookiecutter template for MEx python projects.

[![open-code](https://github.com/robert-koch-institut/mex-template/actions/workflows/open-code.yml/badge.svg)](https://gitlab.opencode.de/robert-koch-institut/mex/mex-template)

## project

The Metadata Exchange (MEx) project is committed to improve the retrieval of RKI
Expand Down
4 changes: 4 additions & 0 deletions mex-{{ cookiecutter.project_name }}/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
tests/
htmlcov/
.tox/
.nox/
Expand Down Expand Up @@ -96,6 +97,9 @@ venv.bak/
.dmypy.json
dmypy.json

# ruff
.ruff_cache

# PyCharm
.idea/
.idea_modules/
Expand Down
20 changes: 0 additions & 20 deletions mex-{{ cookiecutter.project_name }}/.github/dependabot.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:

- name: Update template
env:
{% raw %}GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}{% endraw %}
{% raw %}GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}{% endraw %}
run: |
{% raw -%}
if cruft check; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
- name: Export dependencies
run: |
mkdir --parents pdm
pdm export -G :all -f requirements > pdm/requirements.txt
pdm export-all > pdm/requirements.txt

- name: Run trivy
uses: aquasecurity/trivy-action@master
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Renovate

on:
push:
branches: ["main"]
schedule:
# * is a special character in YAML so you have to quote this string
- cron: "14 3 * * 1-5"
workflow_dispatch:

jobs:
renovate:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Run renovatebot
uses: renovatebot/[email protected]
env:
RENOVATE_GIT_PRIVATE_KEY: {% raw %}${{ secrets.GPG_SIGNING_KEY }}{% endraw %}
RENOVATE_REPOSITORIES: "robert-koch-institut/mex-{{ cookiecutter.project_name }}"
with:
configurationFile: renovate.json
token: {% raw %}${{ secrets.WORKFLOW_TOKEN }}{% endraw %}
17 changes: 9 additions & 8 deletions mex-{{ cookiecutter.project_name }}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,41 @@ fail_fast: false
default_language_version:
python: python3.11
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.3
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black
rev: 24.3.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.5
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: pretty-format-json
name: json
args: [--autofix]
args: [--autofix, --indent=4, --no-ensure-ascii]
exclude: .cruft.json
- id: check-yaml
name: yaml
exclude: templates\/[a-z_-]+.yaml
- id: end-of-file-fixer
name: eof
- id: trailing-whitespace
name: whitespaces
- id: fix-byte-order-marker
name: byte-order
- repo: https://github.com/pdm-project/pdm
rev: 2.12.4
rev: 2.13.2
hooks:
- id: pdm-lock-check
name: pdm
- repo: local
hooks:
- id: mypy
name: mypy
entry: pdm run dmypy run --timeout 7200 -- mex
entry: pdm mypy-daemon
files: ^mex/
language: system
pass_filenames: false
Expand Down
30 changes: 15 additions & 15 deletions mex-{{ cookiecutter.project_name }}/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
.PHONY: all test setup hooks install linter pytest wheel container run start docs
.PHONY: all test setup hooks install linter pytest wheel image run start docs
all: install test
test: linter pytest

LATEST = $(shell git describe --tags $(shell git rev-list --tags --max-count=1))
PWD = $(shell pwd)

setup:
# install meta requirements system-wide
@ echo installing requirements; \
python -m pip --quiet --disable-pip-version-check install --force-reinstall -r requirements.txt; \
pip --disable-pip-version-check install --force-reinstall -r requirements.txt; \

hooks:
# install pre-commit hooks when not in CI
Expand All @@ -18,48 +19,47 @@ hooks:
install: setup hooks
# install packages from lock file in local virtual environment
@ echo installing package; \
pdm sync --clean --group dev; \
pdm install-all; \

linter:
# run the linter hooks from pre-commit on all files
@ echo linting all files; \
pre-commit run --all-files; \
pdm lint; \

pytest:
# run the pytest test suite with all unit tests
@ echo running unit tests; \
pdm run pytest -m "not integration"; \
pdm unit; \

wheel:
# build the python package
@ echo building wheel; \
pdm build --no-sdist; \
pdm wheel; \

container:
image:
# build the docker image
@ echo building docker image mex-{{ cookiecutter.project_name }}:${LATEST}; \
export DOCKER_BUILDKIT=1; \
docker build \
--tag rki/mex-{{ cookiecutter.project_name }}:${LATEST} \
--tag rki/mex-{{ cookiecutter.project_name }}:latest .; \

run: container
run: image
# run the service as a docker container
@ echo running docker container mex-{{ cookiecutter.project_name }}:${LATEST}; \
docker run \
--env MEX_{{ cookiecutter.project_name|upper }}_HOST=0.0.0.0 \
--publish 8081:8081 \
rki/mex-{{ cookiecutter.project_name }}:${LATEST}; \

start: container
# start the service using docker-compose
@ echo running docker-compose with mex-{{ cookiecutter.project_name }}:${LATEST}; \
start: image
# start the service using docker compose
@ echo start mex-{{ cookiecutter.project_name }}:${LATEST} with compose; \
export DOCKER_BUILDKIT=1; \
export COMPOSE_DOCKER_CLI_BUILD=1; \
docker-compose up; \
docker compose up --remove-orphans; \

docs:
# use sphinx to auto-generate html docs from code
@ echo generating api docs; \
pdm run sphinx-apidoc -f -o docs/source mex; \
pdm run sphinx-build -aE -b dirhtml docs docs/dist; \
@ echo generating docs; \
pdm doc; \
Loading