Create temporary pkg_resources entry points at runtime.
Project description
A Python library to temporarily define pkg_resources entry points at runtime. The primary use case is testing code which works with entry points.
Installing
$ pip install prybar
prybar requires Python 3.6 or greater.
Usage
>>> import prybar
>>> from pkg_resources import iter_entry_points
>>> # Entry point doesn't exist
>>> list(iter_entry_points('example.hash_types', 'sha256'))
[]
>>> # With prybar's context manager we can create entry points temporarily
>>> with prybar.dynamic_entrypoint('example.hash_types',
... name='sha256', module='hashlib'):
... hash = next(iter_entry_points('example.hash_types', 'sha256')).load()
... hash(b'foo').hexdigest()[:6]
'2c26b4'
>>> # And it's gone again
>>> list(iter_entry_points('example.hash_types', 'sha256'))
[]
See the full documentation for more.
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
prybar-1.0.0.tar.gz
(12.7 kB
view details)
Built Distribution
File details
Details for the file prybar-1.0.0.tar.gz
.
File metadata
- Download URL: prybar-1.0.0.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.21.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f2af7b4fdce2d0febf6fb73a0854956a384fad65df19c3f57caab7c4726a88a |
|
MD5 | 8201b776b9bb3156b4b52a4d3bf639ae |
|
BLAKE2b-256 | 63ca7237093ffc11b6c62ee3a75d0998bfcc459c40beb1e418ad263265af36ad |
File details
Details for the file prybar-1.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: prybar-1.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.21.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07d5b12fb12da703fb266d67d3a117e1c20a30cd9daa274586cc4af8081baea7 |
|
MD5 | cd6cf7290aa1ab067a516b56a0c58fe3 |
|
BLAKE2b-256 | bb00406f2f474d1bd35a13dbb36f66912111ec32a54018cd05c6160795a700da |