From b0823ab31b80bce7ed43efd5068467f66e744feb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Sch=C3=A4fer?= <felix@thegcat.net>
Date: Sat, 1 Feb 2025 21:19:36 +0100
Subject: [PATCH] Apply updateded pretix plugin cookiecutter

---
 .github/workflows/style.yml | 18 ++++----
 .github/workflows/tests.yml |  4 +-
 .gitignore                  |  7 +++-
 .gitlab-ci.yml              | 84 ++++++++++++++++++-------------------
 LICENSE                     |  2 +-
 pyproject.toml              | 48 +++++++++++++++++++++
 setup.cfg                   |  2 +-
 setup.py                    | 46 +-------------------
 8 files changed, 110 insertions(+), 101 deletions(-)
 create mode 100644 pyproject.toml

diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml
index 8c3e20c..6daaf57 100644
--- a/.github/workflows/style.yml
+++ b/.github/workflows/style.yml
@@ -18,10 +18,10 @@ jobs:
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v2
-      - name: Set up Python 3.8
+      - name: Set up Python 3.11
         uses: actions/setup-python@v1
         with:
-          python-version: 3.8
+          python-version: 3.11
       - uses: actions/cache@v1
         with:
           path: ~/.cache/pip
@@ -39,10 +39,10 @@ jobs:
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v2
-      - name: Set up Python 3.8
+      - name: Set up Python 3.11
         uses: actions/setup-python@v1
         with:
-          python-version: 3.8
+          python-version: 3.11
       - uses: actions/cache@v1
         with:
           path: ~/.cache/pip
@@ -61,10 +61,10 @@ jobs:
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v2
-      - name: Set up Python 3.8
+      - name: Set up Python 3.11
         uses: actions/setup-python@v1
         with:
-          python-version: 3.8
+          python-version: 3.11
       - uses: actions/cache@v1
         with:
           path: ~/.cache/pip
@@ -83,10 +83,10 @@ jobs:
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v2
-      - name: Set up Python 3.8
+      - name: Set up Python 3.11
         uses: actions/setup-python@v1
         with:
-          python-version: 3.8
+          python-version: 3.11
       - uses: actions/cache@v1
         with:
           path: ~/.cache/pip
@@ -96,7 +96,7 @@ jobs:
       - name: Install pretix
         run: pip3 install pretix
       - name: Install Dependencies
-        run: pip3 install twine check-manifest -Ue .
+        run: pip3 install twine check-manifest pretix-plugin-build setuptools build -Ue .
       - name: Run check-manifest
         run: check-manifest .
         working-directory: .
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 5a9d94c..97b40c9 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -16,10 +16,10 @@ jobs:
     name: Tests
     steps:
       - uses: actions/checkout@v2
-      - name: Set up Python 3.8
+      - name: Set up Python 3.11
         uses: actions/setup-python@v1
         with:
-          python-version: 3.8
+          python-version: 3.11
       - uses: actions/cache@v1
         with:
           path: ~/.cache/pip
diff --git a/.gitignore b/.gitignore
index 0185dca..308f8e4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -49,6 +49,7 @@ __pycache__/
 
 # Distribution / packaging
 .Python
+env/
 build/
 develop-eggs/
 dist/
@@ -66,6 +67,7 @@ share/python-wheels/
 .installed.cfg
 *.egg
 MANIFEST
+.ropeproject/
 
 # PyInstaller
 #  Usually these files are written by a python script from a template
@@ -87,7 +89,7 @@ htmlcov/
 nosetests.xml
 coverage.xml
 *.cover
-*.py,cover
+*,cover
 .hypothesis/
 .pytest_cache/
 cover/
@@ -101,6 +103,7 @@ cover/
 local_settings.py
 db.sqlite3
 db.sqlite3-journal
+data/
 
 # Flask stuff:
 instance/
@@ -116,7 +119,7 @@ docs/_build/
 .pybuilder/
 target/
 
-# Jupyter Notebook
+# Ipython Notebook
 .ipynb_checkpoints
 
 # IPython
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b3f9601..a953868 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,42 +1,42 @@
----
-stages:
-  - linting
-# Change pip's cache directory to be inside the project directory since we can
-# only cache local items.
-variables:
-  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
-cache:
-  paths:
-    - .cache
-
-docformatter:
-  stage: linting
-  image: python:3
-  before_script:
-    - pip3 install -U pip docformatter
-  script:
-    - docformatter --check -r .
-
-black:
-  stage: linting
-  image: python:3
-  before_script:
-    - pip3 install -U pip black
-  script:
-    - black --check .
-
-isort:
-  stage: linting
-  image: python:3
-  before_script:
-    - pip3 install -U pip isort
-  script:
-    - isort -c .
-
-flake8:
-  stage: linting
-  image: python:3
-  before_script:
-    - pip3 install -U pip flake8
-  script:
-    - flake8 .
+test:
+    image:
+        name: pretix/ci-image
+    before_script:
+        - pip install -U pip uv
+        - uv pip install --system -U wheel setuptools pytest pytest-django coverage
+        - uv pip install --system -U git+https://github.com/pretix/pretix.git@master#egg=pretix
+    script:
+        - uv pip install --system -e .
+        - make
+        - coverage run -m pytest tests
+        - coverage report
+style:
+    image:
+        name: pretix/ci-image
+    before_script:
+        - pip install -U pip uv
+        - uv pip install --system -U wheel setuptools isort black flake8 check-manifest
+        - uv pip install --system -U git+https://github.com/pretix/pretix.git@master#egg=pretix
+    script:
+        - uv pip install --system -e .
+        - black --check .
+        - isort -c --gitignore .
+        - flake8 --extend-exclude .cache .
+        - check-manifest --ignore .cache .
+pypi:
+    image:
+        name: pretix/ci-image
+    before_script:
+        - cat $PYPIRC > ~/.pypirc
+        - pip install -U pip uv
+        - uv pip install --system -U wheel setuptools twine build pretix-plugin-build check-manifest
+    script:
+        - python -m build
+        - check-manifest .
+        - twine check dist/*
+        - twine upload dist/*
+    only:
+        - pypi
+    artifacts:
+        paths:
+            - dist/
diff --git a/LICENSE b/LICENSE
index baf3590..bab88b8 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,5 +1,5 @@
 
-Copyright 2023 Jaakko Rinta-Filppula, Felix Schäfer
+Copyright 2025 Jaakko Rinta-Filppula, Felix Schäfer
 
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..036c8d0
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,48 @@
+[project]
+name = "pretix-oidc"
+dynamic = ["version"]
+description = "OIDC authentication plugin for pretix"
+readme = "README.md"
+license = {text = "Apache"}
+keywords = ["pretix", "oidc"]
+authors = [
+    {name = "Felix Schäfer", email = "admin@kif.rocks"},
+    {name = "Jaakko Rinta-Filppula"},
+]
+maintainers = [
+    {name = "Felix Schäfer", email = "admin@kif.rocks"},
+]
+
+dependencies = [
+    "dictlib",
+    "oic",
+]
+
+[project.entry-points."pretix.plugin"]
+pretix_oidc = "pretix_oidc:PretixPluginMeta"
+
+[project.entry-points."distutils.commands"]
+build = "pretix_plugin_build.build:CustomBuild"
+
+[build-system]
+requires = [
+    "setuptools",
+    "pretix-plugin-build",
+]
+
+[project.urls]
+Homepage = "https://gitlab.fachschaften.org/kif/pretix-oidc"
+Repository = "https://github.com/thegcat/pretix-oidc"
+Tracker = "https://github.com/thegcat/pretix-oidc/issues"
+"pretix Marketplace" = "https://marketplace.pretix.eu/products/oidc/"
+
+
+[tool.setuptools]
+include-package-data = true
+
+[tool.setuptools.dynamic]
+version = {attr = "pretix_oidc.__version__"}
+
+[tool.setuptools.packages.find]
+include = ["pretix*"]
+namespaces = false
diff --git a/setup.cfg b/setup.cfg
index e6a04c7..4a11e4f 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -4,12 +4,12 @@ max-line-length = 160
 exclude = migrations,.ropeproject,static,_static,build
 
 [isort]
+profile = black
 combine_as_imports = true
 default_section = THIRDPARTY
 include_trailing_comma = true
 known_third_party = pretix
 known_standard_library = typing
-multi_line_output = 3
 skip = setup.py
 use_parentheses = True
 force_grid_wrap = 0
diff --git a/setup.py b/setup.py
index d4034f7..b024da8 100644
--- a/setup.py
+++ b/setup.py
@@ -1,46 +1,4 @@
-import os
-from distutils.command.build import build
+from setuptools import setup
 
-from django.core import management
-from setuptools import find_packages, setup
 
-from pretix_oidc import __version__
-
-
-try:
-    with open(
-        os.path.join(os.path.dirname(__file__), "README.md"), encoding="utf-8"
-    ) as f:
-        long_description = f.read()
-except Exception:
-    long_description = ""
-
-
-class CustomBuild(build):
-    def run(self):
-        management.call_command("compilemessages", verbosity=1)
-        build.run(self)
-
-
-cmdclass = {"build": CustomBuild}
-
-
-setup(
-    name="pretix-oidc",
-    version=__version__,
-    description="OIDC authentication plugin for pretix",
-    long_description=long_description,
-    long_description_content_type="text/markdown",
-    url="https://gitlab.fachschaften.org/kif/pretix-oidc",
-    author="Jaakko Rinta-Filppula, Felix Schäfer",
-    author_email="admin@kif.rocks",
-    license="Apache",
-    install_requires=["dictlib>=1.1.5", "oic>=1.2.0"],
-    packages=find_packages(exclude=["tests", "tests.*"]),
-    include_package_data=True,
-    cmdclass=cmdclass,
-    entry_points="""
-[pretix.plugin]
-pretix_oidc=pretix_oidc:PretixPluginMeta
-""",
-)
+setup()
-- 
GitLab