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.7.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.7-py3-none-any.whl (8.3 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scitex_path-0.1.7.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.7.tar.gz
Algorithm Hash digest
SHA256 05b9492ce4f2b66a29441f5c524cfd62e7785ed21dd2da0bc6cd8406cea61c4d
MD5 1a58ff2f23eec35b69f977279dd0b5c1
BLAKE2b-256 ac3b5df76e62210b8144ce10bf254135ebb62668f83917969f62d995318ac682

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_path-0.1.7.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.7-py3-none-any.whl.

File metadata

  • Download URL: scitex_path-0.1.7-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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 ed44cb97dbca8149f0f75999ad4b0c9a0fd594839a181a719c6b85862ee1d299
MD5 66b834059fb1f601f6e0d94c7f79d814
BLAKE2b-256 f28bbfebb632098d8b737ca69bf286bf325c0295dc3386b13068f5f8e4e3704c

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_path-0.1.7-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