Python functions for applied use of schema.org
Project description
schemaorg-lite
schemaorg-lite
is a lightweight Python library for working with Schema.org vocabulary. It provides a simple interface to access Schema.org types and properties, allowing you to easily integrate structured data into your applications. This library is a streamlined alternative to the full schema.org release, focusing on core functionality for tagging content.
Purpose
schemaorg-lite
aims to:
- Simplify Access: Provide an easy way to access and use Schema.org types and properties.
- Content Tagging: Facilitate tagging web content with Schema.org metadata.
- Core Functionality: Offer a core subset of Schema.org functionality.
- Stay Updated: Ensure access to current Schema.org versions.
Key Features
- Type Loading: Easily load Schema.org types (e.g.,
Person
,Organization
,Product
). - Property Management: Add, manage, and remove properties for Schema.org types.
- Version Handling: Access specific Schema.org versions (23.0 and later).
- URL Generation: Automatically generate URLs for Schema.org types.
- Type Validation: Check if a Schema.org type is valid.
- Similar Type Suggestions: Suggest similar types if an invalid type is requested.
What schemaorg-lite
is NOT
- Full Ontology Management: This library does not provide advanced features for querying or manipulating the full Schema.org ontology.
- Complex Reasoning: It does not support complex reasoning or inference over the Schema.org graph.
- JSON-LD Generation: This library does not generate JSON-LD.
Installation
pip install schemaorg-lite
Usage
schemaorg-lite
makes working with Schema.org types and properties straightforward. Here's how to get started:
from schemaorg_lite.main import Schema
Load a Schema.org type (defaults to the latest version)
person = Schema("Person") print(person) # Output: Person (latest version)
Load a Schema.org type with a specific version
organization = Schema("Organization", version="14.0") print(organization) # Output: Organization (14.0)
Add properties to a Schema.org type
person.add_property("name", "John Doe")
person.add_property("email", "john.doe@example.com")
print(person.properties) # Output: {'name': 'John Doe', 'email': 'john.doe@example.com'}
Remove a property
person.remove_property("email")
print(person.properties) # Output: {'name': 'John Doe'}
Get the base URL
print(person.base) # Output: https://www.schema.org
Get the version
print(person.version) # Output: The latest version (e.g., 23.0)
Contributing
Contributions are welcome! Please feel free to open a pull request or issue. We use crackerjack for development. See crackerjack for more information on setup and usage.
To contribute:
- Add Crackerjack as a development dependency to your project. From the project root, run:
pdm add -G dev crackerjack
- Run checks and tests before submitting. From the project root, run:
python -m crackerjack -x -t
This ensures your code meets all quality standards before submission.
License
This project is licensed under the terms of the BSD 3-Clause License. See the LICENSE
file for details.
Acknowledgments
- Schema.org: For creating and maintaining the vocabulary.
- schema-org: A Python package for working with schema.org that helped inform
the design of
schemaorg-lite
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file schemaorg_lite-0.3.2.tar.gz
.
File metadata
- Download URL: schemaorg_lite-0.3.2.tar.gz
- Upload date:
- Size: 7.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.22.4 CPython/3.13.2 Darwin/24.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63724fed0d377c94d8c65128f9b7c73fa60513b901a5ad6a734faf3c7116c85b |
|
MD5 | 7c6f96899215605ebc03ae76b737bd20 |
|
BLAKE2b-256 | d1c689bdae4865f4c1e2b25b014e0db5bde875559d60d2521d0b5faf1e25d561 |
File details
Details for the file schemaorg_lite-0.3.2-py3-none-any.whl
.
File metadata
- Download URL: schemaorg_lite-0.3.2-py3-none-any.whl
- Upload date:
- Size: 7.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.22.4 CPython/3.13.2 Darwin/24.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08942b294967c8de623fcda3510330da85d3d9cf2ea15272ef123cebfa7b2eaf |
|
MD5 | 8333e4a7c4f082dd2b5973c25ab23d3d |
|
BLAKE2b-256 | 0f39618fa62b6a2b86940c21f0737303b165c40a7acabd79bdbff8a73934e20d |