From df835b97367cb4b88d5f87d2cce1f82cc2afa633 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Fri, 23 Jun 2023 09:58:12 +0300 Subject: [PATCH 1/4] Use hatch for packaging --- infotv/__init__.py | 1 + pyproject.toml | 53 ++++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 6 ------ setup.py | 27 ----------------------- 4 files changed, 54 insertions(+), 33 deletions(-) delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/infotv/__init__.py b/infotv/__init__.py index e69de29..277b41d 100644 --- a/infotv/__init__.py +++ b/infotv/__init__.py @@ -0,0 +1 @@ +__version__ = "0.4.0post1" diff --git a/pyproject.toml b/pyproject.toml index 560e044..39d569a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,52 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "infotv" +dynamic = ["version"] +description = "A television, with information" +readme = "README.md" +license = "MIT" +requires-python = ">=3.7" +authors = [ + { name = "Kehittyvien conien Suomi ry" }, + { name = "Aarni Koskela", email = "akx@iki.fi" }, +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "License :: OSI Approved :: MIT License", +] +dependencies = [ + "Django>=3.2", + "jsonfield>=1.0.3", + "requests>=2.13.0", +] + +[project.urls] +Homepage = "https://github.com/kcsry/infotv" + +[tool.hatch.version] +path = "infotv/__init__.py" + +[tool.hatch.build] +artifacts = [ + "infotv/static", +] + +[tool.hatch.build.targets.sdist] +include = [ + "/infotv", +] +exclude = [ + "/infotv/static/infotv", +] + +[tool.hatch.build.targets.wheel] +exclude = [ + "infotv/frontend", +] + [tool.ruff] target-version = "py37" line-length = 120 @@ -23,3 +72,7 @@ ignore = [ [tool.ruff.per-file-ignores] "infotv_test/**" = ["ANN"] + +[tool.pytest.ini_options] +DJANGO_SETTINGS_MODULE = "infotv_test.settings" +norecursedirs = ["bower_components", "node_modules", ".git", "venv", "site-packages"] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index bd713ad..0000000 --- a/setup.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[flake8] -exclude = migrations,tests - -[tool:pytest] -DJANGO_SETTINGS_MODULE = infotv_test.settings -norecursedirs = bower_components node_modules .git venv site-packages diff --git a/setup.py b/setup.py deleted file mode 100644 index 1a5bc7c..0000000 --- a/setup.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python - - -from setuptools import find_packages, setup - -setup( - name="infotv", - version="0.4.0", - description="A television, with information", - author="Aarni Koskela", - author_email="akx@iki.fi", - url="https://github.com/kcsry/infotv", - packages=find_packages(".", exclude=("infotv_test*",)), - package_data={"infotv": ["static/infotv/*"]}, - include_package_data=True, - zip_safe=False, - install_requires=[ - "Django>=3.2", - "jsonfield>=1.0.3", - "requests>=2.13.0", - ], - classifiers=[ - "Development Status :: 5 - Production/Stable", - "License :: OSI Approved :: MIT License", - ], - python_requires=">=3.7", -) From 87f5d300e7e541defa99ede4bf3fcc1d0efb1b57 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Fri, 23 Jun 2023 10:02:00 +0300 Subject: [PATCH 2/4] Renovate test matrix --- .github/workflows/ci.yml | 3 --- tox.ini | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68da5c4..8d9fe1a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,9 +23,6 @@ jobs: matrix: include: - python-version: "3.7" - - python-version: "3.8" - - python-version: "3.9" - - python-version: "3.10" - python-version: "3.11" steps: - uses: actions/checkout@v3 diff --git a/tox.ini b/tox.ini index 258337f..04d21e8 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] envlist = py37-django32 - py3{8,9,10,11}-django{40,41} + py3{8,9,10,11}-django{40,41,42} [gh-actions] python = @@ -21,3 +21,4 @@ deps = django32: Django~=3.2.0 django40: Django~=4.0.0 django41: Django~=4.1.0 + django42: Django~=4.2.0 From 6ffd39d317b67feecb5f505b6043f44c37360a93 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Fri, 23 Jun 2023 10:13:08 +0300 Subject: [PATCH 3/4] Become 0.5.0 --- infotv/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infotv/__init__.py b/infotv/__init__.py index 277b41d..3d18726 100644 --- a/infotv/__init__.py +++ b/infotv/__init__.py @@ -1 +1 @@ -__version__ = "0.4.0post1" +__version__ = "0.5.0" From 194cf8d70a24fcde8961e02338937d294ca2b5bf Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Fri, 23 Jun 2023 09:58:31 +0300 Subject: [PATCH 4/4] Build wheel in CI --- .github/workflows/ci.yml | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d9fe1a..617801a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,13 +45,41 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18.x + cache: yarn + cache-dependency-path: | + infotv/frontend/package.json + infotv/frontend/yarn.lock - run: yarn --frozen-lockfile working-directory: ./infotv/frontend - run: yarn lint working-directory: ./infotv/frontend - run: yarn build working-directory: ./infotv/frontend - env: - NODE_OPTIONS: --openssl-legacy-provider - run: yarn test working-directory: ./infotv/frontend + - uses: actions/upload-artifact@v3 + with: + name: infotv-static + path: ./infotv/static + + Build-Wheel: + needs: + - JavaScript + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: "3.11" + cache: pip + - uses: actions/download-artifact@v2 + with: + name: infotv-static + path: infotv/static + - run: pip install build + - run: python -m build . + - run: zipinfo dist/*.whl | grep static/infotv/bundle.js || exit 42 + - uses: actions/upload-artifact@v3 + with: + name: dist + path: dist