Skip to main content

The tools that power the canopy.

Project description

understory

the tools that power the canopy

web

tools for metamodern web development

>>> import web

Browser

uses Firefox via Selenium

>>> browser = web.browser()
>>> browser.go("en.wikipedia.org/wiki/Pasta")
>>> browser.shot("wikipedia-pasta.png")

Cache

uses SQLite

>>> cache = web.cache()
>>> cache["indieweb.org/note"].entry["summary"]
"A note is a post that is typically short unstructured* plain text, written & posted quickly, that has its own permalink page."
>>> cache["indieweb.org/note"].entry["summary"]  # served from cache
"A note is a post that is typically short unstructured* plain text, written & posted quickly, that has its own permalink page."

Application

WSGI-compatible

In hello.py:

import web

app = web.application("HelloWorld")

@app.route(r"")
class HelloWorld:
    def _get(self):
        return "Hello World!"

In setup.py:

...
setup(install_requires=["web"],
      entry_points={"web.apps": ["hello:app"]},
      ...)

Templating

Full Python inside string templates.

>>> web.template("$def with (name)\n$name")("Alice")
"Alice"

Markdown

Strict syntax subset (there should be one and only one way).

Picoformat support eg. @person, @@org, #tag, %license

>>> str(web.mkdn("*lorem* ipsum."))
"<p><em>lorem</em> ipsum. </p>"

URL parsing

Defaults to safe-mode and raises DangerousURL eagerly. Up-to-date public suffix and HSTS support.

>>> url = web.uri("example.cnpy.gdn/foo/bar?id=38")
>>> url.host
"example.cnpy.gdn"
>>> url.suffix
"cnpy.gdn"
>>> url.is_hsts()
True

IndieWeb

Supported: IndieAuth client/server, Micropub client/server, Microsub :construction:, WebSub :construction:, Webmention :construction:

>>> app.mount(web.indieauth.server)
>>> app.mount(web.micropub.server)

Microformats

Parse mf2 from HTML. Analyze vocabularies for stability/interoperability.

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

understory-0.0.1a100.tar.gz (226.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

understory-0.0.1a100-py3-none-any.whl (247.9 kB view details)

Uploaded Python 3

File details

Details for the file understory-0.0.1a100.tar.gz.

File metadata

  • Download URL: understory-0.0.1a100.tar.gz
  • Upload date:
  • Size: 226.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.1 Linux/4.19.0-13-amd64

File hashes

Hashes for understory-0.0.1a100.tar.gz
Algorithm Hash digest
SHA256 4537d54db4d6cc7cf1ed6dc5becf8291a136cbc2609ec69b806f4adbb99651bc
MD5 f2ff4ec54d4c5bf385f4db9689647739
BLAKE2b-256 4d18000aee71710936c8ea74c3b2b02d2c21162a0fb29a1706ced5c037b14710

See more details on using hashes here.

File details

Details for the file understory-0.0.1a100-py3-none-any.whl.

File metadata

  • Download URL: understory-0.0.1a100-py3-none-any.whl
  • Upload date:
  • Size: 247.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.1 Linux/4.19.0-13-amd64

File hashes

Hashes for understory-0.0.1a100-py3-none-any.whl
Algorithm Hash digest
SHA256 1496b11daae8bef66f5025fce896e01332584c144f0efecdfcd99fb07e710d03
MD5 26d1f5a731873714ab6c45f6739db660
BLAKE2b-256 b19bf61dcc3f50510e1bd600490dd4e961db5492e9863e03be598c6e6df7b694

See more details on using hashes here.

Supported by

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