Skip to content

Commit

Permalink
Merge pull request #11 from NatLibFi/upstream_v14.1.0
Browse files Browse the repository at this point in the history
Merge The Palace Circulation v14.1.0 into E-kirjasto
  • Loading branch information
ttuovinen authored Feb 12, 2024
2 parents 4cd2607 + e0c406f commit 1a58ee4
Show file tree
Hide file tree
Showing 405 changed files with 13,289 additions and 13,997 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: python
config-file: ./.github/codeql/config.yml

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: ".github/workflows/codeql-analysis.yml:analyze/language:python"
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Lint
on: [push, pull_request]
env:
PYTHON_VERSION: 3.9
PYTHON_VERSION: "3.10"

jobs:
lint:
Expand All @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Mypy (Type check)
on: [push, pull_request]
env:
PYTHON_VERSION: 3.9
PYTHON_VERSION: "3.10"

jobs:
mypy:
Expand All @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Python 🐍
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

Expand Down
36 changes: 32 additions & 4 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
run: sudo ethtool -K eth0 tx off rx off

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
run: sudo ethtool -K eth0 tx off rx off

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"

Expand Down Expand Up @@ -112,6 +112,34 @@ jobs:
files: ./coverage.xml
flags: migration

docker-test-migrations:
name: Docker migration test
runs-on: ubuntu-latest
permissions:
contents: read

# We want to run on external PRs, but not on our own internal PRs as they'll be run
# by the push to the branch. This prevents duplicated runs on internal PRs.
# Some discussion of this here:
# https://github.community/t/duplicate-checks-on-push-and-pull-request-simultaneous-event/18012
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0

# See comment here: https://github.com/actions/runner-images/issues/1187#issuecomment-686735760
- name: Disable network offload
run: sudo ethtool -K eth0 tx off rx off

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Test migrations
run: ./docker/ci/test_migrations.sh

docker-image-build:
name: Docker build
runs-on: ubuntu-latest
Expand Down Expand Up @@ -308,7 +336,7 @@ jobs:
if: false # Disable temporarily
name: Push circ-${{ matrix.image }}
runs-on: ubuntu-latest
needs: [test, test-migrations, docker-image-build, docker-image-test]
needs: [test, test-migrations, docker-test-migrations, docker-image-build, docker-image-test]
permissions:
contents: read
packages: write
Expand All @@ -334,7 +362,7 @@ jobs:
uses: docker/setup-buildx-action@v3

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"

Expand Down
3 changes: 1 addition & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ repos:
hooks:
- id: pyupgrade
args:
- --py38-plus
- --keep-runtime-typing
- --py310-plus

- repo: https://github.com/MarcoGorelli/absolufy-imports
rev: v0.3.0
Expand Down
66 changes: 44 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# E-kirjasto Circulation Manager

[![Test & Build](https://github.com/NatLibFi/ekirjasto-circulation/actions/workflows/test-build.yml/badge.svg)](https://github.com/NatLibFi/ekirjasto-circulation/actions/workflows/test-build.yml)

[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
![Python: 3.10,3.11](https://img.shields.io/badge/Python-3.10%20|%203.11-blue)
This is the E-kirjasto fork of the [The Palace Project](https://thepalaceproject.org) Palace Manager (which is a fork of
[Library Simplified](http://www.librarysimplified.org/) Circulation Manager).

Expand Down Expand Up @@ -284,29 +290,29 @@ export SIMPLIFIED_MAIL_SENDER=sender@example.com
As mentioned in the [pyenv](#pyenv) section, the `poetry` tool should be executed under a virtual environment
in order to guarantee that it will use the Python version you expect. To use a particular Python version,
you should create a local virtual environment in the cloned `circulation` repository directory. Assuming that
you want to use, for example, Python 3.9.9:
you want to use, for example, Python 3.11.1:

```sh
pyenv virtualenv 3.9.9 circ
pyenv virtualenv 3.11.1 circ
```

This will create a new local virtual environment called `circ` that uses Python 3.9.9. Switch to that environment:
This will create a new local virtual environment called `circ` that uses Python 3.11.1. Switch to that environment:

```sh
pyenv local circ
```

On most systems, using `pyenv` will adjust your shell prompt to indicate which virtual environment you
are now in. For example, the version of Python installed in your operating system might be `3.10.1`, but
using a virtual environment can substitute, for example, `3.9.9`:
using a virtual environment can substitute, for example, `3.11.1`:

```sh
$ python --version
Python 3.10.1

$ pyenv local circ
(circ) $ python --version
Python 3.9.9
Python 3.11.1
```

For brevity, these instructions assume that all shell commands will be executed within a virtual environment.
Expand Down Expand Up @@ -586,7 +592,7 @@ poetry install --only ci

## Testing

The Github Actions CI service runs the unit tests against Python 3.8, 3.9, 3.10, and 3.11 automatically using
The Github Actions CI service runs the unit tests against Python 3.10, and 3.11 automatically using
[tox](https://tox.readthedocs.io/en/latest/).

Tox has an environment for each python version, the module being tested, and an optional `-docker` factor that will
Expand All @@ -602,8 +608,6 @@ with service dependencies running in docker containers.

| Factor | Python Version |
| ------ | -------------- |
| py38 | Python 3.8 |
| py39 | Python 3.9 |
| py310 | Python 3.10 |
| py311 | Python 3.11 |

Expand Down Expand Up @@ -752,28 +756,46 @@ module under the hood to do the profiling.

This profiler uses [PyInstrument](https://pyinstrument.readthedocs.io/en/latest/) to profile the code.

#### Profiling tests suite

PyInstrument can also be used to profile the test suite. This can be useful to identify slow tests, or to identify
performance regressions.

To profile the core test suite, run the following command:

```sh
pyinstrument -m pytest --no-cov tests/core/
```

To profile the API test suite, run the following command:

```sh
pyinstrument -m pytest --no-cov tests/api/
```

#### Environment Variables

- `PALACE_PYINSTRUMENT`: Profiling will the enabled if this variable is set. The saved profile data will be available at
path specified in the environment variable.

- The profile data will have the extension `.pyisession`.
- The data can be accessed with the
[`pyinstrument.session.Session` class](https://pyinstrument.readthedocs.io/en/latest/reference.html#pyinstrument.session.Session).
[`pyinstrument.session.Session` class](https://pyinstrument.readthedocs.io/en/latest/reference.html#pyinstrument.session.Session).
- Example code to print details of the gathered statistics:
```python
import os
from pathlib import Path

from pyinstrument.renderers import HTMLRenderer
from pyinstrument.session import Session

path = Path(os.environ.get("PALACE_PYINSTRUMENT"))
for file in path.glob("*.pyisession"):
session = Session.load(file)
renderer = HTMLRenderer()
renderer.open_in_browser(session)
```

```python
import os
from pathlib import Path

from pyinstrument.renderers import HTMLRenderer
from pyinstrument.session import Session

path = Path(os.environ.get("PALACE_PYINSTRUMENT"))
for file in path.glob("*.pyisession"):
session = Session.load(file)
renderer = HTMLRenderer()
renderer.open_in_browser(session)
```

### Other Environment Variables

Expand Down
46 changes: 0 additions & 46 deletions alembic/versions/20230213_6f96516c7a7b_initial.py

This file was deleted.

This file was deleted.

61 changes: 0 additions & 61 deletions alembic/versions/20230412_dac99ae0c6fd_integration_status.py

This file was deleted.

Loading

0 comments on commit 1a58ee4

Please sign in to comment.