From 0b009340d15c777f625f7fe1b15267128fb03266 Mon Sep 17 00:00:00 2001 From: Tobias Kunze Date: Thu, 2 Nov 2023 17:33:25 +0100 Subject: [PATCH] Migrate to pyproject.toml --- .github/workflows/style.yml | 99 ++++++++----------------------------- pretalx_youtube/__init__.py | 1 + pretalx_youtube/apps.py | 4 +- pyproject.toml | 38 ++++++++++++++ setup.py | 42 ---------------- 5 files changed, 63 insertions(+), 121 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index d06ca46..3a380b7 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -19,20 +19,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Set up Python 3.10 + - name: Set up Python 3.11 uses: actions/setup-python@v1 with: - python-version: "3.10" - - uses: actions/cache@v1 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} - restore-keys: | - ${{ runner.os }}-pip- - - name: Install pretalx - run: pip3 install pretalx - - name: Install Dependencies - run: pip3 install isort -Ue . + cache: "pip" + python-version: "3.11" + - name: Install isort + run: pip3 install isort - name: Run isort run: isort -c . flake: @@ -40,20 +33,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Set up Python 3.10 + - name: Set up Python 3.11 uses: actions/setup-python@v1 with: - python-version: "3.10" - - uses: actions/cache@v1 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} - restore-keys: | - ${{ runner.os }}-pip- - - name: Install pretalx - run: pip3 install pretalx + cache: "pip" + python-version: "3.11" - name: Install Dependencies - run: pip3 install flake8 flake8-bugbear -Ue . + run: pip3 install flake8 flake8-bugbear - name: Run flake8 run: flake8 . working-directory: . @@ -62,64 +48,28 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Set up Python 3.10 + - name: Set up Python 3.11 uses: actions/setup-python@v1 with: - python-version: "3.10" - - uses: actions/cache@v1 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} - restore-keys: | - ${{ runner.os }}-pip- - - name: Install pretalx - run: pip3 install pretalx + cache: "pip" + python-version: "3.11" - name: Install Dependencies - run: pip3 install black -Ue . + run: pip3 install black - name: Run black run: black --check . working-directory: . - docformatter: - name: docformatter - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.10 - uses: actions/setup-python@v1 - with: - python-version: "3.10" - - uses: actions/cache@v1 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} - restore-keys: | - ${{ runner.os }}-pip- - - name: Install pretalx - run: pip3 install pretalx - - name: Install Dependencies - run: pip3 install docformatter -Ue . - - name: Run docformatter - run: docformatter --check -r . - working-directory: . djhtml: name: djhtml runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Set up Python 3.10 + - name: Set up Python 3.11 uses: actions/setup-python@v1 with: - python-version: "3.10" - - uses: actions/cache@v1 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} - restore-keys: | - ${{ runner.os }}-pip- - - name: Install pretalx - run: pip3 install pretalx + cache: "pip" + python-version: "3.11" - name: Install Dependencies - run: pip3 install djhtml -Ue . + run: pip3 install djhtml - name: Run docformatter run: find -name "*.html" | xargs djhtml -c working-directory: . @@ -128,25 +78,18 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Set up Python 3.10 + - name: Set up Python 3.11 uses: actions/setup-python@v1 with: - python-version: "3.10" - - uses: actions/cache@v1 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} - restore-keys: | - ${{ runner.os }}-pip- - - name: Install pretalx - run: pip3 install pretalx + cache: "pip" + python-version: "3.11" - name: Install Dependencies run: pip3 install twine check-manifest -Ue . - name: Run check-manifest run: check-manifest . working-directory: . - name: Build package - run: python setup.py sdist + run: python -m build working-directory: . - name: Check package run: twine check dist/* diff --git a/pretalx_youtube/__init__.py b/pretalx_youtube/__init__.py index e69de29..8c0d5d5 100644 --- a/pretalx_youtube/__init__.py +++ b/pretalx_youtube/__init__.py @@ -0,0 +1 @@ +__version__ = "2.0.0" diff --git a/pretalx_youtube/apps.py b/pretalx_youtube/apps.py index f38a37d..dae7ce9 100644 --- a/pretalx_youtube/apps.py +++ b/pretalx_youtube/apps.py @@ -1,6 +1,8 @@ from django.apps import AppConfig from django.utils.translation import gettext_lazy +from . import __version__ + class PluginApp(AppConfig): name = "pretalx_youtube" @@ -13,7 +15,7 @@ class PretalxPluginMeta: "Show YouTube videos embedded on talk pages. Set URLs manually or via API." ) visible = True - version = "2.0.0" + version = __version__ category = "RECORDING" def ready(self): diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..993f2e0 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,38 @@ +[project] +name = "pretalx-youtube" +dynamic = ["version"] +description = "Static youtube for pretalx, e.g. information, venue listings, a Code of Conduct, etc." +readme = "README.rst" +license = {text = "Apache Software License"} +keywords = ["pretalx"] +authors = [ + {name = "Tobias Kunze", email = "r@rixx.de"}, +] +maintainers = [ + {name = "Tobias Kunze", email = "r@rixx.de"}, +] + +dependencies = [] + +[project.urls] +homepage = "https://github.com/pretalx/pretalx-youtube" +repository = "https://github.com/pretalx/pretalx-youtube.git" + +[project.entry-points."pretalx.plugin"] +pretalx_youtube = "pretalx_youtube:PretalxPluginMeta" + +[build-system] +build-backend = "setuptools.build_meta" +requires = ["setuptools", "wheel"] + +[tool.setuptools] +include-package-data = true + +[tool.setuptools.dynamic] +version = {attr = "pretalx_youtube.__version__"} + +[tool.setuptools.packages.find] +include = ["pretalx*"] + +[tool.check-manifest] +ignore = [".*"] diff --git a/setup.py b/setup.py deleted file mode 100644 index 4c1f8d4..0000000 --- a/setup.py +++ /dev/null @@ -1,42 +0,0 @@ -import os -from distutils.command.build import build - -from django.core import management -from setuptools import find_packages, setup - -try: - with open( - os.path.join(os.path.dirname(__file__), "README.rst"), encoding="utf-8" - ) as f: - long_description = f.read() -except FileNotFoundError: - long_description = "" - - -class CustomBuild(build): - def run(self): - management.call_command("compilemessages", verbosity=1) - build.run(self) - - -cmdclass = {"build": CustomBuild} - - -setup( - name="pretalx-youtube", - version="2.0.0", - description="Embed YouTube videos as session recordings", - long_description=long_description, - url="https://github.com/pretalx/pretalx-youtube", - author="Tobias Kunze", - author_email="r@rixx.de", - license="Apache Software License", - install_requires=[], - packages=find_packages(exclude=["tests", "tests.*"]), - include_package_data=True, - cmdclass=cmdclass, - entry_points=""" -[pretalx.plugin] -pretalx_youtube=pretalx_youtube:PretalxPluginMeta -""", -)