Skip to main content

Utilities to aid the implementation of various IndieWeb specifications and functionalities.

Project description

Python indieweb-utils Library

Documentation Status image image image image

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.

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

import indieweb_utils

context = 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

import indieweb_utils

url = "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

import indieweb_utils

pages = 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.

The documentation in this project is licensed under a CC BY-SA 4.0 license.

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
$ tox

Alternatively, 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 for more information on how to contribute to the repository.

Contributors 💻

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

indieweb_utils-0.9.1.tar.gz (36.9 kB view details)

Uploaded Source

Built Distribution

indieweb_utils-0.9.1-py3-none-any.whl (49.4 kB view details)

Uploaded Python 3

File details

Details for the file indieweb_utils-0.9.1.tar.gz.

File metadata

  • Download URL: indieweb_utils-0.9.1.tar.gz
  • Upload date:
  • Size: 36.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for indieweb_utils-0.9.1.tar.gz
Algorithm Hash digest
SHA256 aae303ef937ba13acedef411fc7087ebfb31fc6547eccf2f181211e92420895e
MD5 ccb286db3b75030a0ffceb125ee714fd
BLAKE2b-256 1339a06504eef411e47ed6a7cf80c35f0cb6eb09b20c91f409a150814e56cdce

See more details on using hashes here.

File details

Details for the file indieweb_utils-0.9.1-py3-none-any.whl.

File metadata

File hashes

Hashes for indieweb_utils-0.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 03e5662b409b47ea9841a730ec3380c5cb4445d471b56bf68b73196607549676
MD5 79b897e88f19738375a3bfc20e8cd42c
BLAKE2b-256 baabcb9754a32dbe039b15305694db319f9a54e9aaf1203d4746a04601877523

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page