Skip to content

Commit

Permalink
feat: ProfileBuilder accepts standard_base_url as the bytes of a ZIP …
Browse files Browse the repository at this point in the history
…file
  • Loading branch information
jpmckinney committed Jan 7, 2025
1 parent 653325b commit 75707e6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
7 changes: 6 additions & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

0.6.9 (2025-01-07)
------------------

- :class:`~ocdsextensionregistry.profile_builder.ProfileBuilder` also accepts ``standard_base_url`` as the bytes of a ZIP file.

0.6.8 (2024-12-17)
------------------

Expand Down Expand Up @@ -142,7 +147,7 @@ Changelog
0.3.4 (2023-07-08)
------------------

- feat: :class:`~ocdsextensionregistry.profile_builder.ProfileBuilder` accepts ``standard_base_url`` as a ZIP file, in addition to a directory.
- feat: :class:`~ocdsextensionregistry.profile_builder.ProfileBuilder` also accepts ``standard_base_url`` as a ``file://`` URL to a ZIP file.

0.3.3 (2023-07-07)
------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
author = "Open Contracting Partnership"

# The short X.Y version
version = "0.6.8"
version = "0.6.9"
# The full version, including alpha/beta/rc tags
release = version

Expand Down
6 changes: 4 additions & 2 deletions ocdsextensionregistry/profile_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ def __init__(self, standard_tag, extension_versions, registry_base_url=None, sta
:param extension_versions: the extension versions
:param str registry_base_url: the registry's base URL, defaults to
``'https://raw.githubusercontent.com/open-contracting/extension_registry/main/'``
:param str standard_base_url: the standard's base URL, defaults to
``'https://codeload.github.com/open-contracting/standard/zip/' + standard_tag``
:param standard_base_url: the standard's base URL, defaults to
``f'https://codeload.github.com/open-contracting/standard/zip/{standard_tag}'``
(can be a ``file://`` URL to a directory or a ZIP file, or the bytes of a ZIP file)
:param str schema_base_url: the schema's base URL, e.g.
``'https://standard.open-contracting.org/profiles/ppp/schema/1__0__0__beta/'``
:type standard_base_url: str or bytes
:type extension_versions: dict or list
"""
# Allows setting the registry URL to e.g. a pull request, when working on a profile.
Expand Down
3 changes: 3 additions & 0 deletions ocdsextensionregistry/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ def _resolve(data_or_url):


def _resolve_zip(url, base=''):
if isinstance(url, bytes):
return ZipFile(BytesIO(url))

parsed = urlsplit(url)

if parsed.scheme == 'file':
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "ocdsextensionregistry"
version = "0.6.8"
version = "0.6.9"
authors = [{name = "Open Contracting Partnership", email = "[email protected]"}]
description = "Eases access to information from the extension registry of the Open Contracting Data Standard"
readme = "README.rst"
Expand Down

0 comments on commit 75707e6

Please sign in to comment.