Skip to main content

TraversalKit

The library provides tools to build resource tree for applications that use traversal routing. It has been developed to be used with Pyramid web application framework, however it does not depend on it and can be used within any application.

It helps implement resource tree hierarchy in a simple declarative way:

>>> from traversalkit import Resource, DEC_ID

>>> class Root(Resource):
...     """ Tree root """

>>> @Root.mount('users')
... class Users(Resource):
...     """ Users collection """

>>> @Users.mount_set(DEC_ID, metaname='user_id')
... class User(Resource):
...     """ User resource """

>>> @Root.mount('posts')
... @User.mount('posts')
... class Posts(Resource):
...     """ Posts collection """

>>> @Posts.mount_set(DEC_ID, metaname='post_id')
... class Post(Resource):
...     """ Post resource """

>>> for route in Root.routes():
...     print(route)
<Route: />
<Route: /posts/>
<Route: /posts/{post_id}/>
<Route: /users/>
<Route: /users/{user_id}/>
<Route: /users/{user_id}/posts/>
<Route: /users/{user_id}/posts/{post_id}/>

These resources comply Pyramid traversal interface and Pyramid location awareness interface.

>>> root = Root()
>>> user = root['users']['1']
>>> user
<User: /users/1/>
>>> user.__name__
'1'
>>> user.__parent__
<Users: /users/>
>>> user['posts']
<Posts: /users/1/posts/>
>>> user['documents']  # DOCTEST: +ellipsis
Traceback (most recent call last):
...
KeyError: ('documents', '/users/1/')

0.3.1

  • Fixed typos of README.rst and CHANGES.rst.

0.3

  • Added support of conditional routes.

  • Added support of resource tree introspection by Resource.routes().

  • Added resource URI into raising errors to make them more informative.

  • Added support of disengageable resource cache.

0.2

  • Added method Resource.get().

0.1

Initial release.

Metadata

Release files for TraversalKit 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for TraversalKit 0.3.1
File Size Uploaded Provenance
TraversalKit-0.3.1.tar.gz 11.4 kB Without provenance Details

Release files / TraversalKit-0.3.1.tar.gz

Download URL TraversalKit-0.3.1.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a93d40e7105433aeee332c518d556027db7e893acaf1bbb800efbe7320487941
BLAKE2b-256 checksum
How to use checksums
f93d08a795cb04b575622793ed7b85a8f5b316e177f763e0daa4bd1846a08ce0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for TraversalKit 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page