Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump major #2940

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 5 additions & 23 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 CERN.
# Copyright (C) 2024 Graz University of Technology.
#
# Invenio App RDM is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.
Expand All @@ -14,26 +15,7 @@ on:

jobs:
build-n-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel babel

- name: Build package
run: |
python setup.py compile_catalog sdist bdist_wheel

- name: Publish
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.pypi_token }}
uses: inveniosoftware/workflows/.github/workflows/pypi-publish.yml@master
secrets: inherit
with:
babel-compile-catalog: true
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
Changes
=======

Version 13.0.0b2.dev0 (released 2024-12-16)

- setup: remove flask pin
- setup: change to reusable workflows
- setup: bump major dependencies

Version v13.0.0b1.dev24 (released 2024-12-10)

- fix: meta: add missing HighWire authors
Expand Down
2 changes: 1 addition & 1 deletion invenio_app_rdm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
#
# See PEP 0440 for details - https://www.python.org/dev/peps/pep-0440

__version__ = "13.0.0b1.dev24"
__version__ = "13.0.0b2.dev0"

__all__ = ("__version__",)
13 changes: 13 additions & 0 deletions invenio_app_rdm/ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ def finalize_app(app):

def init_config(app):
"""Initialize configuration."""
record_doi_required = (
app.config["RDM_PERSISTENT_IDENTIFIERS"].get("doi", {}).get("required")
)
parent_doi_required = (
app.config["RDM_PARENT_PERSISTENT_IDENTIFIERS"].get("doi", {}).get("required")
)

if record_doi_required != parent_doi_required:
raise Exception(
"Config variables RDM_PERSISTENT_IDENTIFIERS.doi.required and "
"RDM_PARENT_PERSISTENT_IDENTIFIERS.doi.required must be set to the same value."
)

if "COMMUNITIES_GROUPS_ENABLED" in app.config:
warnings.warn(
"COMMUNITIES_GROUPS_ENABLED config variable is deprecated. Please use USERS_RESOURCES_GROUPS_ENABLED "
Expand Down
21 changes: 13 additions & 8 deletions invenio_app_rdm/fixtures/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from invenio_access.permissions import system_identity
from invenio_db import db
from invenio_pages.proxies import current_pages_service
from invenio_pages.records.errors import PageNotFoundError
from invenio_rdm_records.fixtures.fixture import FixtureMixin


Expand Down Expand Up @@ -45,11 +46,15 @@ def page_data(self, page):

def create(self, entry):
"""Load a single page."""
data = {
"url": entry.pop("url"),
"title": entry.get("title"),
"content": self.page_data(entry.get("template")),
"description": entry.get("description"),
"template_name": current_app.config["PAGES_DEFAULT_TEMPLATE"],
}
current_pages_service.create(system_identity, data)
url = entry["url"]
try:
current_pages_service.read_by_url(system_identity, url)
except PageNotFoundError:
data = {
"url": url,
"title": entry.get("title", ""),
"content": self.page_data(entry["template"]),
"description": entry.get("description", ""),
"template_name": current_app.config["PAGES_DEFAULT_TEMPLATE"],
}
current_pages_service.create(system_identity, data)
60 changes: 51 additions & 9 deletions invenio_app_rdm/records_ui/views/deposits.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ def get_form_pids_config():
continue
record_pid_config = current_app.config["RDM_PERSISTENT_IDENTIFIERS"]
scheme_label = record_pid_config.get(scheme, {}).get("label", scheme)
is_doi_required = record_pid_config.get(scheme, {}).get("required")
default_selected = (
record_pid_config.get(scheme, {}).get("ui", {}).get("default_selected")
)
if is_doi_required and default_selected == "not_needed":
default_selected = "yes"
pids_provider = {
"scheme": scheme,
"field_label": "Digital Object Identifier",
Expand All @@ -82,6 +88,7 @@ def get_form_pids_config():
"A {scheme_label} allows your upload to be easily and "
"unambiguously cited. Example: 10.1234/foo.bar"
).format(scheme_label=scheme_label),
"default_selected": default_selected,
}
pids_providers.append(pids_provider)

Expand Down Expand Up @@ -360,7 +367,16 @@ def new_record():
record = dump_empty(RDMRecordSchema)
record["files"] = {"enabled": current_app.config.get("RDM_DEFAULT_FILES_ENABLED")}
if "doi" in current_rdm_records.records_service.config.pids_providers:
record["pids"] = {"doi": {"provider": "external", "identifier": ""}}
if (
current_app.config["RDM_PERSISTENT_IDENTIFIERS"]
.get("doi", {})
.get("ui", {})
.get("default_selected")
== "yes" # yes, no or not_needed
):
record["pids"] = {"doi": {"provider": "external", "identifier": ""}}
else:
record["pids"] = {}
else:
record["pids"] = {}
record["status"] = "draft"
Expand Down Expand Up @@ -389,6 +405,11 @@ def deposit_create(community=None):

community_use_jinja_header = bool(community_theme)
dashboard_routes = current_app.config["APP_RDM_USER_DASHBOARD_ROUTES"]
is_doi_required = (
current_app.config.get("RDM_PERSISTENT_IDENTIFIERS", {})
.get("doi", {})
.get("required")
)
return render_community_theme_template(
current_app.config["APP_RDM_DEPOSIT_FORM_TEMPLATE"],
theme=community_theme,
Expand All @@ -397,6 +418,7 @@ def deposit_create(community=None):
createUrl="/api/records",
quota=get_files_quota(),
hide_community_selection=community_use_jinja_header,
is_doi_required=is_doi_required,
),
searchbar_config=dict(searchUrl=get_search_url()),
record=new_record(),
Expand Down Expand Up @@ -455,17 +477,37 @@ def deposit_edit(pid_value, draft=None, draft_files=None, files_locked=True):
# communities
community_use_jinja_header = bool(community_theme)
dashboard_routes = current_app.config["APP_RDM_USER_DASHBOARD_ROUTES"]
is_doi_required = (
current_app.config.get("RDM_PERSISTENT_IDENTIFIERS", {})
.get("doi", {})
.get("required")
)
form_config = get_form_config(
apiUrl=f"/api/records/{pid_value}/draft",
dashboard_routes=dashboard_routes,
# maybe quota should be serialized into the record e.g for admins
quota=get_files_quota(draft._record),
# hide react community component
hide_community_selection=community_use_jinja_header,
is_doi_required=is_doi_required,
)

if is_doi_required and not record.get("pids", {}).get("doi"):
# if the DOI is required but there is no value, we set the default selected pid
# to no i.e. system should automatically mint a local DOI
if record["status"] == "new_version_draft":
doi_provider_config = [
pid_config
for pid_config in form_config["pids"]
if pid_config.get("scheme") == "doi"
]
if doi_provider_config:
doi_provider_config[0]["default_selected"] = "no"

return render_community_theme_template(
current_app.config["APP_RDM_DEPOSIT_FORM_TEMPLATE"],
theme=community_theme,
forms_config=get_form_config(
apiUrl=f"/api/records/{pid_value}/draft",
dashboard_routes=dashboard_routes,
# maybe quota should be serialized into the record e.g for admins
quota=get_files_quota(draft._record),
# hide react community component
hide_community_selection=community_use_jinja_header,
),
forms_config=form_config,
record=record,
community=community,
community_use_jinja_header=community_use_jinja_header,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ export class RDMDepositForm extends Component {
pidPlaceholder={pid.pid_placeholder}
pidType={pid.scheme}
unmanagedHelpText={pid.unmanaged_help_text}
required
doiDefaultSelection={pid.default_selected}
required={this.config.is_doi_required}
record={record}
/>
</Fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ ReactDOM.render(
allowRecordRestriction={getInputFromDOM("deposits-allow-record-restriction")}
groupsEnabled={getInputFromDOM("config-groups-enabled")}
allowEmptyFiles={getInputFromDOM("records-resources-allow-empty-files")}
isDoiRequired={getInputFromDOM("deposits-is-doi-required")}
/>
</OverridableContext.Provider>,
document.getElementById("deposit-form")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

.ui.flashed.message,
.ui.form .flashed.message {
z-index: 0;
&.manage {
padding: 1em 0;
}
Expand Down
74 changes: 36 additions & 38 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Copyright (C) 2019-2024 CERN.
# Copyright (C) 2019-2022 Northwestern University.
# Copyright (C) 2022 Graz University of Technology.
# Copyright (C) 2022-2024 Graz University of Technology.
#
# Invenio App RDM is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand All @@ -28,61 +28,59 @@ python_requires = >=3.7
zip_safe = False
install_requires =
# Invenio core modules
invenio-app>=1.4.0,<2.0.0
invenio-base>=1.3.0,<2.0.0
invenio-cache>=1.3.0,<2.0.0
invenio-celery>=1.2.4,<2.0.0
invenio-app>=2.0.0,<3.0.0
invenio-base>=2.0.0,<3.0.0
invenio-cache>=2.0.0,<3.0.0
invenio-celery>=2.0.0,<3.0.0
invenio-config>=1.0.3,<2.0.0
invenio-i18n>=2.0.0,<3.0.0
invenio-db[postgresql,mysql]>=1.1.0,<2.0.0
invenio-i18n>=3.0.0,<4.0.0
invenio-db[postgresql,mysql]>=2.0.0,<3.0.0
# Invenio base bundle
invenio-assets>=3.1.0,<4.0.0
invenio-formatter>=2.0.0,<3.0.0
invenio-logging>=2.0.0,<3.0.0
invenio-assets>=4.0.0,<5.0.0
invenio-formatter>=3.0.0,<4.0.0
invenio-logging>=4.0.0,<5.0.0
invenio-mail>=2.0.0,<3.0.0
invenio-rest>=1.3.0,<2.0.0
invenio-theme>=3.0.0,<4.0.0
invenio-rest>=2.0.0,<3.0.0
invenio-theme>=4.0.0,<5.0.0
# Invenio auth bundle
invenio-access>=3.0.0,<4.0.0
invenio-accounts>=5.0.0,<6.0.0
invenio-oauth2server>=2.0.0,<3.0.0
invenio-oauthclient>=4.0.0,<5.0.0
invenio-userprofiles>=3.0.0,<4.0.0
invenio-access>=4.0.0,<5.0.0
invenio-accounts>=6.0.0,<7.0.0
invenio-oauth2server>=3.0.0,<4.0.0
invenio-oauthclient>=5.0.0,<6.0.0
invenio-userprofiles>=4.0.0,<5.0.0
# Invenio metadata bundle
invenio-indexer>=2.2.0,<3.0.0
invenio-jsonschemas>=1.1.4,<2.0.0
invenio-oaiserver>=2.2.0,<3.0.0
invenio-pidstore>=1.3.0,<2.0.0
invenio-records-rest>=2.2.0,<3.0.0
invenio-records-ui>=1.2.0,<2.0.0
invenio-records>=2.2.1,<3.0.0
invenio-search-ui>=3.0.0,<4.0.0
invenio-indexer>=3.0.0,<4.0.0
invenio-jsonschemas>=2.0.0,<3.0.0
invenio-oaiserver>=3.0.0,<4.0.0
invenio-pidstore>=2.0.0,<3.0.0
invenio-records-rest>=3.0.0,<4.0.0
invenio-records-ui>=2.0.0,<3.0.0
invenio-records>=3.0.0,<4.0.0
invenio-search-ui>=4.0.0,<5.0.0
# Invenio files bundle
invenio-files-rest>=2.0.0,<3.0.0
invenio-previewer>=2.2.0,<3.0.0
invenio-files-rest>=3.0.0,<4.0.0
invenio-previewer>=3.0.0,<4.0.0
invenio-records-files>=1.2.1,<2.0.0
# Invenio-App-RDM
invenio-communities>=17.0.0,<18.0.0
invenio-rdm-records>=16.0.0,<17.0.0
invenio-communities>=18.0.0.dev1,<19.0.0
invenio-rdm-records>=17.0.0.dev1,<18.0.0
CairoSVG>=2.5.2,<3.0.0
invenio-banners>=3.0.0,<4.0.0
invenio-pages>=4.0.0,<5.0.0
# Pinned due to before_first_request deprecation https://flask.palletsprojects.com/en/2.2.x/api/#flask.Flask.before_first_request
Flask>=2.2.0,<2.3.0
invenio-banners>=4.0.0,<5.0.0
invenio-pages>=5.0.0,<6.0.0

[options.extras_require]
tests =
pytest-black-ng>=0.4.0
pytest-invenio>=2.1.0,<3.0.0
pytest-invenio>=3.0.0,<4.0.0
Sphinx>=4.5.0
elasticsearch7 =
invenio-search[elasticsearch7]>=2.1.0,<3.0.0
invenio-search[elasticsearch7]>=3.0.0,<4.0.0
opensearch1 =
invenio-search[opensearch1]>=2.1.0,<3.0.0
invenio-search[opensearch1]>=3.0.0,<4.0.0
opensearch2 =
invenio-search[opensearch2]>=2.1.0,<3.0.0
invenio-search[opensearch2]>=3.0.0,<4.0.0
s3 =
invenio-s3~=1.0.5
invenio-s3>=2.0.0,<3.0.0

[options.entry_points]
flask.commands =
Expand Down