Skip to main content

Shared utilities for recipes in the Atomistic Cookbook.

Project description

atomistic-cookbook-utils

Small shared utilities used by the recipes in the Atomistic Cookbook.

The goal is to keep recipe code focused on the science: any boilerplate that would otherwise be copy-pasted across many recipes lives here.

Installation

pip install atomistic-cookbook-utils

For a recipe's environment.yml, add it under pip: with a semantic version range, e.g.

- atomistic-cookbook-utils >=0.1,<0.2

Contents

download_with_retry

Download a file with automatic retries on transient HTTP errors (429, 500, 502, 503, 504). Skips the download if the file already exists, creates parent directories as needed.

from atomistic_cookbook_utils import download_with_retry

download_with_retry(
    "https://zenodo.org/records/10566825/files/gaas_training.xyz",
    "data/gaas_training.xyz",
)

run_command

Run a shell-like command string without invoking a shell. The string is split with shlex.split, so quoting works as expected; pipes, redirection and globs do not — for those, use subprocess directly.

By default the child inherits the parent's stdout and stderr. Pass print_output=True to capture the command's combined output and re-emit it via print() — this makes the output visible in sphinx-gallery rendered cells (which capture sys.stdout but not raw file-descriptor writes from child processes).

from atomistic_cookbook_utils import run_command

run_command("mtt train options.yaml")
run_command("ls -la", cwd="data", print_output=True)

Source

This package is developed inside the cookbook repository at src/atomistic-cookbook-utils/. See CONTRIBUTING.rst at the repo root for development workflow.

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

atomistic_cookbook_utils-0.1.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

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

atomistic_cookbook_utils-0.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file atomistic_cookbook_utils-0.1.0.tar.gz.

File metadata

  • Download URL: atomistic_cookbook_utils-0.1.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for atomistic_cookbook_utils-0.1.0.tar.gz
Algorithm Hash digest
SHA256 65d6aa94d75cfeefd395e2c78e46ad9384268d0386f26ff17e191e81015d1036
MD5 07cfa7559a5dab61176a7148efc14c77
BLAKE2b-256 13523e758957345601747d498f87468505b3c6cb65464b78597815f4ac21a6af

See more details on using hashes here.

Provenance

The following attestation bundles were made for atomistic_cookbook_utils-0.1.0.tar.gz:

Publisher: publish-utils.yml on lab-cosmo/atomistic-cookbook

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

File details

Details for the file atomistic_cookbook_utils-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for atomistic_cookbook_utils-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 56603cfa35f77935f3e19623a6157940603b70a2d4ac08abea0f12f11aa0c66d
MD5 a1e377a821aca787a526037c20db9d68
BLAKE2b-256 2e7fb707df1fd45d772815b2d4c6e600c3b0ab05381a75441a6d777c23f511ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for atomistic_cookbook_utils-0.1.0-py3-none-any.whl:

Publisher: publish-utils.yml on lab-cosmo/atomistic-cookbook

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