./
Dot Slash is a filepath helper that does one job; it resolves a filepath relative to the directory of the file where it is invoked. Which sounds more complicated than it is. In other words, if you find yourself thinking, "I need to access a file and I know its location relative to the code I'm writing now, but I don't really know/care where it is relative to the root of my filesystem, and I'd rather not worry about what the working directory is when I run this code" then you are in the right place.
Usage
from pathlib import Path
from dot_slash import dot_slash
contents = Path(dot_slash("my_sibling.json")).read_text()
print(contents)
A Few Examples
Given the following file layout, where you are invoking dot_slash() from invoker.py,
which (please note) is not in the working directory
/root/some/path/to/working_dir
│
├─ A
│ ├ invoker.py
│ └ sibling.txt
│
└─ B
└ cousin.json
these paths resolve as follows
# invoker.py
from dot_slash import dot_slash
dot_slash("..") # -> /root/some/path/to/working_dir/
dot_slash(".") # -> /root/some/path/to/working_dir/A/
dot_slash("sibling.txt") # -> /root/some/path/to/working_dir/A/sibling.txt
dot_slash("../B/cousin.json") # -> /root/some/path/to/working_dir/B/cousin.json
Metadata
Release files for dot-slash 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dot_slash-1.0.0.tar.gz | 2.3 kB | Without provenance | Details for dot_slash-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dot_slash-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for dot_slash-1.0.0-py3-none-any.whl |
Total release size: 5.1 kB
Release files / dot_slash-1.0.0.tar.gz
| Download URL | dot_slash-1.0.0.tar.gz |
|---|---|
| Size | 2.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
102d623f397490f984f2dc621ab93353f4a47adb67708f8ee39b15b7b2130e0c
|
|
BLAKE2b-256 checksum How to use checksums |
c358ad162bd215a314007ba318e0f3d0f5b60ecbde1d4cd1a0892d7d818ab5ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.10.12 Linux/5.15.133.1-microsoft-standard-WSL2
|
Release files / dot_slash-1.0.0-py3-none-any.whl
| Download URL | dot_slash-1.0.0-py3-none-any.whl |
|---|---|
| Size | 2.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bbe6fd33f928eaee11ce3f88ccb024f3cb2bfe85cd898d0bc319660f97189169
|
|
BLAKE2b-256 checksum How to use checksums |
5b67baca6002ad0b12e31ef89d55e2d62d2db21b032568ee5cfffaf0ebdfc796
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.10.12 Linux/5.15.133.1-microsoft-standard-WSL2
|
Security for dot-slash 1.0.0
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.