Commit Graph

551 Commits

Author SHA1 Message Date
Alan Orth 964d5dff06
Version 1.4.2 2021-04-15 14:23:07 +03:00
Alan Orth a9252d1771
Update requirements-dev.txt
Generated with poetry export:

    $ 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-04-15 14:19:48 +03:00
Alan Orth a63687d516
poetry.lock: Run poetry update 2021-04-15 14:17:17 +03:00
Alan Orth 73dc3a292e
README.md: Remove TODO about Swagger
continuous-integration/drone/push Build is passing Details
I added the SwaggerUI interface a few months ago.
2021-04-06 20:28:10 +03:00
Alan Orth 1e742bad41
CHANGELOG.md: Add note about valid page tests
continuous-integration/drone/push Build is passing Details
2021-04-06 09:07:51 +03:00
Alan Orth 164008981e
CHANGELOG.md: Add notes about Falcon 3.0.0
continuous-integration/drone/push Build is passing Details
2021-04-06 08:58:00 +03:00
Alan Orth dd1769b954
tests: Fix totalPages
A few months ago I fixed the totalPages display to show 1 when we
only have one page of results (the page itself is still 0), but I
didn't update the tests.

See: 4f8cd1097b
2021-04-06 08:54:54 +03:00
Alan Orth b009820fb4
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
2021-04-06 08:32:22 +03:00
Alan Orth 9830295978
poetry.lock: Run poetry update 2021-04-06 08:31:50 +03:00
Alan Orth c93a4d7455
pyproject.toml: Falcon 3.0.0
Release notes: https://falcon.readthedocs.io/en/latest/changes/3.0.0.html
2021-04-06 08:31:39 +03:00
Alan Orth 2f8e4f8a0a Changes for Falcon 3.0.0
Mostly it seems we just need to use resp.text instead of resp.body,
including in falcon-swagger-ui (I forked the upstream one to make
this change).

See: https://falcon.readthedocs.io/en/latest/changes/3.0.0.html
2021-04-06 08:30:28 +03:00
Alan Orth 0650c5985e
Add SPDX short license identifier to all Python files
continuous-integration/drone/push Build is passing Details
See: https://spdx.github.io/spdx-spec/appendix-V-using-SPDX-short-identifiers-in-source-files/
2021-03-22 13:42:42 +02:00
Alan Orth d814f1c4f0
CHANGELOG.md: Fix heading
continuous-integration/drone/push Build is passing Details
2021-03-21 19:50:39 +02:00
Alan Orth 00f30591c4
CHANGELOG.md: Add notes about GitHub Actions 2021-03-21 19:49:35 +02:00
Alan Orth acfe87b91a
Add GitHub Actions badge and remove sr.ht
continuous-integration/drone/push Build is passing Details
2021-03-21 11:48:05 +02:00
Alan Orth bc6d84dda2 Add GitHub Actions workflow
My first time setting up a PostgreSQL service container on GitHub
actions. Note that there are two different kinds of environment
variables: those passed to the Docker container, and those used by
the PostgreSQL utilities.

See: https://docs.github.com/en/actions/guides/creating-postgresql-service-containers
See: https://hub.docker.com/_/postgres
2021-03-21 11:44:39 +02:00
Alan Orth 889fb2f74a
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-03-21 08:59:41 +02:00
Alan Orth c42cd7a818
poetry.lock: Run poetry update 2021-03-21 08:59:04 +02:00
Alan Orth f8bba59d66
.gitignore: Ignore .egg-info
continuous-integration/drone/push Build is passing Details
2021-03-14 21:50:47 +02:00
Alan Orth b8cb752a29
CHANGELOG.md: Add note about updated poetry deps
continuous-integration/drone/push Build is passing Details
2021-03-11 11:23:18 +02:00
Alan Orth 09496aa2b5
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
2021-03-11 11:22:05 +02:00
Alan Orth ff5dc7506d
poetry.lock: Run poetry update 2021-03-11 11:21:02 +02:00
Alan Orth 80a11ead97
Version 1.4.1
continuous-integration/drone/push Build is passing Details
2021-01-14 14:19:50 +02:00
Alan Orth a282c95933
CHANGELOG.md: Minor syntax fix 2021-01-14 14:15:57 +02:00
Alan Orth fd7cc36306
Update requirements-dev.txt
Generated with poetry export:

    $ 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-01-14 14:14:16 +02:00
Alan Orth a20ff09570
poetry.lock: Run poetry update
All tests still pass.
2021-01-14 14:13:32 +02:00
Alan Orth fdc0e73088
tests: Sort imports with isort 2021-01-14 14:12:59 +02:00
Alan Orth b15afc9f39
CHANGELOG.md: Add note about UUIDs
continuous-integration/drone/push Build is passing Details
2021-01-05 12:41:21 +02:00
Alan Orth 2bc18ef719
README.md: Make a note about migrating UUIDs 2021-01-05 12:35:23 +02:00
Alan Orth 49751b53f0
dspace_statistics_api/indexer.py: Limit to UUIDs
We need to make sure that the indexer only tries to index UUIDs, as
opposed to legacy IDs that may have been left over from a migration
from earlier DSpace versions. For example, "98110-unmigrated", "-1"
etc.

For matching the UUIDs in Solr I decided that it is sufficient for
our use case to simply match thirty-six characters, where a UUID is
composed of thirty-two hexadecimal characters and four dashes. We
don't need to do any verification of "real" UUIDs because it would
be needlessly complex in our case.

See: https://github.com/ilri/dspace-statistics-api/issues/12
2021-01-05 12:30:27 +02:00
Alan Orth d1c177e146
.drone.yml: Add git to python container
continuous-integration/drone/push Build is passing Details
Now that I am installing my own fork of falcon-swagger-ui we need
to have git so we can install it with pip.
2020-12-27 14:22:23 +02:00
Alan Orth 33dc210452
dspace_statistics_api/docs/openapi.json: Minor edit
Better to leave the version in there because Swagger Editor doesn't
like it without. Also, change the example page parameter for POSTing
to /items and /collections, as it doesn't make sense to start on a
later page if we have less items than our limit.
2020-12-27 13:53:59 +02:00
Alan Orth 282d5f644a
Move unreleased change to v1.4.0 2020-12-27 12:52:24 +02:00
Alan Orth 05e0e8bdca
openapi.json: Set the API version from config
We don't need to hard code this in the JSON anymore since we are
reading and modifying it now for the server config anyways.
2020-12-27 12:48:13 +02:00
Alan Orth 2567bb8604
dspace_statistics_api/app.py: Format with black 2020-12-27 12:27:01 +02:00
Alan Orth 4af3c656a3
CHANGELOG.md: Add note about totalPages 2020-12-27 12:26:32 +02:00
Alan Orth 4f8cd1097b
Rework paging
The "totalPages" value in our response is calculated incorrectly.
Instead of casting to int and rounding, we should rather round up
to the next integer with math.ceil. This is a more correct way to
get the value.

Also update the indexer to use the same logic, although there the
values are printed with +1 so they are more readable.
2020-12-27 12:22:07 +02:00
Alan Orth a02211fd60
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
2020-12-25 13:03:32 +02:00
Alan Orth fc814593c7
Use my fork of falcon-swagger-ui
It has a newer Swagger UI (v3.38.0).
2020-12-25 12:57:58 +02:00
Alan Orth 7de1084f60
Add whitespace before vim modeline
continuous-integration/drone/push Build is passing Details
black wants this...
2020-12-24 13:12:06 +02:00
Alan Orth 6b78e82fe9
Add vim modeline to all tests 2020-12-24 13:11:12 +02:00
Alan Orth 4004515967
pyproject.toml: Update description
continuous-integration/drone/push Build is passing Details
2020-12-23 16:15:46 +02:00
Alan Orth d1229c2387
Adjust docs at root
Don't use a static HTML file anymore. Now I simply print an XHTML
page from the Falcon resource. This way I can use variables to add
in the API version as well as a link to the Swagger UI.

The list of API calls is still present on the README.md, though in
the long run I might move them to some dedicated documentation or
a GitHub wiki.
2020-12-23 16:12:50 +02:00
Alan Orth be83514de1
Re-work Swagger UI configuration
continuous-integration/drone/push Build is passing Details
It turns out that Swagger UI mostly does the "right" thing for our
use cases here, but it assumes that API paths are relative to the
root of the host where it is being served. This works in the local
development environment because we are serving on "/", but it does
not work in production where the API is deployed beneath the DSpace
REST API, for example at "/rest/statistics".

The solution here is to allow configuration of the DSpace Statistics
API path and use that when registering the Swagger UI as well as in
a new "server" block in the OpenAPI JSON schema.

By default it is configured to work out of the box in a development
environment. Set the DSPACE_STATISTICS_API_URL environment variable
to something like "/rest/statistics" when running in production.
2020-12-23 13:25:17 +02:00
Alan Orth 70b2ba83ba
Allow configuration of Swagger and OpenAPI JSON URL
continuous-integration/drone/push Build is passing Details
When running in production your statistics API might be deployed to
a path like /rest/statistics instead of at the root.
2020-12-22 12:50:03 +02:00
Alan Orth 893039bc6a
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
2020-12-22 12:07:07 +02:00
Alan Orth a4628dde4e
Update requirements
Generated with poetry export:

    $ poetry export -f requirements.txt > requirements.txt
    $ poetry export --dev -f requirements.txt > requirements-dev.txt
2020-12-22 11:45:39 +02:00
Alan Orth 68418ea053
dspace_statistics_api/docs/openapi.json: Add /status
Add a /status to the Swagger UI schema.
2020-12-22 11:41:47 +02:00
Alan Orth 6bbee7919e
Bump version to 1.4.0-dev 2020-12-22 11:31:46 +02:00
Alan Orth 8f0061ce29
CHANGELOG.md: Add note about the /status page 2020-12-22 11:30:50 +02:00