Skip to main content

Host check + safe file mv — standalone module from the SciTeX ecosystem

Project description

scitex-os

SciTeX

Host check + safe file move helpers — zero-dep, pure stdlib.

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

pypi python docs

tests install-check cov


Problem and Solution

# Problem Solution
1 Host-specific scripts use socket.gethostname() == 'X' -- different style across every repo; no consistent error message when the check fails scitex_os.check_host / is_host / verify_host -- single canonical helper triple; check_host raises, is_host returns bool, verify_host warns
2 os.rename(src, dst) breaks across filesystems -- "Invalid cross-device link" when the target is on a different mount scitex_os.mv(src, dst) -- atomic when same filesystem, copy+unlink fallback otherwise; auto-creates parent dir

Installation

pip install scitex-os

Quick Start

import scitex_os as sxos

if sxos.is_host("compute-01"):
    sxos.mv(src, tgt)

1 Interfaces

Python API
import scitex_os as sxos

sxos.is_host("hostname")          # bool
sxos.check_host("hostname")       # bool
sxos.verify_host("hostname")      # raises if mismatch

sxos.mv(src, tgt)                 # shutil.move with mkdir(tgt)

Status

Standalone fork of scitex.os. Pure stdlib — zero deps. The umbrella package's scitex.os import path is preserved via a sys.modules-alias bridge.

Architecture

scitex_os/
├── _host.py              ← is_host / check_host / verify_host
├── _move.py              ← `mv` (shutil.move + mkdir(target.parent))
└── __init__.py           ← public surface (zero deps beyond stdlib)

Demo

flowchart LR
    A[script.py] -->|is_host| B{hostname<br/>matches?}
    B -- yes --> C[sxos.mv src → tgt<br/>auto mkdir parent]
    B -- no --> D[skip / raise]
import scitex_os as sxos

if sxos.is_host("compute-01"):
    sxos.mv("results/run.csv", "/shared/runs/2026-05-07/run.csv")
# parent dir is auto-created; cross-filesystem moves are handled.
$ python -c "import scitex_os; print(scitex_os.is_host('laptop'))"
True

Part of SciTeX

scitex-os is part of SciTeX. Install via the umbrella with pip install scitex[os] to use as scitex.os (Python) or scitex os ... (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-only (see LICENSE).


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_os-0.1.7.tar.gz (7.7 MB view details)

Uploaded Source

Built Distribution

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

scitex_os-0.1.7-py3-none-any.whl (7.7 MB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for scitex_os-0.1.7.tar.gz
Algorithm Hash digest
SHA256 8befcd2b97bad2a465bd9f641c2c0152d84b17417e3cdc077f2c7411f07201e4
MD5 872bb428b0a621a0e69f5d17c49a0d7e
BLAKE2b-256 e1d9a011103d9362b5b7be74329773f9630d4664db032a39cb5fa16a5fe43c61

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_os-0.1.7.tar.gz:

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

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_os-0.1.7-py3-none-any.whl.

File metadata

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

File hashes

Hashes for scitex_os-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 3f2ad5d8cbd7e20969186d6b92f68f8d73e48faf040d49606173ed8487b2304b
MD5 7d6eb2b189d51d20fcf6797563f67cde
BLAKE2b-256 71698c6a09084c2a6946f11fee059f4840290038a7929ee7736ced5749ddfaee

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_os-0.1.7-py3-none-any.whl:

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

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