plastron-models
Metadata content models based on RDF
Model Packages
- annotations: Auxiliary model classes for Web Annotations
- letter: Legacy content model for the Katherine Anne Porter correspondence collection
- newspaper: Content model for the Student Newspapers collection, based on the NDNP data format
- poster: Legacy content model for the Prange Posters and Wall Newspapers collection
- umd: Standardized digital object content model for current and future collections
Vocabulary Retrieval
The get_vocabulary method in the
plastron-models/src/plastron/validation/vocabularies/__init__.py module
initializer controls how vocabularies used for validation are retrieved.
Vocabularies used to validate models are retrieved either from the local filesystem, or from a vocabulary server on the network.
The code uses two variables:
VOCABULARIES_DIR- The full filepath to the directory containing the local vocabulary filesVOCABULARIES- A dictionary mapping a URI to the name of the file containing the vocabulary.
Vocabularies matching URIs in the VOCABULARIES dictionary are first looked
up locally, with the local file being used, if found. If not, a network lookup
using the URI as the vocabulary location is used.
Vocabulary URIs not in the VOCABULARIES dictionary are always looked up via
the network.
Vocabulary Retrieval for Tests
In general, unit tests should be run without making calls to the network, as making a network call makes the tests slower and less reliable.
The retrieval of the vocabularies via the __init__.py module initializer is
problematic for the tests, because the module initialization occurs before a
test is even run. This makes normal methods of overriding the network calls
ineffective. For example, trying to intercept the network calls using the
“httpretty” library doesn’t work, because by the time the
“@httpretty.activate” decorator is accessed, the module has already been
initialized. The same is true when attempting to “monkey patch” the module.
One method that was found to work was to add a
conftest.py file into the root directory of the project, with a
pytest_configure method. It is necessary to have the conftest.py in the
root directory, so that it will always be used when running pytests in any of
the Plastron modules (as those tests may use one of the content models with a
vocabulary). The pytest_configure method runs as soon as pytest starts, and
before any modules are loaded, providing an opportunity to set the
“VOCABULARIES_DIR” and “VOCABULARIES” variables to values that are suitable for
testing.
Any vocabularies needed for the tests should be added as follows:
-
Add a file containing the vocabulary (in "turtle" format) to the "plastron-models/tests/data/vocabularies/" directory.
-
In the
conftest.pyfile in the root directory, add the vocabulary URI and filename to theVOCABULARIESdictionary.
Note that if a vocabulary is not added, a network call will still be attempted,
due to the fallback behavior of the get_vocabularies method.
Metadata
Release files for plastron-models 4.8.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| plastron_models-4.8.2.tar.gz | 52.8 kB | Without provenance | Details for plastron_models-4.8.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| plastron_models-4.8.2-py3-none-any.whl | Python 3 | none | any | Details for plastron_models-4.8.2-py3-none-any.whl |
Total release size: 122.1 kB
Release files / plastron_models-4.8.2.tar.gz
| Download URL | plastron_models-4.8.2.tar.gz |
|---|---|
| Size | 52.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4422a65c067915c74b70e14719f036933897560be7007638baea0292f80aeb8f
|
|
BLAKE2b-256 checksum How to use checksums |
e2764e90f64b54214291d218091e899debb88f5b5ac37ecb85affb47681d9651
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.10
|
Release files / plastron_models-4.8.2-py3-none-any.whl
| Download URL | plastron_models-4.8.2-py3-none-any.whl |
|---|---|
| Size | 69.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5baf37098b26d70f880532cdf60cf73b809cbe38da187dedf3c0ec81dd09527e
|
|
BLAKE2b-256 checksum How to use checksums |
7ab27cd908e1cb9599b797dfa83b606691257e1746a10ee2ff95c1c76af4de96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.10
|
Security for plastron-models 4.8.2
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.