Skip to content

Commit

Permalink
Merge pull request #99 from OnroerendErfgoed/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
claeyswo authored Jul 4, 2024
2 parents bfabf55 + 246c0d7 commit 92e8088
Show file tree
Hide file tree
Showing 14 changed files with 299 additions and 126 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/urihandler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: urihandler backend tests

on:
workflow_dispatch:

pull_request:
paths:
- urihandler/**
- .github/workflows/urihandler.yaml
- scripts/**
- pyproject.toml
- requirements*.txt
- tests/**

push:
branches:
- main
env:
PYTHON_VERSION: '3.11'

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install python requirements
env:
HATCH_BUILD_NO_HOOKS: true
working-directory: ./
run: |
pip --version
pip install pip-tools
pip-sync requirements-dev.txt
pip install -e .
- name: Python tests
run: pytest tests --exitfirst --capture=no -vvv --full-trace
18 changes: 10 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
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: 22.3.0
rev: 24.3.0
hooks:
- id: black
types: [python]
- repo: https://gitlab.com/PyCQA/flake8
rev: 4.0.1
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.1'
]
additional_dependencies:
- flake8-import-order==0.18.2
- flake8-bugbear==24.2.6
types: [python]
args: [--max-line-length=90]
exclude: docs
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
1.3.0 (04-07-2024)
------------------

- Update backend + async workers (#97)

1.2.0 (25-04-2023)
------------------

Expand Down
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# UriHandler

[![image](https://badge.fury.io/py/urihandler.png)](http://badge.fury.io/py/urihandler)
[![image](https://travis-ci.org/OnroerendErfgoed/urihandler.png?branch=master)](https://travis-ci.org/OnroerendErfgoed/urihandler)
[![image](https://coveralls.io/repos/OnroerendErfgoed/urihandler/badge.png?branch=master)](https://coveralls.io/r/OnroerendErfgoed/urihandler)

This very simple application is meant to be the handler on a domain that
handles Cool Uri\'s (<http://www.w3.org/TR/cooluris/>) with 303
redirects.

All it does is map Uri\'s to other uri\'s and redirect them. To make
thing easy you can either redirect by hitting the full URI (eg.
[http://id.example.com/foo/15]{.title-ref}) or by querying a handle
service (eg.
[http://id.example.com/handle?uri=http://id.example.com/foo/15]{.title-ref}).
Both of these will redirect you. The handle service also works for
non-http URI\'s. Finally, there\'s a service that just returns
information without performing a redirect, eg.
[http://id.example.com/uris?uri=http://id.example.com/foo/15]{.title-ref}.
This can be handy to bypass some of the strangeness that happens when
you combine Cool uri\'s with CORS and custom HTTP headers.

Configuration is done by editing a YAML file. For each URI you need to
register a regex and a redirect template. The regex should use named
placeholders, as well as the redirect string. An optional argument
[mount]{.title-ref} determines if your [match]{.title-ref} is living at
the server root or is absolute (eg. because it\'s a URN). Not setting
[mount]{.title-ref} sets it to [True]{.title-ref}.
29 changes: 0 additions & 29 deletions README.rst

This file was deleted.

65 changes: 65 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
version = "1.3.0"
name = "urihandler"
dynamic = ["readme"]
authors = [
{ name = "Flanders Heritage Agency", email = "[email protected]" },
]
description = "A tiny application that handles (cool) uri's."
requires-python = ">=3.10,<3.13"
keywords = ["web", "wsgi", "pyramid", "SKOS", "thesaurus", "vocabulary"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python",
"Framework :: Pyramid",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"pyramid==2.0.2",
"pyyaml==6.0.1"
]

[project.urls]
History = "https://github.com/OnroerendErfgoed/urihandler/blob/master/CHANGES.rst"
Tracker = "https://github.com/OnroerendErfgoed/urihandler/issues"
Source = "https://github.com/OnroerendErfgoed/urihandler"
Documentation = "https://urihandler.readthedocs.io/en/latest/"

[project.optional-dependencies]
dev = [
"black==24.4.2",
"coveralls==4.0.1",
"flake8-import-order==0.18.2",
"flake8==7.1.0",
"pre-commit==3.7.1",
"pyramid_debugtoolbar==4.12.1",
"pytest-cov==5.0.0",
"pytest==8.2.2",
"waitress==3.0.0",
"webtest==3.0.0"
]

[project.entry-points."paste.app_factory"]
main = "urihandler:main"

##
# Build tool specific
##
[tool.hatch.build.targets.wheel]
# In the wheel we want to have urihandler in the root as python module.
only-include = [
"/urihandler",
]

[tool.hatch.metadata]
# This allows us to use github links as dependencies
allow-direct-references = true

132 changes: 111 additions & 21 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,112 @@
# Runtime requirements
--requirement requirements.txt

waitress==2.1.2
pyramid_debugtoolbar==4.9

#testing
pytest==7.1.2
pytest-cov==3.0.0
beautifulsoup4==4.12.3
# via webtest
black==24.4.2
certifi==2024.6.2
# via requests
cfgv==3.4.0
# via pre-commit
charset-normalizer==3.3.2
# via requests
click==8.1.7
# via black
coverage==7.5.3
# via
# coveralls
# pytest-cov
coveralls==4.0.1
distlib==0.3.8
# via virtualenv
docopt==0.6.2
# via coveralls
filelock==3.15.1
# via virtualenv
flake8==7.1.0
flake8-import-order==0.18.2
hupper==1.12.1
# via pyramid
identify==2.5.36
# via pre-commit
idna==3.7
# via requests
iniconfig==2.0.0
# via pytest
mako==1.3.5
# via pyramid-mako
markupsafe==2.1.5
# via mako
mccabe==0.7.0
# via flake8
mypy-extensions==1.0.0
# via black
nodeenv==1.9.1
# via pre-commit
packaging==24.1
# via
# black
# pytest
pastedeploy==3.1.0
# via plaster-pastedeploy
pathspec==0.12.1
# via black
plaster==1.1.2
# via
# plaster-pastedeploy
# pyramid
plaster-pastedeploy==1.0.1
# via pyramid
platformdirs==4.2.2
# via
# black
# virtualenv
pluggy==1.5.0
# via pytest
pre-commit==3.7.1
pycodestyle==2.12.0
# via
# flake8
# flake8-import-order
pyflakes==3.2.0
# via flake8
pygments==2.18.0
# via pyramid-debugtoolbar
pyramid==2.0.2
# via
# pyramid-debugtoolbar
# pyramid-mako
pyramid-debugtoolbar==4.12.1
pyramid-mako==1.1.0
# via pyramid-debugtoolbar
pytest==8.2.2
# via pytest-cov
pytest-cov==5.0.0
pyyaml==6.0.1
# via pre-commit
requests==2.32.3
# via coveralls
setuptools==70.0.0
# via
# flake8-import-order
# pyramid
# zope-deprecation
# zope-interface
soupsieve==2.5
# via beautifulsoup4
translationstring==1.4
# via pyramid
urllib3==2.2.2
# via requests
venusian==3.1.0
# via pyramid
virtualenv==20.26.2
# via pre-commit
waitress==3.0.0
# via webtest
webob==1.8.7
# via
# pyramid
# webtest
webtest==3.0.0
coveralls==3.3.1

# Wheel
wheel==0.38.1

# Linting
flake8==4.0.1
flake8-import-order==0.18.1
black==22.3.0

# Pre-commit
pre-commit==2.19.0
zope-deprecation==5.0
# via pyramid
zope-interface==6.4.post2
# via pyramid
29 changes: 27 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,27 @@
pyramid==2.0
PyYAML==6.0
hupper==1.12.1
# via pyramid
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
pyyaml==6.0.1
setuptools==70.0.0
# via
# pyramid
# zope-deprecation
# zope-interface
translationstring==1.4
# via pyramid
venusian==3.1.0
# via pyramid
webob==1.8.7
# via pyramid
zope-deprecation==5.0
# via pyramid
zope-interface==6.4.post2
# via pyramid
Loading

0 comments on commit 92e8088

Please sign in to comment.