Skip to content

Commit

Permalink
release: v1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zzacharo committed Oct 15, 2024
1 parent 6d83ccb commit 629ea6a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
Changes
=======

Version 2.0.0 (2024-09-30)
Version 1.3.0 (2024-10-15)

- Restructure module to be configurable and readable.
- Adds a new entrypoint to register new custom schemes
- Adds deprecations for direct imports of schemes

Version 1.2.1 (2023-03-02)

Expand Down
31 changes: 15 additions & 16 deletions idutils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@

"""Small library for persistent identifiers used in scholarly communication.
Setting up custom schemes
------------------------
-------------------------
In order to define your own custom schemes you can use the following entrypoint to
register them
.. code-block:: python
[options.entry_points]
idutils.custom_schemes =
my_new_scheme = my_module.get_scheme_config_func
[options.entry_points]
idutils.custom_schemes =
my_new_scheme = my_module.get_scheme_config_func
The entry point ``'my_new_scheme = my_module.get_scheme_config_func'`` defines an entry
point named ``my_new_scheme`` pointing to the function ``my_module.get_scheme_config_func``
Expand All @@ -36,17 +35,17 @@
.. code-block:: python
def get_scheme_config_func():
return {
# See examples in `idutils.validators` file.
"validator": lambda value: True else False,
# Used in `idutils.normalizers.normalize_pid` function.
"normalizer": lambda value: normalized_value,
# See examples in `idutils.detectors.IDUTILS_SCHEME_FILTER` config.
"filter": ["list_of_schemes_to_filter_out"],
# Used in `idutils.normalizers.to_url` function.
"url_generator": lambda scheme, normalized_pid: "normalized_url",
}
def get_scheme_config_func():
return {
# See examples in `idutils.validators` file.
"validator": lambda value: True else False,
# Used in `idutils.normalizers.normalize_pid` function.
"normalizer": lambda value: normalized_value,
# See examples in `idutils.detectors.IDUTILS_SCHEME_FILTER` config.
"filter": ["list_of_schemes_to_filter_out"],
# Used in `idutils.normalizers.to_url` function.
"url_generator": lambda scheme, normalized_pid: "normalized_url",
}
Each key is optional and if not provided a default value is defined in
`idutils.ext._set_default_custom_scheme_config()` function.
Expand Down
2 changes: 1 addition & 1 deletion idutils/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"""Utility file containing ID validators."""


from six.moves.urllib.parse import urlparse
from urllib.parse import urlparse

from .utils import *
from .utils import _convert_x_to_10
Expand Down
2 changes: 0 additions & 2 deletions tests/test_idutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

"""Persistent identifier utilities tests."""

from __future__ import absolute_import, print_function

import pytest

import idutils
Expand Down

0 comments on commit 629ea6a

Please sign in to comment.