Skip to content

Commit

Permalink
Fix pre-commit linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
attemoi committed Feb 1, 2024
1 parent b821e65 commit 012273a
Show file tree
Hide file tree
Showing 20 changed files with 645 additions and 500 deletions.
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ updates:
versioning-strategy: increase-if-necessary
# Ignore everything for now (and stay in pace with the upstream)
ignore:
- dependency-name: "*"
- dependency-name: "*"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
# Ignore everything for now (and stay in pace with the upstream)
ignore:
- dependency-name: "*"
- dependency-name: "*"
67 changes: 32 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,18 @@ Most distributions will offer Python packages. On Arch Linux, the following comm
pacman -S python
```

You need to install dependencies: https://devguide.python.org/getting-started/setup-building/#build-dependencies
You need to install dependencies: <https://devguide.python.org/getting-started/setup-building/#build-dependencies>

Enable Source Packages:
Uncomment a deb-src in `/etc/apt/sources.list` e.g. `jammy main`

Install build dependencies:

```sh
$ sudo apt-get update
$ sudo apt-get build-dep python3
$ sudo apt-get install pkg-config
$ sudo apt install libxmlsec1 libxmlsec1-dev
sudo apt-get update
sudo apt-get build-dep python3
sudo apt-get install pkg-config
sudo apt install libxmlsec1 libxmlsec1-dev
```

#### pyenv (Optional)
Expand Down Expand Up @@ -169,20 +169,20 @@ a storage service, you can set the following environment variables:
public access to the files.
- `PALACE_STORAGE_ANALYTICS_BUCKET`: Required if you want to use the storage service to store analytics data.
- `PALACE_STORAGE_ACCESS_KEY`: The access key (optional).
- If this key is set it will be passed to boto3 when connecting to the storage service.
- If it is not set boto3 will attempt to find credentials as outlined in their
- If this key is set it will be passed to boto3 when connecting to the storage service.
- If it is not set boto3 will attempt to find credentials as outlined in their
[documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html#configuring-credentials).
- `PALACE_STORAGE_SECRET_KEY`: The secret key (optional).
- `PALACE_STORAGE_REGION`: The AWS region of the storage service (optional).
- `PALACE_STORAGE_ENDPOINT_URL`: The endpoint of the storage service (optional). This is used if you are using a
s3 compatible storage service like [minio](https://min.io/).
- `PALACE_STORAGE_URL_TEMPLATE`: The url template to use when generating urls for files stored in the storage service
(optional).
- The default value is `https://{bucket}.s3.{region}.amazonaws.com/{key}`.
- The following variables can be used in the template:
- `{bucket}`: The name of the bucket.
- `{key}`: The key of the file.
- `{region}`: The region of the storage service.
- The default value is `https://{bucket}.s3.{region}.amazonaws.com/{key}`.
- The following variables can be used in the template:
- `{bucket}`: The name of the bucket.
- `{key}`: The key of the file.
- `{region}`: The region of the storage service.

#### Reporting

Expand All @@ -207,8 +207,8 @@ the logging:
- `PALACE_LOG_CLOUDWATCH_INTERVAL`: The interval in seconds to send logs to CloudWatch. Default is `60`.
- `PALACE_LOG_CLOUDWATCH_CREATE_GROUP`: Whether to create the log group if it does not exist. Default is `true`.
- `PALACE_LOG_CLOUDWATCH_ACCESS_KEY`: The access key to use when sending logs to CloudWatch. This is optional.
- If this key is set it will be passed to boto3 when connecting to CloudWatch.
- If it is not set boto3 will attempt to find credentials as outlined in their
- If this key is set it will be passed to boto3 when connecting to CloudWatch.
- If it is not set boto3 will attempt to find credentials as outlined in their
[documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html#configuring-credentials).
- `PALACE_LOG_CLOUDWATCH_SECRET_KEY`: The secret key to use when sending logs to CloudWatch. This is optional.

Expand Down Expand Up @@ -258,7 +258,7 @@ Local analytics are enabled by default. S3 analytics can be enabled via the foll

- PALACE_S3_ANALYTICS_ENABLED: A boolean value to disable or enable s3 analytics. The default is false.

## OpenSearch Analytics (E-Kirjasto, Finland)
#### OpenSearch Analytics (E-Kirjasto, Finland)

OpenSearch analytics can be enabled via the following environment variables:

Expand All @@ -268,8 +268,6 @@ OpenSearch analytics can be enabled via the following environment variables:

#### Email

### Email sending

To use the features that require sending emails, for example to reset the password for logged-out users, you will need
to have a working SMTP server and set some environment variables:

Expand Down Expand Up @@ -713,7 +711,7 @@ enabled by setting environment variables while starting the application.
- `PALACE_XRAY_NAME`: The name of the service shown in x-ray for these traces.
- `PALACE_XRAY_ANNOTATE_`: Any environment variable starting with this prefix will be added to to the trace as an
annotation.
- For example setting `PALACE_XRAY_ANNOTATE_KEY=value` will set the annotation `key=value` on all xray traces sent
- For example setting `PALACE_XRAY_ANNOTATE_KEY=value` will set the annotation `key=value` on all xray traces sent
from the application.
- `PALACE_XRAY_INCLUDE_BARCODE`: If this environment variable is set to `true` then the tracing code will try to include
the patrons barcode in the user parameter of the trace, if a barcode is available.
Expand Down Expand Up @@ -759,24 +757,23 @@ This profiler uses [PyInstrument](https://pyinstrument.readthedocs.io/en/latest/
- `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
- 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).
- 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)
```
- 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)
```

### Other Environment Variables

Expand Down
2 changes: 1 addition & 1 deletion api/admin/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from functools import wraps

import flask
from flask import Response, make_response, redirect, url_for, request
from flask import Response, make_response, redirect, request, url_for
from flask_pydantic_spec import FileResponse as SpecFileResponse
from flask_pydantic_spec import Request as SpecRequest
from flask_pydantic_spec import Response as SpecResponse
Expand Down
2 changes: 1 addition & 1 deletion api/authenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
from api.authentication.basic_token import BasicTokenAuthenticationProvider
from api.config import CannotLoadConfiguration, Configuration
from api.custom_patron_catalog import CustomPatronCatalog
from api.ekirjasto_authentication import EkirjastoAuthenticationAPI # Finland
from api.integration.registry.patron_auth import PatronAuthRegistry
from api.problem_details import *
from api.ekirjasto_authentication import EkirjastoAuthenticationAPI # Finland
from core.analytics import Analytics
from core.integration.goals import Goals
from core.integration.registry import IntegrationRegistry
Expand Down
4 changes: 2 additions & 2 deletions api/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@
from api.circulation import CirculationAPI
from api.circulation_exceptions import *
from api.config import CannotLoadConfiguration, Configuration
from api.ekirjasto_controller import EkirjastoController # Finland
from api.opensearch_analytics_search import OpenSearchAnalyticsSearch # Finland
from api.custom_index import CustomIndexView
from api.ekirjasto_controller import EkirjastoController # Finland
from api.lanes import (
ContributorFacets,
ContributorLane,
Expand All @@ -52,6 +51,7 @@
from api.model.time_tracking import PlaytimeEntriesPost, PlaytimeEntriesPostResponse
from api.odl import ODLAPI
from api.odl2 import ODL2API
from api.opensearch_analytics_search import OpenSearchAnalyticsSearch # Finland
from api.problem_details import *
from api.saml.controller import SAMLController
from core.analytics import Analytics
Expand Down
Loading

0 comments on commit 012273a

Please sign in to comment.