Skip to main content

Scientific project path utilities (find, split, symlink, versioning)

Project description

scitex-path

SciTeX

Scientific project path utilities — find files / git root, symlink mgmt, version increment.

Full Documentation · uv pip install scitex-path[all]

pypi python docs

tests install-check cov


Problem and Solution

# Problem Solution
1 Scripts hard-code /home/user/proj/... paths — break the moment someone else runs them find_git_root() + get_spath(filename) — paths auto-resolve to the repo root and the current script's _out/ dir
2 {script}_out/ convention implemented 33 different ways — inconsistent, error-prone Canonical helpersmk_spath, get_this_path, create_relative_symlink, find_latest standardize the pattern

Installation

pip install scitex-path

Quick Start

import scitex_path as sp

git_root = sp.find_git_root()
matches = sp.find_file("*.csv", root="/data/project")

1 Interfaces

Python API
import scitex_path as sp

# Find
sp.find_file("*.csv", root="/data/project")
sp.find_dir("results_*", root="/runs")
sp.find_git_root()
sp.find_latest("/results/experiment_v*")

# Path manipulation
sp.split("/home/user/project/data/results.csv")
sp.clean("path/with/../spaces ")
sp.getsize("/path/to/dir")

# Symlinks
sp.symlink("/data/raw", "/project/data/raw")
sp.create_relative_symlink(src, dst)
sp.list_symlinks("/project/data")
sp.fix_broken_symlinks("/project/data")
sp.resolve_symlinks(path)

# Versioning
sp.increment_version("v1.2.3", part="patch")  # "v1.2.4"

# Session paths (relative to calling script)
sp.this_path() / sp.get_this_path()
sp.get_spath(filename) / sp.mk_spath(filename)

Architecture

scitex_path/
├── _find.py              ← find_file, find_dir, find_git_root, find_latest
├── _split_clean.py       ← split, clean, getsize
├── _symlink.py           ← symlink, create_relative_symlink,
│                            list_symlinks, fix_broken_symlinks, resolve_symlinks
├── _version.py           ← increment_version (semver bumps)
└── _session.py           ← this_path / get_spath / mk_spath
                            (caller-script-relative `_out/` dirs)

Demo

flowchart LR
    A[script.py] -->|find_git_root| B[repo root]
    A -->|mk_spath| C[script_out/]
    C --> D[results.csv]
    D -->|create_relative_symlink| E[repo/latest.csv]
    F[/runs/experiment_v*/] -->|find_latest| G[experiment_v17]
import scitex_path as sp

root = sp.find_git_root()                          # → /home/me/proj/myrepo
out  = sp.mk_spath("results.csv")                  # → <script>_out/results.csv
sp.create_relative_symlink(out, root / "latest.csv")
print(sp.find_latest("/runs/experiment_v*"))       # → /runs/experiment_v17
/home/me/proj/myrepo
/home/me/proj/myrepo/scripts/train_out/results.csv
/runs/experiment_v17

Part of SciTeX

scitex-path is part of SciTeX. Install via the umbrella with pip install scitex[path] to use as scitex.path (Python) or scitex path ... (CLI).

Four Freedoms for Research

  1. The freedom to run your research anywhere — your machine, your terms.
  2. The freedom to study how every step works — from raw data to final manuscript.
  3. The freedom to redistribute your workflows, not just your papers.
  4. The freedom to modify any module and share improvements with the community.

AGPL-3.0 — because we believe research infrastructure deserves the same freedoms as the software it runs on.

License

AGPL-3.0 — see LICENSE for details.


SciTeX

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

scitex_path-0.1.6.tar.gz (8.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scitex_path-0.1.6-py3-none-any.whl (8.3 MB view details)

Uploaded Python 3

File details

Details for the file scitex_path-0.1.6.tar.gz.

File metadata

  • Download URL: scitex_path-0.1.6.tar.gz
  • Upload date:
  • Size: 8.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scitex_path-0.1.6.tar.gz
Algorithm Hash digest
SHA256 57649ef12615568e105c0597664357b2564d23ff38f24051f58cb8f51734d110
MD5 47f67f0c0bbf58eb0fb39f3ff8036028
BLAKE2b-256 615b9ea87aa81ac2517f0496266d1ab73b0fdf7189b9da73e81f5fa4979caab6

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_path-0.1.6.tar.gz:

Publisher: pypi-publish-and-github-release-on-tag.yml on ywatanabe1989/scitex-path

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scitex_path-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: scitex_path-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 8.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scitex_path-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 8d89cbc3a2f09a5fa1568cf7d5649b7657a66a8d310211c8fcab61c0bccd0b62
MD5 a35e289292cbd6711ab8e2e279c31e6e
BLAKE2b-256 36cc950b281f7cfe523f90c08c95d0ac5b1c4b8c33b866a24c0f448732f22ba3

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_path-0.1.6-py3-none-any.whl:

Publisher: pypi-publish-and-github-release-on-tag.yml on ywatanabe1989/scitex-path

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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