Skip to main content

This package handles file I/O for larger projects, with the aim to simplify/standardize working with many datasets and 3rd party codebases across different naming conventions, data types, and storage systems.

To run unit tests, run

$python -m unittest discover -s tests


$for dev, it is better to run pip install -e .

Project set up

System Identity File

Create a file named .system_identity.txt at the top level project directory. Decide on a name for your local system, and add it as a single line to the the file as:

In conf/system_configs/system_conf.yaml, input the following:

System config

Create a config file in conf/system_configs/system_conf.yaml. This holds information file_golem needs to navigate your file systems:

filelock_timeout: <number of seconds to wait for filelock (default: wait indefinitely)>

system_paths:
  <my local system name>:
    base_data_directory: <project directory (output of pwd())>

    base_conda_name: <path to conda environment when calling conda env list>
    external_calls:
      <name of external codebase used in code>:
        entry_point: <absolute path of top project directory>
        conda_path: <path to external environment when calling conda env list>
        python_entry_point: <Name of the python file (from top level project directory sans .py)>


    (optional) data_directory_name: <name of subdirectory where untracked data is stored > (default: data)

    system_transfers:
        <non local mounted system name>:
            mount_point: <absolute path of the mount point on your local system>
            data_directory_extension: <path to the root of the data directory on the mounted system> (file_folem will look in mount_point/data_directory_extension) 

base_data_directory can be customized to an alternative location if desired.

Intializing a FileGolem object

It is best practice to have a saved system config file. From there, the syntax for initializing a FileGolem object is

data_io = FileGolem(
    system_config_path = <absolute system config path>,
    is_debug = <True or False if debug messages are desired>
)

If you need to quickly initialize a FileGolem without a saved config file, the syntax is:

system_config = {
    (See above)
}
data_io = FileGolem(
    system_config = system_config,
    is_debug = <True or False if debug messages are desired>
)

Building a file path

FilePathEntries.CUSTOM_LOGIC : '<my_static_function>'

Will call my_static_function(data_args)

which will include data_io and data_type

Dealing with h5py files

H5 files efficiently store data at scale. file_golem standardizes i/o for these files. First, create a class that inherits from H5PYAbstractDatatype:

from file_golem import H5PYAbstractDatatype
class <my h5py datatype>(H5PYAbstractDatatype):
    RELATIVE_PATH_TUPLE = H5PYAbstractDatatype.RELATIVE_PATH_TUPLE + (
        <path extension 1>, <path extension 2>, ...
        )

    FILE_STRUCTURE = {
        <node name a>: {
            H5PYAbstractDatatype.DATASET_DATATYPE: <file_golem datatype of <node name a> or H5PYAbstractDatatype.ATTRITBUTE>
            }
        <group name 0>: {
            <node name a>: {
                <file_golem datatype of <node name a> >
                },
            },
        <group name 1>: {
            <node name b>: {
                <file_golem datatype of <node name b> >,
                }
            },
        <group name 2>: {
            <group name 3>: {
                ...
            }
            <node name c>: {
                <file_golem datatype of <node name c> >
                },
            },
        }

To perform i/o, one can call the typical file_golem calls,

data_io.load_data(<my h5py datatype>, data_args={
    <my h5py datatype>.DATA: <torch or numpy tensor to save>
    <my h5py datatype>.DATASET_ADDRESS: [<group name 2>,<group name 3>,...]
    <my h5py datatype>.DATASET_SIZE: <shape of the node tensor>
    <my h5py datatype>.H5PY_IDX: <single index or tensor of indices of the full tensor>
    ...

    }
)

Metadata

Release files for file-golem 0.1.15

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

Source distribution (sdist)

Source distribution for file-golem 0.1.15
File Size Uploaded Provenance Actions
file_golem-0.1.15.tar.gz 28.8 kB Without provenance Details for file_golem-0.1.15.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for file-golem 0.1.15
File Interpreter ABI Platform Actions
file_golem-0.1.15-py3-none-any.whl Python 3 none any Details for file_golem-0.1.15-py3-none-any.whl

Total release size: 61.9 kB

Release files / file_golem-0.1.15.tar.gz

Download URL file_golem-0.1.15.tar.gz
Size 28.8 kB
Tags Source
SHA-256 checksum
How to use checksums
fdca9f27d366383b5fae20edced2dc9f5f97431bf343114b463eef8fda787d0f
BLAKE2b-256 checksum
How to use checksums
0b0587058746526fb244a5ae200283c0d8e58dd12acafda3ae7c8dbdf77fd6b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.14

Release files / file_golem-0.1.15-py3-none-any.whl

Download URL file_golem-0.1.15-py3-none-any.whl
Size 33.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8ee7e67f4f25a7159d02b31b30cc90902a8237efa289e880a21957f1dd596474
BLAKE2b-256 checksum
How to use checksums
bd5698fdab49aac97d21f6445d0b3915118f1db31629cb2f72e77a8eaf45b0a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.14

Security for file-golem 0.1.15

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.

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