Skip to content

Commit

Permalink
#100 update backend (#123)
Browse files Browse the repository at this point in the history
* #100 update backend

* #100 review fixes
  • Loading branch information
vancamti authored Jun 19, 2024
1 parent f0ea296 commit 70ccae3
Show file tree
Hide file tree
Showing 38 changed files with 1,064 additions and 835 deletions.
13 changes: 13 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[flake8]
application_import_names = augeias, tests
exclude = .venv,
.venv2,
alembic,
.tox,
venv,
__pycache__,
docs,
fabfile.py
import-order-style = pycharm
max-line-length = 90
ignore = E402, E405, W503, F403, F405
40 changes: 40 additions & 0 deletions .github/workflows/augeias_backend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Augeias backend tests

on:
push:
paths:
- augeias/**
- tests/**
- .github/workflows/augeias_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
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
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Augeias

[![image](https://badge.fury.io/py/augeias.png)](http://badge.fury.io/py/augeias)
[![image](https://readthedocs.org/projects/augeias/badge/?version=latest)](https://readthedocs.org/projects/augeias/?badge=latest)
[![image](https://travis-ci.org/OnroerendErfgoed/augeias.png?branch=master)](https://travis-ci.org/OnroerendErfgoed/augeias)
[![image](https://coveralls.io/repos/OnroerendErfgoed/augeias/badge.svg?branch=master&service=github)](https://coveralls.io/r/OnroerendErfgoed/augeias?branch=master)
[![image](https://scrutinizer-ci.com/g/OnroerendErfgoed/augeias/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/OnroerendErfgoed/augeias/?branch=master)

Augeias. Stores your files.

Augeias is a small, RESTful, webapplication that allows you to store
digital objects in an object store. While it allows you to communicate
with you objects as a service, it also decouples the storage
implementation from the interface.

## How to work with pip-compile / pip-sync
full docs: https://pip-tools.readthedocs.io/en/latest/

First install the package:
```sh
pip install pip-tools
```

#### local development
Create a virutal environment and sync with the requirements-dev.txt file.

```sh
pip-sync requirements-dev.txt
```
This will install all the packages needed for development, including testing libraries and waitress.

Fast pip-compile
```sh
PIP_COMPILE_ARGS="-v --no-header --strip-extras --no-emit-find-links pyproject.toml"
uv pip compile $PIP_COMPILE_ARGS -o requirements.txt
uv pip compile $PIP_COMPILE_ARGS -o requirements-dev.txt --all-extras
```
19 changes: 0 additions & 19 deletions README.rst

This file was deleted.

15 changes: 10 additions & 5 deletions augeias/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,27 +50,32 @@ def includeme(config):
)
config.add_route(
"update_file_in_zip",
pattern="/collections/{collection_key}/containers/{container_key}/{object_key}/{file_name}",
pattern="/collections/{collection_key}/containers"
"/{container_key}/{object_key}/{file_name}",
request_method="PUT",
)
config.add_route(
"delete_object",
pattern="/collections/{collection_key}/containers/{container_key}/{object_key}",
pattern="/collections/{collection_key}/containers"
"/{container_key}/{object_key}",
request_method="DELETE",
)
config.add_route(
"get_object",
pattern="/collections/{collection_key}/containers/{container_key}/{object_key}",
pattern="/collections/{collection_key}/containers"
"/{container_key}/{object_key}",
request_method="GET",
)
config.add_route(
"get_object_info",
pattern="/collections/{collection_key}/containers/{container_key}/{object_key}/meta",
pattern="/collections/{collection_key}/containers"
"/{container_key}/{object_key}/meta",
request_method="GET",
)
config.add_route(
"get_file_from_zip",
pattern="/collections/{collection_key}/containers/{container_key}/{object_key}/{file_name}",
pattern="/collections/{collection_key}/containers"
"/{container_key}/{object_key}/{file_name}",
request_method="GET",
)

Expand Down
20 changes: 12 additions & 8 deletions augeias/collections/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
from augeias.stores.PairTreeFileSystemStore import PairTreeFileSystemStore


def includeme(config): # pragma: no cover
beeldbank = Collection(name='cheeses', object_store=PairTreeFileSystemStore(
os.path.expanduser('~/data/cheeses/data')))
config.registry.collections[beeldbank.name] = beeldbank

besluiten = Collection(name='trees', object_store=PairTreeFileSystemStore(
os.path.expanduser('~/data/trees/data')))
config.registry.collections[besluiten.name] = besluiten
def includeme(config): # pragma: no cover
cheeses = Collection(
name="cheeses",
object_store=PairTreeFileSystemStore(os.path.expanduser("~/data/cheeses/data")),
)
config.registry.collections[cheeses.name] = cheeses

trees = Collection(
name="trees",
object_store=PairTreeFileSystemStore(os.path.expanduser("~/data/trees/data")),
)
config.registry.collections[trees.name] = trees
4 changes: 2 additions & 2 deletions augeias/collections/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Collection:
def __init__(self, name, object_store, **kwargs):
self.object_store = object_store
self.name = name
if 'uri_generator' in kwargs:
self.uri_generator = kwargs.get('uri_generator')
if "uri_generator" in kwargs:
self.uri_generator = kwargs.get("uri_generator")
else:
self.uri_generator = DefaultUriGenerator()
6 changes: 0 additions & 6 deletions augeias/scaffolds/__init__.py

This file was deleted.

19 changes: 0 additions & 19 deletions augeias/scaffolds/augeias_scaffold/+package+/__init__.py_tmpl

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions augeias/scaffolds/augeias_scaffold/CHANGES.txt_tmpl

This file was deleted.

2 changes: 0 additions & 2 deletions augeias/scaffolds/augeias_scaffold/MANIFEST.in_tmpl

This file was deleted.

3 changes: 0 additions & 3 deletions augeias/scaffolds/augeias_scaffold/README.txt_tmpl

This file was deleted.

74 changes: 0 additions & 74 deletions augeias/scaffolds/augeias_scaffold/development.ini_tmpl

This file was deleted.

26 changes: 0 additions & 26 deletions augeias/scaffolds/augeias_scaffold/requirements-dev.txt_tmpl

This file was deleted.

4 changes: 0 additions & 4 deletions augeias/scaffolds/augeias_scaffold/requirements.txt_tmpl

This file was deleted.

Loading

0 comments on commit 70ccae3

Please sign in to comment.