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

Feature/306 ghactions backend upgrade #307

Merged
merged 4 commits into from
Sep 11, 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
17 changes: 17 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[flake8]
application_import_names = pyoes, tests
exclude =
.venv,
venv,
__pycache__,
npm-packages,
node_modules,
static,
docs,
alembic,
dist,
import-order-style = pycharm
max-line-length = 90
extend-select = B950
ignore = W503, E203, E402, E266, E203, E501, E701
per-file-ignores =
3 changes: 3 additions & 0 deletions .github/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
feature: ['feature/*', 'feat/*']
fix: ['bugfix/*', 'fix/*']
test: test/*
22 changes: 22 additions & 0 deletions .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -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
49 changes: 49 additions & 0 deletions .github/workflows/pyoes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
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: |
python3 -m venv venv
source venv/bin/activate
pip install pip-tools
pip-sync requirements-ci.txt
pip install -e .

- name: Run checks and tests
working-directory: ./
run: |
./check_versions.sh
source venv/bin/activate
py.test --cov pyoes --cov-report term-missing

- name: Upload coverage to Coveralls
working-directory: ./
run: |
source venv/bin/activate
coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
types: [python]
- id: trailing-whitespace
types: [python]
- repo: https://github.com/psf/black
rev: 24.3.0
hooks:
- id: black
types: [python]
args: [--preview]
exclude: docs, tests
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
additional_dependencies:
- flake8-import-order==0.18.2
- flake8-bugbear==24.2.6
types: [python]
exclude: docs
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 <http://sphinx-doc.org>`_.

.. 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
2 changes: 1 addition & 1 deletion check_versions.sh
Original file line number Diff line number Diff line change
@@ -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"`
Expand Down
100 changes: 50 additions & 50 deletions pyoes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,70 +3,70 @@
from pyramid.config import Configurator


def main(global_config, **settings): # pragma: no cover
def main(global_config, **settings): # pragma: no cover
"""
Returns a pyramid application that can help demo the style.
"""
config = Configurator(settings=settings)
config.add_static_view('static', 'static', cache_max_age=3600)
config.add_route('home', '/')
config.add_route('burgerprofiel', '/burgerprofiel')
config.add_route('burgerprofiel2', '/burgerprofiel2')
config.add_route('headerlinks', '/headerlinks')
config.add_route('grids', '/grids')
config.add_route('beeldbank', '/beeldbank')
config.add_route('beheersplannen', '/beheersplannen')
config.add_route('beheersplannenres', '/beheersplannen/result')
config.add_route('actorenfront', '/actorenfront')
config.add_route('detail-bedrijf', '/actorenfront/detail-bedrijf')
config.add_route('detail-bedrijfv2', '/actorenfront/detail-bedrijfv2')
config.add_route('detail', '/actorenfront/detail')
config.add_route('actorenzoek', '/actorenzoek')
config.add_route('actorenzoekdetail', '/actorenzoek/detail')
config.add_route('beeldbank-detail', '/beeldbank-detail')
config.add_route('beeldbank-zoeken', '/beeldbank-zoeken')
config.add_route('besluitendatabank', '/besluitendatabank')
config.add_route('inventaris', '/inventaris')
config.add_route('inventaris-article', '/inventaris-article')
config.add_route('inventaris-articleID', '/inventaris-articleID')
config.add_route('inventaris-articleIDv2', '/inventaris-articleIDv2')
config.add_route('inventaris-articleIDfull', '/inventaris-articleIDfull')
config.add_route('inventaris-articleIDfullv2', '/inventaris-articleIDfullv2')
config.add_route('inventaris-articleIDfullv3', '/inventaris-articleIDfullv3')
config.add_route('inventaris-zoekoverzicht', '/inventaris-zoekoverzicht')
config.add_route('postregistratie', '/postregistratie')
config.add_route('postreg-aanmaken', '/postregistratie/aanmaken')
config.add_route('icons', '/icons')
config.add_route('blokken', '/blokken')
config.add_route('typo', '/typo')
config.add_route('navigation', '/navigation')
config.add_route('colors', '/colors')
config.add_route('elements', '/elements')
config.add_route('images', '/images')
config.add_route('article', '/article')
config.add_route('article9-3', '/article9-3')
config.add_route('geoportaal', '/geoportaal')
config.add_route('pinpoints', '/pinpoints')
config.add_route('401', '/401')
config.add_route('403', '/403')
config.add_route('404', '/404')
config.add_route('500', '/500')
config.add_route('atramhasismenu', '/atramhasismenu')
config.add_static_view("static", "static", cache_max_age=3600)
config.add_route("home", "/")
config.add_route("burgerprofiel", "/burgerprofiel")
config.add_route("burgerprofiel2", "/burgerprofiel2")
config.add_route("headerlinks", "/headerlinks")
config.add_route("grids", "/grids")
config.add_route("beeldbank", "/beeldbank")
config.add_route("beheersplannen", "/beheersplannen")
config.add_route("beheersplannenres", "/beheersplannen/result")
config.add_route("actorenfront", "/actorenfront")
config.add_route("detail-bedrijf", "/actorenfront/detail-bedrijf")
config.add_route("detail-bedrijfv2", "/actorenfront/detail-bedrijfv2")
config.add_route("detail", "/actorenfront/detail")
config.add_route("actorenzoek", "/actorenzoek")
config.add_route("actorenzoekdetail", "/actorenzoek/detail")
config.add_route("beeldbank-detail", "/beeldbank-detail")
config.add_route("beeldbank-zoeken", "/beeldbank-zoeken")
config.add_route("besluitendatabank", "/besluitendatabank")
config.add_route("inventaris", "/inventaris")
config.add_route("inventaris-article", "/inventaris-article")
config.add_route("inventaris-articleID", "/inventaris-articleID")
config.add_route("inventaris-articleIDv2", "/inventaris-articleIDv2")
config.add_route("inventaris-articleIDfull", "/inventaris-articleIDfull")
config.add_route("inventaris-articleIDfullv2", "/inventaris-articleIDfullv2")
config.add_route("inventaris-articleIDfullv3", "/inventaris-articleIDfullv3")
config.add_route("inventaris-zoekoverzicht", "/inventaris-zoekoverzicht")
config.add_route("postregistratie", "/postregistratie")
config.add_route("postreg-aanmaken", "/postregistratie/aanmaken")
config.add_route("icons", "/icons")
config.add_route("blokken", "/blokken")
config.add_route("typo", "/typo")
config.add_route("navigation", "/navigation")
config.add_route("colors", "/colors")
config.add_route("elements", "/elements")
config.add_route("images", "/images")
config.add_route("article", "/article")
config.add_route("article9-3", "/article9-3")
config.add_route("geoportaal", "/geoportaal")
config.add_route("pinpoints", "/pinpoints")
config.add_route("401", "/401")
config.add_route("403", "/403")
config.add_route("404", "/404")
config.add_route("500", "/500")
config.add_route("atramhasismenu", "/atramhasismenu")

includeme(config)

config.scan('pyoes.views')
config.scan("pyoes.views")
return config.make_wsgi_app()


def includeme(config):
'''
"""
Include pyoes in a pyramid application.

:param pyramid.config.Configurator config:
'''
"""

config.add_static_view('pyoes_static', 'pyoes:static')
config.scan('pyoes.static_views')
config.add_static_view("pyoes_static", "pyoes:static")
config.scan("pyoes.static_views")

return config
21 changes: 12 additions & 9 deletions pyoes/scaffolds/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
from pyramid.scaffolds import PyramidTemplate


class PyoesTemplate(PyramidTemplate):
_template_dir = 'pyoes_scaffold'
summary = 'Een scaffold om een pyramid project uit te breiden met OE stijl\
bestanden op basis van sass en compass.'
_template_dir = "pyoes_scaffold"
summary = "Een scaffold om een pyramid project uit te breiden met OE stijl\
bestanden op basis van sass en compass."


class PyoesAdminTemplate(PyramidTemplate):
_template_dir = 'pyoes_admin_scaffold'
summary = 'Een scaffold om een de admin interface van een pyramid project uit te breiden met OE stijl\
bestanden op basis van sass en compass.'
_template_dir = "pyoes_admin_scaffold"
summary = "Een scaffold om een de admin interface van een\
pyramid project uit te breiden met OE stijl\
bestanden op basis van sass en compass."


class PyoesProcesTemplate(PyramidTemplate):
_template_dir = 'pyoes_proces_scaffold'
summary = 'Een scaffold om een de proces interface van een pyramid project uit te breiden met OE stijl\
bestanden op basis van sass en compass.'
_template_dir = "pyoes_proces_scaffold"
summary = "Een scaffold om een de proces interface van een pyramid\
project uit te breiden met OE stijl\
bestanden op basis van sass en compass."
2 changes: 1 addition & 1 deletion pyoes/scripts/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#package
# package
31 changes: 14 additions & 17 deletions pyoes/static_views.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
from pyramid.view import (
view_config
)

import os

from pyramid.response import (
FileResponse
)
from pyramid.response import FileResponse
from pyramid.view import view_config


class StaticView(object):
'''
"""
Views voor aan de root gebonden static files.
'''
"""

def __init__(self, request):
self.request = request
self.here = os.path.dirname(__file__)

@view_config(name='favicon.ico')
@view_config(name="favicon.ico")
def faviconico(self):
'''
"""
View om een statische favicon.ico te kunnen serveren
'''
icon = os.path.join(self.here, 'static', 'favicon.ico')
"""
icon = os.path.join(self.here, "static", "favicon.ico")
return FileResponse(icon, request=self.request)

@view_config(name='robots.txt')
@view_config(name="robots.txt")
def robotstxt(self):
'''
"""
View om een statische robots.txt te kunnen serveren
'''
icon = os.path.join(self.here, 'static', 'robots.txt')
"""
icon = os.path.join(self.here, "static", "robots.txt")
return FileResponse(icon, request=self.request)
Loading
Loading