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 we can entry points temporarily with a context manager
>>> 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'))
[]
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.0b1.tar.gz
(12.0 kB
view hashes)
Built Distribution
Close
Hashes for prybar-1.0.0b1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c384399e1bfc9d73ea80081fc2cf4abb7ff1683d17060f2f17eabb21d6527ca5 |
|
MD5 | c6694cba1f172f797ea58fe353425511 |
|
BLAKE2b-256 | 8e01beda7a5b58fa295121effa78572886cf93f829c054df917d5a5bdd27c806 |