Python package that replicates the R package called 'here'.
Project description
Here
Python package that replicates the R package called "here".
Overview
The here package provides utility functions to determine the root directory of your project and easily resolve paths relative to it. This is particularly useful for managing file paths when calling the code from shells that cd to other directories before executing the script.
With here in R, you never ever have to deal with setwd junk.
With here in Python, you never ever have to deal with hard-coding full filepaths or working directory junk.
With both, you can define file paths *relative to the file that calls here() and it will always work!
Features
- Determine the directory of the current file.
- Resolve paths relative to the root directory.
- Supports usage in Jupyter notebooks, .py scripts, and interactive Python shells.
Installation
You can install the package using pip:
pip install --upgrade here
Example Usage
# Get the file working directory
file_working_directory = get_file_working_directory()
print(f"File working directory: {file_working_directory}")
>>> "/Users/michaelboerman/Code/here/here"
# Resolve a relative path using the here function
resolved_path = here("data/output")
print(f"Resolved path: {resolved_path}")
>>> "/Users/michaelboerman/Code/here/data/output"
It works on both .py and .ipynb files!
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file here-1.4.1.tar.gz.
File metadata
- Download URL: here-1.4.1.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b969dc174d6879061699ff903ec37a63cddbfd07e2b74107bc7ef13449c65e23
|
|
| MD5 |
4d4ba7a7fe7d0eb89f4fde67ec874de0
|
|
| BLAKE2b-256 |
bd05cc1de4b16a2ad0444c27283b6266b92dcfa271b2690b32ea6d6bc795e675
|
Provenance
The following attestation bundles were made for here-1.4.1.tar.gz:
Publisher:
python-publish.yml on michaelboerman/here
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
here-1.4.1.tar.gz -
Subject digest:
b969dc174d6879061699ff903ec37a63cddbfd07e2b74107bc7ef13449c65e23 - Sigstore transparency entry: 384934992
- Sigstore integration time:
-
Permalink:
michaelboerman/here@1d4a2687d3f9ae4db016df36d597ac3c96f98d9e -
Branch / Tag:
refs/tags/v1.4.1 - Owner: https://github.com/michaelboerman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@1d4a2687d3f9ae4db016df36d597ac3c96f98d9e -
Trigger Event:
release
-
Statement type:
File details
Details for the file here-1.4.1-py3-none-any.whl.
File metadata
- Download URL: here-1.4.1-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b1b24da7657b86a8a4fbbe40e68710e3a7950867ba52c7a1b8d6ea890a00ad3
|
|
| MD5 |
4eede020c92d945d9f1e1054b79d9766
|
|
| BLAKE2b-256 |
3299ec8a150569902ea0eb915d64c5b8f8f40c3679963e4f615066a34e36dc2e
|
Provenance
The following attestation bundles were made for here-1.4.1-py3-none-any.whl:
Publisher:
python-publish.yml on michaelboerman/here
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
here-1.4.1-py3-none-any.whl -
Subject digest:
3b1b24da7657b86a8a4fbbe40e68710e3a7950867ba52c7a1b8d6ea890a00ad3 - Sigstore transparency entry: 384935007
- Sigstore integration time:
-
Permalink:
michaelboerman/here@1d4a2687d3f9ae4db016df36d597ac3c96f98d9e -
Branch / Tag:
refs/tags/v1.4.1 - Owner: https://github.com/michaelboerman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@1d4a2687d3f9ae4db016df36d597ac3c96f98d9e -
Trigger Event:
release
-
Statement type: