Skip to main content

What's a Python Namespace Package, and What's It For?

DataRepos - A Namespace Package for Data Files

This package provides a namespace intended for data files.

It lets you read data files from a common package, but with the actual data distributed over multiple packages.

For example, if you have various data files that are very large (on the order of hundreds of megabytes or larger), then you can divide the data files into different packages, but they'll be callable from the same namespace in your Python code.

To use DataRepos, you should install it into your virtual environment:

(venv) $ python -m pip install data-repos

You can now import DataRepos as data_repos.

Read Data Files

DataRepos provides a read() function that you can use to read data files. The data are returned as a pandas DataFrame:

>>> from data_repos import read
>>> read.data("countries")
              country   population
0             Austria      8840521
1              Canada     37057765
2                Cuba     11338138
3  Dominican Republic     10627165
4             Germany     82905782
5              Norway      5311916
...

Install Data Files

You can install other data files from PyPI with pip. Other cooperating DataRepos packages can be installed and will integrate smoothly:

(venv) $ python -m pip install data-repos-cars

You can then read the cars dataset with the exact same syntax:

>>> from data_repos import read
>>> read.data("cars")
...

Because DataRepos is a namespace package, it can be extended on the fly.

Available Data Files

Two datasets are included as examples:

  • iris: The classical Iris dataset, originally published by Ronald Fisher in 1936
  • countries: Countries and their population, collected by Samayo

You can read these files with read.data("iris") and read.data("countries"), respectively.

Add Your Own Data Files

You can also add your own data files by storing them in a folder named data_repos that's on Python's path.

See examples of how to do this and learn more about namespace packages in What's a Python Namespace Package, and What's It For?

Metadata

Release files for data-repos 1.0.0

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

Source distribution (sdist)

Source distribution for data-repos 1.0.0
File Size Uploaded
data-repos-1.0.0.tar.gz 11.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for data-repos 1.0.0
File Interpreter ABI Platform
data_repos-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.1 kB

Release files / data-repos-1.0.0.tar.gz

Download URL data-repos-1.0.0.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d0dc420b3c8e4cef9b86915cacc1e60df2d2e0ce35564bca4da77f020336121e
BLAKE2b-256 checksum
How to use checksums
d535991c97fa78bec5fff27d6fcb08d058e406e8f1f53fcfd8f8fce096f56fe0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release files / data_repos-1.0.0-py3-none-any.whl

Download URL data_repos-1.0.0-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c5c7dbd6a8f374a0f5a7abd79e8278ab3b1a32c1fdb27af11b8151fd18de2a3
BLAKE2b-256 checksum
How to use checksums
31a41bbafbd1a7c8b57983bbbcd16aac914c1c63b069ff3267411bd4d5663eda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.1.0

2 release files

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