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

#856 update 312 requirments #867

Merged
merged 8 commits into from
Jun 14, 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
42 changes: 42 additions & 0 deletions .github/workflows/atramhasis_backend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Atramhasis backend tests

on:
push:
paths:
- atramhasis/**
- scripts/**
- tests/**
- '!atramhasis/static/**'
- .github/workflows/atramhasis_backend.yaml
- pyproject.toml
- requirements*.txt

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.10", "3.11", "3.12" ]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# You can test your matrix by printing the current Python version
- name: Display Python version
run: python -c "import sys; print(sys.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
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions atramhasis/data/datamanagers.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def find(self, conceptscheme_id, query):
"""
db_query = (
select(Thing)
.options(joinedload('labels'))
.options(joinedload(Thing.labels))
.filter(Thing.conceptscheme_id == conceptscheme_id)
)
if 'type' in query and query['type'] in ['concept', 'collection']:
Expand Down Expand Up @@ -127,7 +127,7 @@ def get_all(self, conceptscheme_id):
"""
all_results = self.session.execute(
select(Thing)
.options(joinedload('labels'))
.options(joinedload(Thing.labels))
.filter(Thing.conceptscheme_id == conceptscheme_id)
).unique().scalars().all()
return all_results
Expand Down
6 changes: 3 additions & 3 deletions atramhasis/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1138,9 +1138,6 @@ components:

Provider:
type: object
required:
- conceptscheme_uri
- uri_pattern
properties:
id:
type: string
Expand Down Expand Up @@ -1189,6 +1186,9 @@ components:
type: object
additionalProperties: true
nullable: true
required:
- conceptscheme_uri
- uri_pattern
Error:
type: object
required:
Expand Down
15 changes: 6 additions & 9 deletions atramhasis/views/exception_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
import logging
import sys

from openapi_core.unmarshalling.schemas.exceptions import InvalidSchemaValue
from openapi_core.validation.schemas.exceptions import InvalidSchemaValue
from pyramid.httpexceptions import HTTPMethodNotAllowed
from pyramid.view import notfound_view_config
from pyramid.view import view_config
from pyramid_openapi3 import RequestValidationError
from pyramid_openapi3 import ResponseValidationError
from pyramid_openapi3 import extract_errors
from pyramid_openapi3 import openapi_validation_error
from skosprovider.exceptions import ProviderUnavailableException
from sqlalchemy.exc import IntegrityError
Expand Down Expand Up @@ -117,17 +118,13 @@ def failed_openapi_validation(exc, request):
# noinspection PyTypeChecker
errors.extend(
[
str(error)
for error in exc.errors
if not isinstance(error, InvalidSchemaValue)
f'{error.get("field")}: {error.get("message")}'
for error in
list(extract_errors(request, exc.errors))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alle methods hieronder kunnen wrs weg.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deze snap ik niet helemaal. op lijn 113 wordt die _handle_validation_error nog gebruikt en dat is de enige method die onder deze code staat ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ja, ik was dom

]
)
request.response.status_int = 400
if isinstance(exc, RequestValidationError):
subject = "Request"
else:
subject = "Response"
return {"message": f"{subject} was not valid for schema.", "errors": errors}
return {"message": "Request was not valid for schema.", "errors": errors}
except Exception:
log.exception("Issue with exception handling.")
return openapi_validation_error(exc, request)
Expand Down
13 changes: 4 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ requires = ["hatchling", "hatch-fancy-pypi-readme"]
build-backend = "hatchling.build"

[project]
version = "0.0.1"
version = "2.0.0"
name = "atramhasis"
dynamic = ["readme"]
authors = [
{ name = "Flanders Heritage Agency", email = "ict@onroerenderfgoed.be" },
]
#license = "GPL-3.0-or-later"
description = "A web based editor for thesauri adhering to the SKOS specification."
requires-python = ">=3.9,<3.12"
requires-python = ">=3.10,<3.13"
keywords = ["web", "wsgi", "pyramid", "SKOS", "thesaurus", "vocabulary"]
classifiers = [
"Development Status :: 5 - Production/Stable",
Expand All @@ -26,7 +26,7 @@ classifiers = [
dependencies = [
"pyramid",
"pyramid_tm",
"SQLAlchemy<2.0.0,>=1.4.0",
"SQLAlchemy",
"transaction",
"zope.sqlalchemy",
"skosprovider",
Expand All @@ -48,12 +48,7 @@ dependencies = [
"python-dateutil",
"rdflib",
"bleach",
# Openapi stack
"pyramid_openapi3>=0.16.0,<0.17.0",
"openapi-core>=0.16.6,<0.17.0",
"openapi-schema-validator>=0.4.4,<0.5.0",
"openapi-spec-validator>=0.5.6,<0.6.0",
"jsonschema>=4.17.0,<5.0.0", # Does follow semantic versioning -- safe
"pyramid_openapi3==0.19",
]

[project.urls]
Expand Down
26 changes: 0 additions & 26 deletions requirements-dev-base.txt

This file was deleted.

Loading
Loading