A collection of useful datasets
Project description
This project shows how to package data files within a Python distribution, and has some example code for reading the data files. To build this distribution, create a venv with setuptools, wheel, and pep517 installed, then execute the latter as a module:
python -m pep517.build .
The distributions (an sdist .tar.gz and a bdist .whl) will be written to ./dist/ subdirectory. To test it out, install the distribution and run the console script resources-example.
Here’s a compatibility summary of the five approaches demonstrated:
Module |
Description |
In stdlib? |
Works on Py2? |
Works on Py3? |
Works in zipfile? |
Run as script?* |
---|---|---|---|---|---|---|
example1.py |
os.path.join |
yes |
yes |
yes |
no |
yes |
example2.py |
pkgutil |
yes |
yes |
yes |
yes |
no |
example3.py |
pkg_resources |
no |
yes |
yes |
yes |
yes |
example4.py |
importlib.resources |
yes |
no |
yes (3.7+) |
yes |
yes |
example5.py |
importlib_resources |
no |
yes |
yes |
yes |
yes |
* “Run as script” means executing the submodule directly, e.g. python myapp/example2.py. Note that Guido considers this an anti-pattern
If you are interested in creating an executable zip from source, you can use stdlib zipapp utility (Python 3.5+):
python3 -m zipapp --compress /path/to/resources-example --main="myapp:main" --output=myapp.zip
And now you can run the zip directly with the interpreter (any Python version):
python myapp.zip
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
Built Distribution
Hashes for eccd_datasets-0.1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61ccbda6681a0a224b6c10d31cf7c83dd6712f27297bda5978a077f85400a958 |
|
MD5 | baeb114579b88f8a52faae9dae1e379c |
|
BLAKE2b-256 | 6ab047810470372fb418545deef600d883490faf564903e463d6338505eb09fe |