Skip to main content

oarepo-config

Helper library for writing a clean, high-level invenio.cfg for OARepo/Invenio-RDM based repositories. Instead of hand-assembling dozens of Flask/Invenio config constants, invenio.cfg calls a small number of configure_*() functions; each one computes a group of related settings and writes them directly into invenio.cfg's own configuration, as if you had set them by hand.

📖 Full documentation — API reference (every parameter and every Invenio variable each function sets), environment variables, call ordering, a full example, and how the package works internally.

Installation

pip install oarepo-config

It is normally pulled in transitively as part of an oarepo-app installation, but can also be used standalone. Requires Python 3.14 and oarepo[rdm,tests] 14.x (see pyproject.toml).

Quick start

# invenio.cfg
import oarepo_config as config
from invenio_i18n import lazy_gettext as _

config.initialize_i18n()

config.configure_generic_parameters(
    languages=(("cs", _("Czech")),),
)

config.configure_ui(
    code="myrepo",
    name=_("My Repository"),
    description=_("Description of my repository"),
)

config.configure_communities()
config.configure_cron()
config.configure_stats()

# Feel free to add/override plain CONFIG_VARIABLE = value assignments
# below, or wrap them with config.override_configuration() to source them
# from the environment.

Values are read from a variables/.env file or the process environment (INVENIO_*) — see Configuration sources and precedence for the loading rules, and Ordering for why the calls above are in this order.

Functions

Call these directly at module level in invenio.cfg (see how it works internally for why). Click a function for its full parameter docs and the exact list of Invenio config variables it sets.

Function What it does
initialize_i18n() Enable translated validation error messages.
initialize_glitchtip(dsn=None, deployment_version=None) Set up error reporting to Glitchtip/Sentry (optional dependency).
configure_generic_parameters(languages=..., use_path_pid_ids=False) Core infrastructure: URLs, security headers, login, database, S3, OpenSearch, Redis, Celery, secret key, default identifier/vocabulary schemes, plus the InvenioRDM security defaults meant for deployments (CSRF, shared rate limiting, DB pool, permission cache). Call this first.
configure_files(...) File upload limits, record quotas, "Download all" archive limit, and file-related toggles.
configure_ui(code=..., name=..., ...) Branding, theme, page templates, front page, analytics, and Content Security Policy (via CSP(...)).
configure_communities(communities_roles=None) Community roles and who can do what inside a community.
configure_workflows(*workflow_definitions, ...) Set up submission/review workflows from IndividualWorkflow/CommunityWorkflow definitions. Preferred over register_workflow() for most repositories.
register_workflow(workflow_code, workflow_name, permissions_policy, requests_policy) Low-level, single-workflow building block; registers one workflow directly instead of going through configure_workflows(). Warns by default recommending configure_workflows() instead - pass use_low_level_workflows=True to silence it.
configure_cron(file_integrity_check_days=None, **extra_cron_items) Scheduled background jobs (CELERY_BEAT_SCHEDULE), optionally with periodic file fixity checks.
configure_stats(enable=True, count_preview_downloads=True) Usage statistics (record views, downloads, ...).
configure_vocabulary(code, **kwargs) Declare a custom controlled vocabulary.
configure_datastreams(readers=None, writers=None, transformers=None) Register custom vocabulary-import sources.
configure_jobs(permission_policy=None, logging_level=None) Who can view "Jobs" admin logs, and how verbose they are.
configure_oai(repository_name=None, admin_emails=None, ...) OAI-PMH repository name, administrator contact and paging. Call after configure_ui().
configure_ark(default_shoulder=..., naan=..., shoulders=None, ...) ARK persistent identifiers for published records (requires oarepo-ark). Call after configure_ui().
configure_detail_sidebar(templates=None, order=None, move=None, remove=None, model=None) Add, replace, reorder or remove the boxes in the record detail sidebar, by symbolic names (details, licenses, ark, ...). Call after configure_ui() and configure_ark().
configure_einfra_oidc() "Log in with e-INFRA" (CESNET/Perun) single sign-on.
configure_llm(api_token=None, ...) LLM client(s) for oarepo-checks' AI-assisted record validation (optional dependency).
add_model(model_package_name) Register a data model for global/cross-model search.
load_configuration_variables() Read the deployment's INVENIO_... configuration values.
override_configuration(env=None) Set arbitrary config constants straight from INVENIO_<X> env vars.

Documentation

The full documentation site covers everything that doesn't fit here: the complete environment variable reference, call-ordering rules, a full production invenio.cfg example, and how the "write into invenio.cfg's globals" mechanism works internally. Build it locally with ./run.sh docs. The variable reference (docs/variables.md) is generated separately: regenerate it with .venv/bin/python scripts/mkvars.py after changing which variables a configure_*() function sets.

Metadata

Release files for oarepo-config 3.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oarepo-config 3.0.0
File Size Uploaded Provenance Actions
oarepo_config-3.0.0.tar.gz 55.4 kB Without provenance Details for oarepo_config-3.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for oarepo-config 3.0.0
File Interpreter ABI Platform Actions
oarepo_config-3.0.0-py3-none-any.whl Python 3 none any Details for oarepo_config-3.0.0-py3-none-any.whl

Total release size: 125.7 kB

Release files / oarepo_config-3.0.0.tar.gz

Download URL oarepo_config-3.0.0.tar.gz
Size 55.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7c9759f86144f57db824b28c05b874c171d9c759674e4af519b46030d95af9da
BLAKE2b-256 checksum
How to use checksums
4776d950ca4de224029e8d37f69256168f40be679a7c4fcef172c054c13ff325
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / oarepo_config-3.0.0-py3-none-any.whl

Download URL oarepo_config-3.0.0-py3-none-any.whl
Size 70.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
306539489f362659f93a36cf85edf6f9649300d517df62eddebebaedb05c5be0
BLAKE2b-256 checksum
How to use checksums
233f534d9d588cc80727cac9375e6bf4fd0899c1f196f5b08055af053862d19f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for oarepo-config 3.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page