Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/capjamesg/indieweb-utils
Utilities to aid the implementation of various IndieWeb specifications and functionalities. Built with Python.
https://github.com/capjamesg/indieweb-utils
indieweb python
Last synced: about 1 month ago
JSON representation
Utilities to aid the implementation of various IndieWeb specifications and functionalities. Built with Python.
- Host: GitHub
- URL: https://github.com/capjamesg/indieweb-utils
- Owner: capjamesg
- License: other
- Created: 2021-12-07T19:12:25.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-12T22:48:31.000Z (6 months ago)
- Last Synced: 2024-12-10T03:32:13.078Z (about 1 month ago)
- Topics: indieweb, python
- Language: Python
- Homepage: https://indieweb-utils.readthedocs.io/en/latest/
- Size: 698 KB
- Stars: 23
- Watchers: 3
- Forks: 3
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# Python indieweb-utils Library
[![Documentation Status](https://readthedocs.org/projects/indieweb-utils/badge/?version=latest)](https://indieweb-utils.readthedocs.io/en/latest/?badge=latest)
[![image](https://badge.fury.io/py/indieweb-utils.svg)](https://badge.fury.io/py/indieweb-utils)
[![image](https://img.shields.io/pypi/dm/indieweb-utils)](https://pypistats.org/packages/indieweb-utils)
[![image](https://img.shields.io/pypi/l/indieweb-utils)](https://github.com/capjamesg/indieweb-utils/blob/main/LICENSE)
[![image](https://img.shields.io/pypi/pyversions/indieweb-utils)](https://badge.fury.io/py/indieweb-utils)**indieweb-utils** provides building blocks for people implementing IndieWeb applications in Python. Discover IndieWeb endpoints, find feeds on a page, infer page names, generate reply contexts, and more!
The documentation for this project is available at [indieweb-utils.readthedocs.io](https://indieweb-utils.readthedocs.io/en/latest/).
## Installation ๐ป
To get started, pip install `indieweb-utils`:
pip install indieweb-utils
## Quickstart โก
Here are a few quick code snippets for actions enabled by IndieWeb Utils.
### get reply context about a URL
``` python
import indieweb_utilscontext = indieweb_utils.get_reply_context(
url="https://jamesg.blog",
summary_word_limit=50
)print(context.name) # "Home | James' Coffee Blog"
```### Remove tracking parameters from a URL
``` python
import indieweb_utilsurl = "https://jamesg.blog/indieweb/?utm_source=twitter&utm_medium=social&utm_campaign=webmention"
url_without_tracking = indieweb_utils.remove_tracking_params(url)
print(url_without_tracking) # https://jamesg.blog/indieweb/
```### Create a paginator for a series
``` python
import indieweb_utilspages = indieweb_utils.Paginator(["post1", "post2", ...], 1)
print(pages.next_page()) [["post1"]]
```## License ๐ฉโโ๏ธ
The code in this project is licensed under the [Zero-Clause BSD
License](LICENSE.md).The documentation in this project is licensed under a [CC BY-SA 4.0 license](https://creativecommons.org/licenses/by-sa/4.0/).
## Running Tests ๐งช
Quality is maintained ensuring each merged passes testing, typing, linting, and formatting requirements.
To check locally install the development dependencies and run the suite using [tox]{.title-ref}.
$ pip install -r requirements_dev.txt
$ toxAlternatively, you can run just a single check by passing the environment to tox.
### Unit Tests
Tests use pytest.
$ tox -e py39 # Run all tests
$ tox -e py39 tests/test_indieweb_utils.py::TestPostTypeDiscovery # Run a single test### Linting
Linting is checked with black, isort, and flake8.
$ tox -e lint
Black and isort errors can be fixed automatically. Use fmt to fix those errors automatically.
$ tox -e fmt
### Typing
Types are validated with mypy.
$ tox -e typecheck
## Contributing ๐ ๏ธ
This project welcomes contributions from anyone who wants to improve the
library.Please see the [contributing guidelines](CONTRIBUTING.md) for more
information on how to contribute to the repository.## Contributors ๐ป
- [capjamesg](https://github.com/capjamesg)
- [tantek](https://github.com/tantek)
- [jamesvandyne](https://github.com/jamesvandyne)
- [angelogladding](https://github.com/angelogladding)