Skip to main content

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 files
  • VOCABULARIES - 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:

  1. Add a file containing the vocabulary (in "turtle" format) to the "plastron-models/tests/data/vocabularies/" directory.

  2. In the conftest.py file in the root directory, add the vocabulary URI and filename to the VOCABULARIES dictionary.

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.3

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

Source distribution (sdist)

Source distribution for plastron-models 4.8.3
File Size Uploaded Provenance Actions
plastron_models-4.8.3.tar.gz 52.7 kB Without provenance Details for plastron_models-4.8.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for plastron-models 4.8.3
File Interpreter ABI Platform Actions
plastron_models-4.8.3-py3-none-any.whl Python 3 none any Details for plastron_models-4.8.3-py3-none-any.whl

Total release size: 122.1 kB

Release files / plastron_models-4.8.3.tar.gz

Download URL plastron_models-4.8.3.tar.gz
Size 52.7 kB
Tags Source
SHA-256 checksum
How to use checksums
70982a97e8c853850457ed2faae015c2ea89b569cff079d87ab6fa01438d4e0d
BLAKE2b-256 checksum
How to use checksums
77ac43a9d4a12defc815e8bb9d309edd15694b9dd2a4ac053f88968744ec794a
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.3-py3-none-any.whl

Download URL plastron_models-4.8.3-py3-none-any.whl
Size 69.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7de9144e737342a7d5852225a849aab999232b9b761d797e691e8ab820105917
BLAKE2b-256 checksum
How to use checksums
74e62e0cf2308f52a111ff5562f4f39a693132f2de57f21cf5d38c938cf2e551
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.3

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