From 0970dce0ec2ac413ce73f796899da72e09a7b3cc Mon Sep 17 00:00:00 2001 From: Jonas Geuens Date: Tue, 3 Sep 2024 10:43:55 +0200 Subject: [PATCH] #306 Migratie pyproject + GH Actions Fixes #306 --- .github/pr-labeler.yml | 3 + .github/workflows/pr-labeler.yml | 22 ++++++ .github/workflows/pyoes.yml | 42 ++++++++++ .travis.yml | 14 ---- README.md | 28 +++++++ check_versions.sh | 2 +- pyproject.toml | 58 ++++++++++++++ requirements-ci.txt | 114 +++++++++++++++++++++++++++ requirements-dev.txt | 128 +++++++++++++++++++++++++++---- requirements.txt | 40 +++++++++- setup.py | 51 ------------ tox.ini | 18 ----- 12 files changed, 415 insertions(+), 105 deletions(-) create mode 100644 .github/pr-labeler.yml create mode 100644 .github/workflows/pr-labeler.yml create mode 100644 .github/workflows/pyoes.yml delete mode 100644 .travis.yml create mode 100644 README.md create mode 100644 pyproject.toml create mode 100644 requirements-ci.txt delete mode 100644 setup.py delete mode 100644 tox.ini diff --git a/.github/pr-labeler.yml b/.github/pr-labeler.yml new file mode 100644 index 00000000..b0f2235f --- /dev/null +++ b/.github/pr-labeler.yml @@ -0,0 +1,3 @@ +feature: ['feature/*', 'feat/*'] +fix: ['bugfix/*', 'fix/*'] +test: test/* \ No newline at end of file diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml new file mode 100644 index 00000000..cd91bce3 --- /dev/null +++ b/.github/workflows/pr-labeler.yml @@ -0,0 +1,22 @@ +name: PR Labeler +on: + pull_request: + types: [opened] + branches: + - 'develop' + - 'epic' + +permissions: + contents: read + +jobs: + pr-labeler: + permissions: + contents: read # for TimonVS/pr-labeler-action to read config file + pull-requests: write # for TimonVS/pr-labeler-action to add labels in PR + runs-on: ubuntu-latest + steps: + - uses: TimonVS/pr-labeler-action@v4 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + configuration-path: .github/pr-labeler.yml \ No newline at end of file diff --git a/.github/workflows/pyoes.yml b/.github/workflows/pyoes.yml new file mode 100644 index 00000000..801998c7 --- /dev/null +++ b/.github/workflows/pyoes.yml @@ -0,0 +1,42 @@ +name: pyoes + +on: [push, pull_request] + +env: + PYTHON_VERSION: "3.11" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '16' + + - name: Install dependencies + env: + HATCH_BUILD_NO_HOOKS: true + run: | + pip install pip-tools + pip-sync requirements-ci.txt + pip install -e . + + - name: Run checks and tests + run: | + ./check_versions.sh + py.test --cov pyoes --cov-report term-missing + + - name: Upload coverage to Coveralls + run: coveralls + env: + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 026eccdb..00000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -os: linux -dist: focal -language: python -python: - - "3.8" -env: - - LC_ALL=en_US.utf-8 -install: - - pip install -r requirements-dev.txt - - python setup.py develop -script: - - ./check_versions.sh - - py.test --cov pyoes --cov-report term-missing -after_success: coveralls diff --git a/README.md b/README.md new file mode 100644 index 00000000..883bb317 --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ +pyoes: Pyramid OE style +======================= + +.. image:: https://travis-ci.org/OnroerendErfgoed/pyoes.png + :target: https://travis-ci.org/OnroerendErfgoed/pyoes +.. image:: https://coveralls.io/repos/OnroerendErfgoed/pyoes/badge.png?branch=master + :target: https://coveralls.io/r/OnroerendErfgoed/pyoes + +.. image:: https://readthedocs.org/projects/pyoes/badge/?version=latest + :target: https://readthedocs.org/projects/pyoes/?badge=latest + :alt: Documentation Status +.. image:: https://badge.fury.io/py/pyoes.png + :target: http://badge.fury.io/py/pyoes + +Pyoes helps to share layout between different websites and applications of +Onroerend Erfgoed (Flanders Heritage). + +More information about this library can be found in the docs `folder`. These can +be build using `Sphinx `_. + +.. code-block:: bash + + # activate your virtual env + $ pip install -r requirements-dev.txt + $ cd docs + $ make html + # You can also build a pdf, provided you have the correct latex toolchain installed. + $ make latexpdf diff --git a/check_versions.sh b/check_versions.sh index fa75a764..77cb2984 100755 --- a/check_versions.sh +++ b/check_versions.sh @@ -1,6 +1,6 @@ #!/bin/bash -release_version=`grep version setup.py | cut -d\' -f2` +release_version=`grep 'version' pyproject.toml | grep -oE '[0-9]+\.[0-9]+\.[0-9]+'` versions=( `node -p -e "require('./npm-packages/pyoes/package.json').version"` `node -p -e "require('./pyoes/static/package.json').version"` diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..8727486d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,58 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +version = "0.22.0" +name = "pyoes" +readme = "README.md" +authors = [ + { name = "Flanders Heritage Agency", email = "ict@onroerenderfgoed.be" }, +] +description = "pyoes" +requires-python = ">=3.10,<3.12" +keywords = ["pyramid", "sass", "compass", "style", "css", "jinja2", "templates"] +classifiers = [ + "Programming Language :: Python", + "Framework :: Pyramid", +] +dependencies = [ + "Jinja2==3.1.4", + "MarkupSafe==2.1.3", + "python-dateutil==2.8.2", + "pyramid==2.0.2", + "pyramid-jinja2==2.10" +] + +[project.optional-dependencies] + +dev = [ + "coveralls==3.3.1", + "oe-sphinx-theme==0.4.0", + "pep8==1.7.1", + "pytest==7.4.3", + "pytest-cov==4.1.0", + "Sphinx==7.1.2", + "sphinxcontrib-httpdomain==1.8.1", + "sphinx-rtd-theme==2.0.0", + "sphinxcontrib-plantuml==0.27", + "waitress==2.1.2" +] + +[tool.hatch.build.targets.wheel] +# In the wheel we want to have toelatingen_archeologie in the root as a python module. +packages = [ + "/pyoes", +] + +[project.entry-points."paste.app_factory"] +main = "pyoes:main" + +[project.entry-points."pyramid.scaffold"] +pyoes = "pyoes.scaffolds:PyoesTemplate" +pyoesAdmin = "pyoes.scaffolds:PyoesAdminTemplate" +pyoesProces = "pyoes.scaffolds:PyoesProcesTemplate" + +[tool.hatch.metadata] +# This allows us to use github links as dependencies +allow-direct-references = true \ No newline at end of file diff --git a/requirements-ci.txt b/requirements-ci.txt new file mode 100644 index 00000000..b5a8d0ec --- /dev/null +++ b/requirements-ci.txt @@ -0,0 +1,114 @@ +alabaster==0.7.16 + # via sphinx +babel==2.16.0 + # via sphinx +certifi==2024.8.30 + # via requests +charset-normalizer==3.3.2 + # via requests +coverage==6.5.0 + # via + # coveralls + # pytest-cov +coveralls==3.3.1 +docopt==0.6.2 + # via coveralls +docutils==0.20.1 + # via + # sphinx + # sphinx-rtd-theme +hupper==1.12.1 + # via pyramid +idna==3.8 + # via requests +imagesize==1.4.1 + # via sphinx +iniconfig==2.0.0 + # via pytest +jinja2==3.1.4 + # via + # pyramid-jinja2 + # sphinx +markupsafe==2.1.3 + # via + # jinja2 + # pyramid-jinja2 +oe-sphinx-theme==0.4.0 +packaging==24.1 + # via + # pytest + # sphinx +pastedeploy==3.1.0 + # via plaster-pastedeploy +pep8==1.7.1 +plaster==1.1.2 + # via + # plaster-pastedeploy + # pyramid +plaster-pastedeploy==1.0.1 + # via pyramid +pluggy==1.5.0 + # via pytest +pygments==2.18.0 + # via sphinx +pyramid==2.0.2 + # via pyramid-jinja2 +pyramid-jinja2==2.10 +pytest==7.4.3 + # via pytest-cov +pytest-cov==4.1.0 +python-dateutil==2.8.2 +requests==2.32.3 + # via + # coveralls + # sphinx +setuptools==74.1.0 + # via + # pyramid + # zope-deprecation + # zope-interface +six==1.16.0 + # via + # python-dateutil + # sphinxcontrib-httpdomain +snowballstemmer==2.2.0 + # via sphinx +sphinx==7.1.2 + # via + # oe-sphinx-theme + # sphinx-rtd-theme + # sphinxcontrib-httpdomain + # sphinxcontrib-jquery + # sphinxcontrib-plantuml +sphinx-rtd-theme==2.0.0 +sphinxcontrib-applehelp==2.0.0 + # via sphinx +sphinxcontrib-devhelp==2.0.0 + # via sphinx +sphinxcontrib-htmlhelp==2.1.0 + # via sphinx +sphinxcontrib-httpdomain==1.8.1 +sphinxcontrib-jquery==4.1 + # via sphinx-rtd-theme +sphinxcontrib-jsmath==1.0.1 + # via sphinx +sphinxcontrib-plantuml==0.27 +sphinxcontrib-qthelp==2.0.0 + # via sphinx +sphinxcontrib-serializinghtml==2.0.0 + # via sphinx +translationstring==1.4 + # via pyramid +urllib3==2.2.2 + # via requests +venusian==3.1.0 + # via pyramid +waitress==2.1.2 +webob==1.8.8 + # via pyramid +zope-deprecation==5.0 + # via + # pyramid + # pyramid-jinja2 +zope-interface==7.0.3 + # via pyramid diff --git a/requirements-dev.txt b/requirements-dev.txt index 2d72b4c6..b5a8d0ec 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,20 +1,114 @@ -# Runtime requirements ---requirement requirements.txt - -# Development server -waitress==2.1.2 - -# Sphinx -Sphinx==7.1.2 -sphinxcontrib-httpdomain==1.8.1 -sphinx-rtd-theme==2.0.0 -sphinxcontrib-plantuml==0.27 +alabaster==0.7.16 + # via sphinx +babel==2.16.0 + # via sphinx +certifi==2024.8.30 + # via requests +charset-normalizer==3.3.2 + # via requests +coverage==6.5.0 + # via + # coveralls + # pytest-cov +coveralls==3.3.1 +docopt==0.6.2 + # via coveralls +docutils==0.20.1 + # via + # sphinx + # sphinx-rtd-theme +hupper==1.12.1 + # via pyramid +idna==3.8 + # via requests +imagesize==1.4.1 + # via sphinx +iniconfig==2.0.0 + # via pytest +jinja2==3.1.4 + # via + # pyramid-jinja2 + # sphinx +markupsafe==2.1.3 + # via + # jinja2 + # pyramid-jinja2 oe-sphinx-theme==0.4.0 - -# Testing +packaging==24.1 + # via + # pytest + # sphinx +pastedeploy==3.1.0 + # via plaster-pastedeploy +pep8==1.7.1 +plaster==1.1.2 + # via + # plaster-pastedeploy + # pyramid +plaster-pastedeploy==1.0.1 + # via pyramid +pluggy==1.5.0 + # via pytest +pygments==2.18.0 + # via sphinx +pyramid==2.0.2 + # via pyramid-jinja2 +pyramid-jinja2==2.10 pytest==7.4.3 + # via pytest-cov pytest-cov==4.1.0 -coveralls==3.3.1 - -# Linting -pep8==1.7.1 +python-dateutil==2.8.2 +requests==2.32.3 + # via + # coveralls + # sphinx +setuptools==74.1.0 + # via + # pyramid + # zope-deprecation + # zope-interface +six==1.16.0 + # via + # python-dateutil + # sphinxcontrib-httpdomain +snowballstemmer==2.2.0 + # via sphinx +sphinx==7.1.2 + # via + # oe-sphinx-theme + # sphinx-rtd-theme + # sphinxcontrib-httpdomain + # sphinxcontrib-jquery + # sphinxcontrib-plantuml +sphinx-rtd-theme==2.0.0 +sphinxcontrib-applehelp==2.0.0 + # via sphinx +sphinxcontrib-devhelp==2.0.0 + # via sphinx +sphinxcontrib-htmlhelp==2.1.0 + # via sphinx +sphinxcontrib-httpdomain==1.8.1 +sphinxcontrib-jquery==4.1 + # via sphinx-rtd-theme +sphinxcontrib-jsmath==1.0.1 + # via sphinx +sphinxcontrib-plantuml==0.27 +sphinxcontrib-qthelp==2.0.0 + # via sphinx +sphinxcontrib-serializinghtml==2.0.0 + # via sphinx +translationstring==1.4 + # via pyramid +urllib3==2.2.2 + # via requests +venusian==3.1.0 + # via pyramid +waitress==2.1.2 +webob==1.8.8 + # via pyramid +zope-deprecation==5.0 + # via + # pyramid + # pyramid-jinja2 +zope-interface==7.0.3 + # via pyramid diff --git a/requirements.txt b/requirements.txt index 4a05cd59..256713d3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,39 @@ -# pyramid +hupper==1.12.1 + # via pyramid +jinja2==3.1.4 + # via pyramid-jinja2 +markupsafe==2.1.3 + # via + # jinja2 + # pyramid-jinja2 +pastedeploy==3.1.0 + # via plaster-pastedeploy +plaster==1.1.2 + # via + # plaster-pastedeploy + # pyramid +plaster-pastedeploy==1.0.1 + # via pyramid pyramid==2.0.2 + # via pyramid-jinja2 pyramid-jinja2==2.10 -MarkupSafe==2.1.3 -Jinja2==3.1.4 - python-dateutil==2.8.2 +setuptools==74.1.0 + # via + # pyramid + # zope-deprecation + # zope-interface +six==1.16.0 + # via python-dateutil +translationstring==1.4 + # via pyramid +venusian==3.1.0 + # via pyramid +webob==1.8.8 + # via pyramid +zope-deprecation==5.0 + # via + # pyramid + # pyramid-jinja2 +zope-interface==7.0.3 + # via pyramid diff --git a/setup.py b/setup.py deleted file mode 100644 index e01a2868..00000000 --- a/setup.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- - -import os - -from setuptools import setup - -here = os.path.abspath(os.path.dirname(__file__)) -README = open(os.path.join(here, 'README.rst')).read() -CHANGES = open(os.path.join(here, 'CHANGES.rst')).read() - -requires = [ - 'pyramid', - 'pyramid_jinja2', - 'python-dateutil', - ] - -setup(name='pyoes', - version='0.22.0', - description='Algemene onroerenderfgoed stijl (gebaseerd op de Vlaamse huisstijl) voor pyramid', - long_description=README + '\n\n' + CHANGES, - classifiers=[ - "Programming Language :: Python", - "Programming Language :: Python :: 3.8", - "Programming Language :: JavaScript", - "Development Status :: 3 - Alpha", - "Environment :: Web Environment", - "Intended Audience :: Developers", - "Framework :: Pyramid", - "Topic :: Internet :: WWW/HTTP", - "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", - "Topic :: Text Processing :: Markup :: HTML" - ], - author='Koen Van Daele', - author_email='koen.vandaele@vlaanderen.be', - url='https://pyoes.readthedocs.org/en/latest/', - keywords='pyramid oe onroerend erfgoed sass compass style css jinja2 templates', - packages=['pyoes'], - include_package_data=True, - zip_safe=False, - install_requires=requires, - tests_require=requires, - test_suite="pyoes", - entry_points="""\ - [paste.app_factory] - main = pyoes:main - [pyramid.scaffold] - pyoes=pyoes.scaffolds:PyoesTemplate - pyoesAdmin=pyoes.scaffolds:PyoesAdminTemplate - pyoesProces=pyoes.scaffolds:PyoesProcesTemplate - """, - ) diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 6b6a320e..00000000 --- a/tox.ini +++ /dev/null @@ -1,18 +0,0 @@ -[tox] -envlist = py27, py33, py34, cover - -[testenv] -commands = - pip install -r requirements-dev.txt - python setup.py develop - py.test -setenv = - LC_ALL = en_US.utf-8 - -[testenv:cover] -basepython = - python2.7 -commands = - pip install -r requirements-dev.txt - python setup.py develop - py.test --cov pyoes --cov-report term-missing