Compare commits

...

100 Commits
v1.4.2 ... v6_x

Author SHA1 Message Date
Alan Orth 1912363899
Merge pull request #42 from ilri/renovate/pytest-7.x-lockfile
continuous-integration/drone/push Build is passing Details
Update dependency pytest to v7.4.4
2024-01-05 16:53:21 +03:00
Alan Orth cd3c024a77
Merge pull request #44 from ilri/renovate/flake8-7.x
Update dependency flake8 to v7
2024-01-05 16:53:03 +03:00
renovate[bot] e96c79bf2c
Update dependency flake8 to v7
continuous-integration/drone/push Build is passing Details
2024-01-05 01:26:48 +00:00
renovate[bot] d6330c7bd4
Update dependency pytest to v7.4.4
continuous-integration/drone/push Build is passing Details
2023-12-31 12:49:30 +00:00
Alan Orth 8c7a5c4047
Merge pull request #40 from ilri/renovate/isort-5.x-lockfile
continuous-integration/drone/push Build is passing Details
Update dependency isort to v5.13.2
2023-12-28 09:22:24 +03:00
Alan Orth a31c592fab
Merge pull request #41 from ilri/renovate/black-23.x-lockfile
Update dependency black to v23.12.1
2023-12-28 09:22:01 +03:00
renovate[bot] c7b179f1b5
Update dependency black to v23.12.1
continuous-integration/drone/push Build is passing Details
2023-12-23 00:02:01 +00:00
renovate[bot] 77c166c024
Update dependency isort to v5.13.2
continuous-integration/drone/push Build is passing Details
2023-12-13 23:34:34 +00:00
Alan Orth 7680b0f440
.github: update workflow
continuous-integration/drone/push Build is passing Details
- actions/checkout@v4
- actions/setup-python@v5
- python-version: '3.11'
2023-12-09 13:58:01 +03:00
Alan Orth e70a7a9675
Apply fixes from fixit
RewriteToLiteral: It's slower to call list() than using the empty literal
2023-12-09 13:57:55 +03:00
Alan Orth 24f90df13e
pyprojecy.toml: use new group syntax
poetry wants us to use `poetry add --group=dev` now, which generates
this syntax in the toml.
2023-12-09 13:57:45 +03:00
Alan Orth 780f2c1723
pyproject.toml: add fixit to dev dependencies 2023-12-09 13:57:31 +03:00
Alan Orth 53b58d4116
Merge pull request #38 from ilri/renovate/falcon-3.x
continuous-integration/drone/push Build is passing Details
Update dependency falcon to v3.1.3
2023-12-05 16:36:50 +03:00
renovate[bot] 19a6d2cea6
Update dependency falcon to v3.1.3
continuous-integration/drone/push Build is passing Details
2023-12-05 07:14:40 +00:00
Alan Orth 6c2bcda16f
Merge pull request #37 from ilri/renovate/black-23.x-lockfile
continuous-integration/drone/push Build is passing Details
Update dependency black to v23.11.0
2023-11-22 19:37:07 +03:00
renovate[bot] e4d9545b02
Update dependency black to v23.11.0
continuous-integration/drone/push Build is passing Details
2023-11-08 07:30:58 +00:00
Alan Orth 1f507d3074
Merge pull request #33 from ilri/renovate/actions-checkout-4.x
continuous-integration/drone/push Build is passing Details
Update actions/checkout action to v4
2023-10-25 12:22:47 +03:00
Alan Orth 82771d7b0c
Merge pull request #32 from ilri/renovate/psycopg2-2.x-lockfile
Update dependency psycopg2 to v2.9.9
2023-10-25 12:21:47 +03:00
Alan Orth 5ff3323f88
Merge pull request #31 from ilri/renovate/flake8-6.x-lockfile
Update dependency flake8 to v6.1.0
2023-10-25 12:20:32 +03:00
Alan Orth c7a871c2f1
Merge pull request #36 from ilri/renovate/gunicorn-21.x-lockfile
Update dependency gunicorn to v21.2.0
2023-10-25 12:20:15 +03:00
renovate[bot] b948283d40
Update dependency gunicorn to v21.2.0
continuous-integration/drone/push Build is passing Details
2023-10-25 09:12:04 +00:00
Alan Orth 124a05dcaf
Merge pull request #30 from ilri/renovate/gunicorn-21.x
continuous-integration/drone/push Build is passing Details
Update dependency gunicorn to v21
2023-10-25 12:11:21 +03:00
Alan Orth a2daf96fec
Merge pull request #29 from ilri/renovate/black-23.x-lockfile
Update dependency black to v23.10.1
2023-10-25 12:10:47 +03:00
Alan Orth 8634d53fa6
Merge pull request #28 from ilri/renovate/pytest-7.x-lockfile
Update dependency pytest to v7.4.3
2023-10-25 12:10:11 +03:00
renovate[bot] e2bfcef573
Update dependency pytest to v7.4.3
continuous-integration/drone/push Build is passing Details
2023-10-24 21:18:17 +00:00
renovate[bot] d64c4b8cbc
Update dependency black to v23.10.1
continuous-integration/drone/push Build is passing Details
2023-10-23 19:46:06 +00:00
renovate[bot] 3d91366412
Update actions/checkout action to v4
continuous-integration/drone/push Build is passing Details
2023-10-19 11:02:08 +00:00
renovate[bot] c3a4e2260b
Update dependency psycopg2 to v2.9.9
continuous-integration/drone/push Build is passing Details
2023-10-03 14:20:02 +00:00
renovate[bot] 10519997ac
Update dependency flake8 to v6.1.0
continuous-integration/drone/push Build is failing Details
2023-07-29 21:45:38 +00:00
renovate[bot] 4d7e9e9401
Update dependency gunicorn to v21
continuous-integration/drone/push Build is failing Details
2023-07-17 21:23:15 +00:00
Alan Orth fe9f98bcc0
dspace_statistics_api/util.py: format with black
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details
2023-05-30 16:04:18 +03:00
Alan Orth 70f0d66c6e
poetry.lock: run poetry update 2023-05-30 16:03:51 +03:00
Alan Orth 913596c61d
pyproject.toml: bump flake8 2023-05-30 16:03:35 +03:00
Alan Orth 7cd762a5a2
Merge pull request #24 from ilri/renovate/black-23.x
continuous-integration/drone/push Build is passing Details
Update dependency black to v23
2023-05-30 11:26:12 +03:00
renovate[bot] 3811be18ef
Update dependency black to v23 2023-05-30 08:22:19 +00:00
Alan Orth a52818271c
Merge pull request #26 from ilri/renovate/pytest-7.x
Update dependency pytest to v7
2023-05-30 11:21:39 +03:00
renovate[bot] b643f60dd7
Update dependency pytest to v7 2023-05-30 08:08:39 +00:00
Alan Orth 7cec9a9545
Merge pull request #27 from ilri/renovate/postgres-15.x
Update postgres Docker tag to v15
2023-05-30 11:07:00 +03:00
renovate[bot] a9302506b6
Update postgres Docker tag to v15 2023-05-30 08:01:58 +00:00
Alan Orth b980602a03
Update requirements
Generated with poetry export:

    $ poetry export --without-hashes -f requirements.txt > requirements.txt
    $ poetry export --without-hashes --dev -f requirements.txt > requirements-dev.txt

The `--without-hashes` is required to work around an issue with
gunicorn pulling in a dependency on setuptools that poetry ignores.

See: https://github.com/python-poetry/poetry/issues/1584
2023-05-30 11:00:46 +03:00
Alan Orth a4b4843036
poetry.lock: run poetry update 2023-05-30 11:00:09 +03:00
Alan Orth 7e334f6de8
Recommend Python 3.8+
I'm only using Python 3.8+ anyways, and 3.7 is end of life as of
next month. Some deps start wanting Python 3.8 so let's just bump
it.
2023-05-30 10:23:10 +03:00
Alan Orth 770f676fb5
Use PostgreSQL 14 for Drone CI and GitHub Actions 2023-05-30 10:14:47 +03:00
Alan Orth 6d5e3c350d
Remove .hound.yml
I haven't used this in years and now we have automatic tests via
GitHub Actions.
2023-05-30 10:14:06 +03:00
Alan Orth 531136183b
pyproject.toml: rework isort and black deps
We no longer need to gatekeep these for Python 3.6+, as all my dev
systems are running Python 3.11 and all my production systems are
running Python 3.8+.
2023-05-30 10:09:47 +03:00
Alan Orth 1a3d0350a5
.github/workflows: update GitHub Action workflow
We can use Poetry directly rather than installing deps with pip.
2023-05-30 09:39:00 +03:00
Alan Orth 25c4f05f16
Add renovate.json
Disable management of requirements.txt since I am using poetry.
2023-05-30 08:11:28 +03:00
Alan Orth 9fba8d1b81
Migrate isort config to pyproject.toml
continuous-integration/drone/push Build is failing Details
See: https://pycqa.github.io/isort/docs/configuration/black_compatibility.html
2022-12-20 15:13:44 +02:00
Alan Orth 568ced0f20
poetry.lock: run poetry update 2022-12-20 15:12:50 +02:00
Alan Orth 9cd93c9034 Update requirements
continuous-integration/drone/push Build is failing Details
Generated with poetry export:

    $ poetry export --without-hashes -f requirements.txt > requirements.txt
    $ poetry export --without-hashes --with dev -f requirements.txt > requirements-dev.txt

The `--without-hashes` is required to work around an issue with
gunicorn pulling in a dependency on setuptools that poetry ignores.

See: https://github.com/python-poetry/poetry/issues/1584
2022-11-21 10:51:43 +03:00
Alan Orth 83a2625987 CHANGELOG.md: add note about falcon 3.1.1 2022-11-21 10:51:43 +03:00
Alan Orth f591ed7162 Use falcon v3.1.1
Bug fix release with support for Python 3.11.

See: https://falcon.readthedocs.io/en/3.1.1/changes/3.1.1.html
2022-11-21 10:51:43 +03:00
Alan Orth bb0f267941
.github: use ubuntu-22.04 for actions
continuous-integration/drone/push Build is passing Details
Apparently 'ubuntu-latest' is still 20.04 and today is 2022-10-03,
which seems a bit old!

See: https://github.com/actions/runner-images
2022-10-03 19:57:56 +03:00
Alan Orth 0720605b6a
.github: update actions
Switch to newer checkout and setup-python actions, and enable the
pip cache for setup-python.
2022-10-03 19:43:41 +03:00
Alan Orth bcb97d025c
CHANGELOG.md: add note about PostgreSQL 12
continuous-integration/drone/push Build is passing Details
2022-05-31 13:05:41 +03:00
Alan Orth 0ff8490275
Use PostgreSQL 12 in CI
I migrated my production systems to PostgreSQL 12 months ago.
2022-05-31 13:05:01 +03:00
Alan Orth 0a8ac60ade
Update requirements
continuous-integration/drone/push Build is passing Details
Generated with poetry export:

    $ poetry export --without-hashes -f requirements.txt > requirements.txt
    $ poetry export --without-hashes --dev -f requirements.txt > requirements-dev.txt

The `--without-hashes` is required to work around an issue with
gunicorn pulling in a dependency on setuptools that poetry ignores.

See: https://github.com/python-poetry/poetry/issues/1584
2022-03-28 16:01:39 +03:00
Alan Orth 37527c21be
poetry.lock: run poetry update 2022-03-28 16:01:13 +03:00
Alan Orth eb660f8085
CHANGELOG.md: add note about Python version
continuous-integration/drone/push Build is passing Details
2022-03-28 15:16:02 +03:00
Alan Orth e7d780f511
Don't test on Python 3.6 anymore
Python 3.6 is deprecated in Falcon 3.1.0 and all of our production
and development hosts are running Python 3.8+ now.
2022-03-28 15:13:54 +03:00
Alan Orth c3b9a541b7
Bump version to 1.4.4-dev
continuous-integration/drone/push Build is passing Details
2022-03-26 19:10:47 +03:00
Alan Orth 1a1a14a25f
Version 1.4.3 2022-03-26 19:08:56 +03:00
Alan Orth c09fc789e8
Update requirements
Generated with poetry export:

    $ poetry export --without-hashes -f requirements.txt > requirements.txt
    $ poetry export --without-hashes --dev -f requirements.txt > requirements-dev.txt

The `--without-hashes` is required to work around an issue with
gunicorn pulling in a dependency on setuptools that poetry ignores.

See: https://github.com/python-poetry/poetry/issues/1584
2022-03-26 19:06:54 +03:00
Alan Orth 134a4f1595
poetry.lock: run poetry update 2022-03-26 18:50:31 +03:00
Alan Orth 12ebd1aed5
pyproject.toml: falcon 3.1.0
Doesn't seem to have any breaking changes, only fixes and some new
compatability updates with new Pythons.

See: https://falcon.readthedocs.io/en/stable/changes/3.1.0.html
2022-03-26 18:49:33 +03:00
Alan Orth e5f3201b65
Update requirements
continuous-integration/drone/push Build is passing Details
Generated with poetry export:

    $ poetry export --without-hashes -f requirements.txt > requirements.txt
    $ poetry export --without-hashes --dev -f requirements.txt > requirements-dev.txt

The `--without-hashes` is required to work around an issue with
gunicorn pulling in a dependency on setuptools that poetry ignores.

See: https://github.com/python-poetry/poetry/issues/1584
2022-03-21 15:19:00 +03:00
Alan Orth c1ce4fe233
poetry.lock: run poetry update 2022-03-21 15:18:27 +03:00
Alan Orth b2eb1878a5
.github/workflows/python-app.yml: quote python version
continuous-integration/drone/push Build is passing Details
2022-01-30 18:57:10 +03:00
Alan Orth a0213c1c97
poetry.lock: run poetry update
continuous-integration/drone/push Build is passing Details
2022-01-30 13:52:20 +03:00
Alan Orth cd03ca2b36
Update requirements
Generated with poetry export:

    $ poetry export --without-hashes -f requirements.txt > requirements.txt
    $ poetry export --without-hashes --dev -f requirements.txt > requirements-dev.txt

The `--without-hashes` is required to work around an issue with
gunicorn pulling in a dependency on setuptools that poetry ignores.

See: https://github.com/python-poetry/poetry/issues/1584
2022-01-30 13:50:49 +03:00
Alan Orth c48e6a79c7
pyproject.toml: update dependencies
We no longer need ipython because it's installed globally on all
my machines. Also, new major version of flake8 and black is no
longer a beta.
2022-01-30 13:49:36 +03:00
Alan Orth a2e1695ecc
Update requirements
continuous-integration/drone/push Build is passing Details
Generated with poetry export:

    $ poetry export --without-hashes -f requirements.txt > requirements.txt
    $ poetry export --without-hashes --dev -f requirements.txt > requirements-dev.txt

The `--without-hashes` is required to work around an issue with
gunicorn pulling in a dependency on setuptools that poetry ignores.

See: https://github.com/python-poetry/poetry/issues/1584
2021-12-19 14:18:42 +02:00
Alan Orth b683bf211c
.github/workflows/python-app.yml: use Python 3.10 2021-12-19 14:15:41 +02:00
Alan Orth 3ab48743d6
poetry.lock: run poetry update 2021-12-19 14:13:14 +02:00
Alan Orth 88173eaae9
README.md: fix link to actions
continuous-integration/drone/push Build is passing Details
2021-12-08 11:34:50 +02:00
Alan Orth f557d33f36
README.md: adjust intro
Use intro style from Python Black! This makes it easier to have the
badges displayed without wrapping and looks nicer.
2021-12-08 09:48:31 +02:00
Alan Orth ffc4ff4a5c
Update requirements
continuous-integration/drone/push Build is failing Details
Generated with poetry export:

    $ poetry export --without-hashes -f requirements.txt > requirements.txt
    $ poetry export --without-hashes --dev -f requirements.txt > requirements-dev.txt

The `--without-hashes` is required to work around an issue with
gunicorn pulling in a dependency on setuptools that poetry ignores.

See: https://github.com/python-poetry/poetry/issues/1584
2021-11-11 09:05:37 +02:00
Alan Orth 7551b34632
poetry.lock: run poetry update
This was previously failing for the past few days.
2021-11-11 09:05:03 +02:00
Alan Orth 5e71ec10eb
Remove pipenv
Poetry's working again.
2021-11-11 09:04:30 +02:00
Alan Orth f80d360cf9
Only install ipython on Python 3.7+
continuous-integration/drone/push Build is passing Details
2021-11-10 09:21:59 +02:00
Alan Orth e70b59ecfe
Update requirements
continuous-integration/drone/push Build is failing Details
Generated with pipenv lock:

    $ pipenv lock -r > requirements.txt
    $ pipenv lock -r --dev > requirements-dev.txt
2021-11-09 22:52:21 +02:00
Alan Orth 4d0828b6c0
Add Pipenv configuration
I was having a problem with Poetry.
2021-11-09 22:51:23 +02:00
Alan Orth dabc4c0259
pyproject.toml: revert to my fork of falcon-swagger-ui
The Falcon 3 fix never actually got committed to rdidyik's fork. I
have submitted a new pull request and will use my fork until it is
merged.

See: https://github.com/rdidyk/falcon-swagger-ui/pull/21
2021-11-09 22:09:11 +02:00
Alan Orth 4fd8af07c3
.drone.yml: Fix job name 2021-11-09 17:36:48 +02:00
Alan Orth 4c5326a176
Update requirements
continuous-integration/drone/push Build is failing Details
Generated with poetry export:

    $ poetry export --without-hashes -f requirements.txt > requirements.txt
    $ poetry export --without-hashes --dev -f requirements.txt > requirements-dev.txt

The `--without-hashes` is required to work around an issue with
gunicorn pulling in a dependency on setuptools that poetry ignores.

See: https://github.com/python-poetry/poetry/issues/1584
2021-10-21 15:07:26 +03:00
Alan Orth 3b1ccafab4
poetry.lock: Run poetry update 2021-10-21 15:06:19 +03:00
Alan Orth 58b5ae82d3
pyproject.toml: Switch back to falcon-swagger-ui upstream
They merged my changes for Falcon 3.0.

See: https://github.com/rdidyk/falcon-swagger-ui/pull/20
2021-10-21 15:04:58 +03:00
Alan Orth 562aaeef7d
.drone.yml: Test on Python 3.10
continuous-integration/drone/push Build is failing Details
2021-10-11 20:11:32 +03:00
Alan Orth 5cdba6acb1
.drone.yml: Also install gcc for all Python containers
continuous-integration/drone/push Build is passing Details
We previously only needed gcc for typed-ast in Python 3.9, but now
we actually need gcc to compile psycopg2 in all of them.
2021-07-06 16:44:13 +03:00
Alan Orth dd0937179c
.drone.yml: Add libpq-dev to test container
continuous-integration/drone/push Build was killed Details
We need it to compile the psycopg2 Python library.
2021-07-06 16:41:17 +03:00
Alan Orth f0c6c004db
Update requirements
continuous-integration/drone/push Build is failing Details
Generated with poetry export:

    $ poetry export --without-hashes -f requirements.txt > requirements.txt
    $ poetry export --without-hashes --dev -f requirements.txt > requirements-dev.txt

The `--without-hashes` is required to work around an issue with
gunicorn pulling in a dependency on setuptools that poetry ignores.

See: https://github.com/python-poetry/poetry/issues/1584
2021-07-06 16:27:23 +03:00
Alan Orth 6843f0a8ac
poetry.lock: Run poetry update 2021-07-06 16:26:33 +03:00
Alan Orth f5fcfcc05a
pyproject.toml: Update psycopg2 version
I manually re-installed psycopg2@latest while troubleshooting an
issue with it not working after Arch Linux updated Python. That's
one down side of using the non-binary package.
2021-07-06 16:26:05 +03:00
Alan Orth e8ac74b6d1
pyproject.toml: Update some dev dependencies 2021-07-06 16:17:22 +03:00
Alan Orth 14fc14daee
Update requirements
continuous-integration/drone/push Build is failing Details
Generated with poetry export:

    $ poetry export --without-hashes -f requirements.txt > requirements.txt
    $ poetry export --without-hashes --dev -f requirements.txt > requirements-dev.txt

The `--without-hashes` is required to work around an issue with
gunicorn pulling in a dependency on setuptools that poetry ignores.

See: https://github.com/python-poetry/poetry/issues/1584
2021-06-22 20:53:07 +03:00
Alan Orth 871aae537a
poetry.lock: Sync changes 2021-06-22 20:52:15 +03:00
Alan Orth 2fada6c6ff
pyproject.toml: Use psycopg2 instead of psycopg2-binary
continuous-integration/drone/push Build is passing Details
According to the documentation the binary version is not meant to
be run in production. Since I'm in control of both my development
and production servers and can ensure that libpq-dev is installed
on both, I will use the source version of this module.

See: https://www.psycopg.org/docs/install.html#quick-install
2021-06-22 17:49:49 +03:00
Alan Orth ef0991e352
Update requirements
continuous-integration/drone/push Build is passing Details
Generated with poetry export:

    $ poetry export --without-hashes -f requirements.txt > requirements.txt
    $ poetry export --without-hashes --dev -f requirements.txt > requirements-dev.txt

The `--without-hashes` is required to work around an issue with
gunicorn pulling in a dependency on setuptools that poetry ignores.

See: https://github.com/python-poetry/poetry/issues/1584
2021-06-22 10:11:57 +03:00
Alan Orth 4502d6053c
poetry.lock: run poetry update
The following packages were updated:

> markupsafe (2.0.0 -> 2.0.1)
> certifi (2020.12.5 -> 2021.5.30)
> click (8.0.0 -> 8.0.1)
> decorator (5.0.7 -> 5.0.9)
> jinja2 (3.0.0 -> 3.0.1)
> prompt-toolkit (3.0.18 -> 3.0.19)
> urllib3 (1.26.4 -> 1.26.5)
> ipython (7.23.1 -> 7.24.1)
> psycopg2-binary (2.8.6 -> 2.9.1)
2021-06-22 10:10:29 +03:00
Alan Orth a524068cf6
Bump version to 1.4.3-dev
continuous-integration/drone/push Build is passing Details
2021-04-15 14:44:44 +03:00
15 changed files with 735 additions and 947 deletions

View File

@ -1,10 +1,49 @@
kind: pipeline
type: docker
name: python310
steps:
- name: setup
image: postgres:15-alpine
environment:
PGPASSWORD: postgres
commands:
- id
- psql --version
- sleep 5
- pg_isready -h database -U postgres -d dspacestatistics
- createuser -h database -U postgres dspacestatistics
- psql -h database -U postgres -c "ALTER USER dspacestatistics WITH PASSWORD 'dspacestatistics'"
- psql -h database -U postgres -d dspacestatistics < tests/dspacestatistics.sql
- name: test
image: python:3.10-slim
environment:
PGPASSWORD: dspacestatistics
DATABASE_HOST: database
commands:
- id
- python -V
- apt update && apt install -y gcc git libpq-dev
- pip install -r requirements-dev.txt
- pytest
services:
- name: database
image: postgres:15-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: dspacestatistics
---
kind: pipeline
type: docker
name: python39
steps:
- name: setup
image: postgres:10-alpine
image: postgres:15-alpine
environment:
PGPASSWORD: postgres
commands:
@ -24,13 +63,13 @@ steps:
commands:
- id
- python -V
- apt update && apt install -y gcc git
- apt update && apt install -y gcc git libpq-dev
- pip install -r requirements-dev.txt
- pytest
services:
- name: database
image: postgres:10-alpine
image: postgres:15-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
@ -43,7 +82,7 @@ name: python38
steps:
- name: database
image: postgres:10-alpine
image: postgres:15-alpine
detach: true
environment:
POSTGRES_USER: postgres
@ -51,7 +90,7 @@ steps:
POSTGRES_DB: dspacestatistics
- name: setup
image: postgres:10-alpine
image: postgres:15-alpine
environment:
PGPASSWORD: postgres
commands:
@ -71,85 +110,7 @@ steps:
commands:
- id
- python -V
- apt update && apt install -y git
- pip install -r requirements-dev.txt
- pytest
---
kind: pipeline
type: docker
name: python37
steps:
- name: database
image: postgres:10-alpine
detach: true
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: dspacestatistics
- name: setup
image: postgres:10-alpine
environment:
PGPASSWORD: postgres
commands:
- id
- psql --version
- sleep 5
- pg_isready -h database -U postgres -d dspacestatistics
- createuser -h database -U postgres dspacestatistics
- psql -h database -U postgres -c "ALTER USER dspacestatistics WITH PASSWORD 'dspacestatistics'"
- psql -h database -U postgres -d dspacestatistics < tests/dspacestatistics.sql
- name: test
image: python:3.7-slim
environment:
PGPASSWORD: dspacestatistics
DATABASE_HOST: database
commands:
- id
- python -V
- apt update && apt install -y git
- pip install -r requirements-dev.txt
- pytest
---
kind: pipeline
type: docker
name: python36
steps:
- name: database
image: postgres:10-alpine
detach: true
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: dspacestatistics
- name: setup
image: postgres:10-alpine
environment:
PGPASSWORD: postgres
commands:
- id
- psql --version
- sleep 5
- pg_isready -h database -U postgres -d dspacestatistics
- createuser -h database -U postgres dspacestatistics
- psql -h database -U postgres -c "ALTER USER dspacestatistics WITH PASSWORD 'dspacestatistics'"
- psql -h database -U postgres -d dspacestatistics < tests/dspacestatistics.sql
- name: test
image: python:3.6-slim
environment:
PGPASSWORD: dspacestatistics
DATABASE_HOST: database
commands:
- id
- python -V
- apt update && apt install -y git
- apt update && apt install -y gcc git libpq-dev
- pip install -r requirements-dev.txt
- pytest

View File

@ -8,11 +8,11 @@ on: ['push', 'pull_request']
jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
services:
database:
image: postgres:10-alpine
image: postgres:15-alpine
env:
# password for postgres user in the Docker container
POSTGRES_PASSWORD: postgres
@ -27,23 +27,20 @@ jobs:
- 5432:5432
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
python-version: '3.11'
cache: 'poetry'
- run: poetry install
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Set up PostgreSQL
run: |
pg_isready -U postgres -d dspacestatistics
@ -55,7 +52,7 @@ jobs:
PGPASSWORD: postgres
- name: Test with pytest
run: |
pytest
poetry run pytest
env:
PGHOST: localhost
PGPASSWORD: dspacestatistics

View File

@ -1,4 +0,0 @@
flake8:
enabled: true
config_file: .flake8
fail_on_violations: true

View File

@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Changed
- Update recommended Python version to 3.7+
- Use PostgreSQL 12 in CI
### Updated
- Falcon 3.1.1
## 1.4.3 - 2022-03-26
### Updated
- Update dependencies with `poetry update`
- Falcon 3.1.0, a minor change for us, but good to be using a current upstream
version
## 1.4.2 - 2021-04-14
### Updated
- Update dependencies with `poetry update`

View File

@ -1,4 +1,11 @@
# DSpace Statistics API [![Build Status](https://ci.mjanja.ch/api/badges/alanorth/dspace-statistics-api/status.svg?ref=refs/heads/v6_x)](https://ci.mjanja.ch/alanorth/dspace-statistics-api) [![Build and Test](https://github.com/ilri/dspace-statistics-api/actions/workflows/python-app.yml/badge.svg)](https://github.com/ilri/dspace-statistics-api/actions/workflows/python-app.yml)
<h1 align="center">DSpace Statistics API</h1>
<p align="center">
<a href="https://ci.mjanja.ch/alanorth/dspace-statistics-api"><img alt="Build Status" src="https://ci.mjanja.ch/api/badges/alanorth/dspace-statistics-api/status.svg?ref=refs/heads/v6_x"></a>
<a href="https://github.com/ilri/dspace-statistics-api/actions"><img alt="Build and Test" src="https://github.com/ilri/dspace-statistics-api/actions/workflows/python-app.yml/badge.svg"></a>
<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
</p>
DSpace stores item view and download events in a Solr "statistics" core. This information is available for use in the various DSpace user interfaces, but is not exposed externally via any APIs. The DSpace 4/5/6 [REST API](https://wiki.lyrasis.org/display/DSDOC5x/REST+API), for example, only exposes _metadata_ about communities, collections, items, and bitstreams.
- If your DSpace is version 4 or 5, use [dspace-statistics-api v1.1.1](https://github.com/ilri/dspace-statistics-api/releases/tag/v1.1.1)
@ -13,7 +20,7 @@ If you use the DSpace Statistics API please cite:
## Requirements
- Python 3.6+
- Python 3.8+
- PostgreSQL version 9.5+ (due to [`UPSERT` support](https://wiki.postgresql.org/wiki/UPSERT))
- DSpace with [Solr usage statistics enabled](https://wiki.lyrasis.org/display/DSDOC5x/SOLR+Statistics) (tested with 5.8+ and 6.3)

View File

@ -90,7 +90,7 @@ class AllStatisticsResource:
)
# create a list to hold dicts of stats
statistics = list()
statistics = []
# iterate over results and build statistics object
for result in cursor:
@ -162,7 +162,7 @@ class AllStatisticsResource:
)
# create a list to hold dicts of stats
statistics = list()
statistics = []
# iterate over views dict to extract views and use the element id as an
# index to the downloads dict to extract downloads.

View File

@ -18,6 +18,6 @@ DATABASE_PORT = os.environ.get("DATABASE_PORT", "5432")
# the vanilla DSpace REST API.
DSPACE_STATISTICS_API_URL = os.environ.get("DSPACE_STATISTICS_API_URL", "")
VERSION = "1.4.2"
VERSION = "1.4.4-dev"
# vim: set sw=4 ts=4 expandtab:

View File

@ -1,7 +1,7 @@
{
"openapi": "3.0.3",
"info": {
"version": "1.4.2",
"version": "1.4.4-dev",
"title": "DSpace Statistics API",
"description": "A [Falcon-based](https://falcon.readthedocs.io/) web application to make DSpace's item, community, and collection statistics available via a simple REST API. This Swagger interface is powered by [falcon-swagger-ui](https://github.com/rdidyk/falcon-swagger-ui).",
"license": {
@ -613,4 +613,4 @@
}
}
}
}
}

View File

@ -62,7 +62,6 @@ def get_statistics_shards():
def is_valid_date(date):
try:
# Solr date format is: 2020-01-01T00:00:00Z
# See: https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior
@ -141,7 +140,7 @@ def validate_post_parameters(req, resp, resource, params):
description=f'The "{req.context.statistics_scope}" parameter is invalid. The value must be a comma-separated list of UUIDs.',
)
else:
req.context.elements = list()
req.context.elements = []
def set_statistics_scope(req, resp, resource, params):

1334
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +1,29 @@
[tool.poetry]
name = "dspace-statistics-api"
version = "1.4.2"
version = "1.4.4-dev"
description = "A simple REST API to expose Solr view and download statistics for items, communities, and collections in a DSpace repository."
authors = ["Alan Orth <aorth@mjanja.ch>"]
license = "GPL-3.0-only"
[tool.poetry.dependencies]
python = "^3.6"
gunicorn = "^20.0.4"
falcon = "3.0.0"
psycopg2-binary = "^2.8.6"
python = "^3.8.1"
gunicorn = "^21.0.0"
falcon = "3.1.3"
psycopg2 = "^2.9.1"
requests = "^2.24.0"
falcon-swagger-ui = {git = "https://github.com/alanorth/falcon-swagger-ui.git", rev="falcon-300b1"}
falcon-swagger-ui = {git = "https://github.com/alanorth/falcon-swagger-ui.git", rev="falcon3-update-swagger-ui"}
[tool.poetry.dev-dependencies]
ipython = { version = "^7.18.1", python = "^3.7" }
flake8 = "^3.8.4"
pytest = "^6.1.1"
isort = "^5.5.4"
black = "^20.8b1"
[tool.poetry.group.dev.dependencies]
black = "^23.0.0"
fixit = "^2.1.0"
flake8 = "^7.0.0"
isort = "^5.9.1"
pytest = "^7.0.0"
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
[tool.isort]
profile = "black"
line_length=88

9
renovate.json Normal file
View File

@ -0,0 +1,9 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
],
"pip_requirements": {
"enabled": false
}
}

View File

@ -1,51 +1,33 @@
appdirs==1.4.4; python_version >= "3.6"
appnope==0.1.2; python_version >= "3.7" and python_version < "4.0" and sys_platform == "darwin"
atomicwrites==1.4.0; python_version >= "3.6" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.6" and python_full_version >= "3.4.0"
attrs==20.3.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
backcall==0.2.0; python_version >= "3.7" and python_version < "4.0"
black==20.8b1; python_version >= "3.6"
certifi==2020.12.5; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
chardet==4.0.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
click==7.1.2; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
colorama==0.4.4; python_version >= "3.7" and python_full_version < "3.0.0" and python_version < "4.0" and sys_platform == "win32" or python_version >= "3.7" and python_version < "4.0" and sys_platform == "win32" and python_full_version >= "3.5.0"
dataclasses==0.8; python_version >= "3.6" and python_version < "3.7"
decorator==5.0.7; python_version >= "3.7" and python_version < "4.0"
falcon-swagger-ui @ git+https://github.com/alanorth/falcon-swagger-ui.git@falcon-300b1
falcon==3.0.0; python_version >= "3.5"
flake8==3.9.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
gunicorn==20.1.0; python_version >= "3.5"
idna==2.10; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
importlib-metadata==3.10.1; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "3.8" or python_full_version >= "3.5.0" and python_version < "3.8" and python_version >= "3.6"
iniconfig==1.1.1; python_version >= "3.6"
ipython-genutils==0.2.0; python_version >= "3.7" and python_version < "4.0"
ipython==7.22.0; python_version >= "3.7" and python_version < "4.0"
isort==5.8.0; python_version >= "3.6" and python_version < "4.0"
jedi==0.18.0; python_version >= "3.7" and python_version < "4.0"
jinja2==2.11.3; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
markupsafe==1.1.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
mccabe==0.6.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
mypy-extensions==0.4.3; python_version >= "3.6"
packaging==20.9; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
parso==0.8.2; python_version >= "3.7" and python_version < "4.0"
pathspec==0.8.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
pexpect==4.8.0; python_version >= "3.7" and python_version < "4.0" and sys_platform != "win32"
pickleshare==0.7.5; python_version >= "3.7" and python_version < "4.0"
pluggy==0.13.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
prompt-toolkit==3.0.18; python_version >= "3.7" and python_version < "4.0" and python_full_version >= "3.6.1"
psycopg2-binary==2.8.6; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
ptyprocess==0.7.0; python_version >= "3.7" and python_version < "4.0" and sys_platform != "win32"
py==1.10.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
pycodestyle==2.7.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
pyflakes==2.3.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
pygments==2.8.1; python_version >= "3.7" and python_version < "4.0"
pyparsing==2.4.7; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
pytest==6.2.3; python_version >= "3.6"
regex==2021.4.4; python_version >= "3.6"
requests==2.25.1; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
toml==0.10.2; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.6"
traitlets==5.0.5; python_version >= "3.7" and python_version < "4.0"
typed-ast==1.4.3; python_version >= "3.6"
typing-extensions==3.7.4.3; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "3.8" or python_full_version >= "3.5.0" and python_version < "3.8" and python_version >= "3.6"
urllib3==1.26.4; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version < "4"
wcwidth==0.2.5; python_version >= "3.7" and python_version < "4.0" and python_full_version >= "3.6.1"
zipp==3.4.1; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "3.8" or python_full_version >= "3.5.0" and python_version < "3.8" and python_version >= "3.6"
atomicwrites==1.4.1 ; python_version >= "3.8" and python_version < "4.0" and sys_platform == "win32"
attrs==23.1.0 ; python_version >= "3.8" and python_version < "4.0"
black==22.12.0 ; python_version >= "3.8" and python_version < "4.0"
certifi==2023.5.7 ; python_version >= "3.8" and python_version < "4.0"
charset-normalizer==3.1.0 ; python_version >= "3.8" and python_version < "4.0"
click==8.1.3 ; python_version >= "3.8" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.8" and python_version < "4.0" and (sys_platform == "win32" or platform_system == "Windows")
falcon-swagger-ui @ git+https://github.com/alanorth/falcon-swagger-ui.git@falcon3-update-swagger-ui ; python_version >= "3.8" and python_version < "4.0"
falcon==3.1.1 ; python_version >= "3.8" and python_version < "4.0"
flake8==4.0.1 ; python_version >= "3.8" and python_version < "4.0"
gunicorn==20.1.0 ; python_version >= "3.8" and python_version < "4.0"
idna==3.4 ; python_version >= "3.8" and python_version < "4.0"
iniconfig==2.0.0 ; python_version >= "3.8" and python_version < "4.0"
isort==5.12.0 ; python_version >= "3.8" and python_version < "4.0"
jinja2==3.1.2 ; python_version >= "3.8" and python_version < "4.0"
markupsafe==2.1.2 ; python_version >= "3.8" and python_version < "4.0"
mccabe==0.6.1 ; python_version >= "3.8" and python_version < "4.0"
mypy-extensions==1.0.0 ; python_version >= "3.8" and python_version < "4.0"
packaging==23.1 ; python_version >= "3.8" and python_version < "4.0"
pathspec==0.11.1 ; python_version >= "3.8" and python_version < "4.0"
platformdirs==3.5.1 ; python_version >= "3.8" and python_version < "4.0"
pluggy==1.0.0 ; python_version >= "3.8" and python_version < "4.0"
psycopg2==2.9.6 ; python_version >= "3.8" and python_version < "4.0"
py==1.11.0 ; python_version >= "3.8" and python_version < "4.0"
pycodestyle==2.8.0 ; python_version >= "3.8" and python_version < "4.0"
pyflakes==2.4.0 ; python_version >= "3.8" and python_version < "4.0"
pytest==6.2.5 ; python_version >= "3.8" and python_version < "4.0"
requests==2.31.0 ; python_version >= "3.8" and python_version < "4.0"
setuptools==67.8.0 ; python_version >= "3.8" and python_version < "4.0"
toml==0.10.2 ; python_version >= "3.8" and python_version < "4.0"
tomli==2.0.1 ; python_version >= "3.8" and python_full_version < "3.11.0a7"
typing-extensions==4.6.2 ; python_version >= "3.8" and python_version < "3.10"
urllib3==2.0.2 ; python_version >= "3.8" and python_version < "4.0"

View File

@ -1,11 +1,12 @@
certifi==2020.12.5; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
chardet==4.0.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
falcon-swagger-ui @ git+https://github.com/alanorth/falcon-swagger-ui.git@falcon-300b1
falcon==3.0.0; python_version >= "3.5"
gunicorn==20.1.0; python_version >= "3.5"
idna==2.10; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
jinja2==2.11.3; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
markupsafe==1.1.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
psycopg2-binary==2.8.6; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
requests==2.25.1; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
urllib3==1.26.4; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version < "4"
certifi==2023.5.7 ; python_version >= "3.8" and python_version < "4.0"
charset-normalizer==3.1.0 ; python_version >= "3.8" and python_version < "4.0"
falcon-swagger-ui @ git+https://github.com/alanorth/falcon-swagger-ui.git@falcon3-update-swagger-ui ; python_version >= "3.8" and python_version < "4.0"
falcon==3.1.1 ; python_version >= "3.8" and python_version < "4.0"
gunicorn==20.1.0 ; python_version >= "3.8" and python_version < "4.0"
idna==3.4 ; python_version >= "3.8" and python_version < "4.0"
jinja2==3.1.2 ; python_version >= "3.8" and python_version < "4.0"
markupsafe==2.1.2 ; python_version >= "3.8" and python_version < "4.0"
psycopg2==2.9.6 ; python_version >= "3.8" and python_version < "4.0"
requests==2.31.0 ; python_version >= "3.8" and python_version < "4.0"
setuptools==67.8.0 ; python_version >= "3.8" and python_version < "4.0"
urllib3==2.0.2 ; python_version >= "3.8" and python_version < "4.0"

View File

@ -1,6 +0,0 @@
[isort]
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=0
use_parentheses=True
line_length=88