Virtual Dataset
A small utility that allows to mount virtually a list of files as a folder.
Installation
Virtual-Dataset can be installed as a normal python package just run pip install ...
Usage
There are two main functions mount, umount
Mount: allows creating the temporary mount with all the necessary files inside.
Umount: allows deletion of temporary mount folders
Simple Example :
from vdataset import mount, unmount
file_list = [ 'data/file1.txt', 'data/file2.txt', 'other_data/file6.txt', '/data/file.txt']
location = mount(file_list)
# location folder contains symlinks with all the files specified
# cleans up mount and removes all created files
unmount(location)
All files are created as symbolic links to the originals so no data copy happens on mount
unmount allows a safe option that when turned on will fail to delete the directory if any file in it is not a symlink
Mount Input
Input can be of multiple format:
- A simple list of files
List[Path, str]that can be anywhere on your machine. - A dictionary allows preserving (or specifying) a file structure inside the created folder ex:
obj = {
"dir1": ['file1.txt', 'file2.txt', 'file3.txt', 'file4.txt'],
"dir2": ['file5.txt', 'file6.txt', 'file7.txt', 'file8.txt', 'file9.txt'],
"dir3": {
"subDir1": [
'file10.txt',
'file11.txt',
'file12.txt',
'file13.txt',
'file14.txt',
'file15.txt'
],
"subDir2": 'file19.txt',
},
"dir4": ['file16.txt', 'file17.txt', 'file18.txt']
}
Creates the following temp folder :
tmpdir
├── dir1
│ ├── file1.txt -> source_dir/file1.txt
│ ├── file2.txt -> source_dir/file2.txt
│ ├── file3.txt -> source_dir/file3.txt
│ └── file4.txt -> source_dir/file4.txt
├── dir2
│ ├── file5.txt -> source_dir/file5.txt
│ ├── file6.txt -> source_dir/file6.txt
│ ├── file7.txt -> source_dir/file7.txt
│ ├── file8.txt -> source_dir/file8.txt
│ └── file9.txt -> source_dir/file9.txt
├── dir3
│ ├── subDir1
│ │ ├── file10.txt -> source_dir/file10.txt
│ │ ├── file11.txt -> source_dir/file11.txt
│ │ ├── file12.txt -> source_dir/file12.txt
│ │ ├── file13.txt -> source_dir/file13.txt
│ │ ├── file14.txt -> source_dir/file14.txt
│ │ └── file15.txt -> source_dir/file15.txt
│ └── subDir2
│ └── file19.txt -> source_dir/file19.txt
└── dir4
├── file16.txt -> source_dir/file16.txt
├── file17.txt -> source_dir/file17.txt
└── file18.txt -> source_dir/file18.txt
-
Input can be taken from yaml or json files (using mount_from_index_file function)
-
Input can also be another directory (using mount_from_location function)
CLI
A command line utility exists to allow usage from outside python.
When installing the package the vmount command is installed in the current environment.
❯ vmount
usage: vmount [-h] [-u UMOUNT] [-i MOUNT_FROM_INDEX] [-d MOUNT_FROM_DIR] [--unsafe] [-k INDEX_KEY] [-t TMP_PREFIX] [-s KEEP_STRUCTURE] [-p PATTERN]
optional arguments:
-h, --help show this help message and exit
-u UMOUNT, --umount UMOUNT
unmount location
-i MOUNT_FROM_INDEX, --mount-from-index MOUNT_FROM_INDEX
mount from an index file [yaml, json]
-d MOUNT_FROM_DIR, --mount-from-dir MOUNT_FROM_DIR
mount from a directory
--unsafe practice unsafe unmounting techniques (default: false)
-k INDEX_KEY, --index-key INDEX_KEY
path to sub-item when loading index object (delimited by dots ex: key1.item3)
-t TMP_PREFIX, --tmp-prefix TMP_PREFIX
Use this location as a prefix for creating mount point
-s KEEP_STRUCTURE, --keep-structure KEEP_STRUCTURE
Keep directory structure when mounting from dir
-p PATTERN, --pattern PATTERN
Pattern to match when mounting from dir (list)
Metadata
Release files for virtual-dataset 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| virtual_dataset-1.0.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for virtual_dataset-1.0.1-py2.py3-none-any.whl |
Release files / virtual_dataset-1.0.1-py2.py3-none-any.whl
| Download URL | virtual_dataset-1.0.1-py2.py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
91963aa887eed7057939270ac287fb3b95de1521e28450d7793a63492b4edb45
|
|
BLAKE2b-256 checksum How to use checksums |
4e5533a9406fc42e1b4a05f774869d78507acc1cc88eea9ddadccbf8e1b61b78
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.8
|
Security for virtual-dataset 1.0.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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.