Git Product home page Git Product logo

indieweb-utils's Introduction

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 ๐Ÿ’ป

indieweb-utils's People

Contributors

capjamesg avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.