Skip to main content

Locate paths using relative path names locally and in the Cloud.

Project description

findhere

Overview

findhere provides functions that simplify using relative paths in your Python project.

Main Features

Installation

pip install findhere

Usage

In the init.py of the main repository, add:

import os
import pkg_resources

PROJECT_ROOT = os.path.abspath(
    pkg_resources.resource_filename("${1:project_name}", '..')) \
    if 'PROJECT_ROOT' not in os.environ else os.environ['PROJECT_ROOT']
os.environ['PROJECT_ROOT'] = PROJECT_ROOT

os.environ['CLOUD_ROOT'] = f"gs://{os.path.basename(PROJECT_ROOT)}" \
    if 'CLOUD_ROOT' not in os.environ else os.environ['CLOUD_ROOT']

If using datatracker,

os.environ['TRACKER_PATH'] = os.path.join(
    PROJECT_ROOT, os.path.basename(PROJECT_ROOT), 'db.json')

If versioneer has been added,

os.environ['VERSION'] = __version__

If defining directories for use with a script, use:

os.environ['VERSION'] = '0.1.1'
cloudir, localdir, filedir = init_directories(__file__)

Cite

Maintainer

Tarjinder Singh @ tsingh@broadinstitute.org

Acknowledgements

Release Notes

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

findhere-0.1.5.tar.gz (20.4 kB view hashes)

Uploaded Source

Built Distribution

findhere-0.1.5-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page