Skip to main content

A simple project framework to keep you from getting burned

Project description

port

A simple project framework.

port facilitates rapid, reproducible development for local research projects.

Project structure

port requires a specific project structure.

An example project directory looks like this:

my_project -> inputs/ ---> some_file.csv -> outputs/ -> local.py -> environment.yml -> a010_clean_data.py -> a020_calculate.py -> a030_visualize.py

Each script has an ID (the part of the name before the first _).

The file called local.py defines the inputs and outputs of the scripts. In this file, outputs are also given the same prefix.

For example:

from pathlib import Path

input_path = Path("inputs")
output_path = Path("outputs")

raw_data_path = input_path / "raw data.csv"

a010_clean_data_path = output_path / "a010_cleaned_outputs.csv"
a020_calculated_data_path = output_path / "a020_calculated_results.csv"
a030_result_plot = output_path / "a030_result_plot.png"

This provides port with all the required information to figure out the relationships between scripts and their outputs.

Init

Creates a port project skeleton.

This provides a small Rich interface to get information about the project name and backend, or they can be provided via command-line flags.

Supported backends are:

port init test_project --backend uv

Run

port run runs the entire project up to and including a target ID. It automatically calculates stale or missing results that a030 depends on.

For example:

port run a030

This first gets the directed acyclic graph (DAG) that defines a030's dependencies. It then uses file output mtime values to determine if any results need to be re-run. This includes:

  • Requiring that, for a given output, all dependency outputs have an mtime less than or equal to the current output.
  • Requiring all outputs to have an mtime greater than or equal to the script that creates them.

Flags include:

  • --force: rerun the specified task.
  • --force-all: rerun all affected tasks.
  • --debug: If true, drop into a pdb debugger on failure.

Remove

Remove results from specified tasks.

port remove a020  # removes the results for a020

Parse

Although typically called automatically by other commands, it can be used manually to parse script structure/dependencies and update timestamps.

port parse  # parse current directory, or pass a path

The flag --dryrun can be used to simply validate the project structure.

Guiding principles

  • port is always optional. A project can be fully executed by running the scripts in order. It is there when you want it, and it gets out of your way when you don't.

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

stooge-0.1.0.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

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

stooge-0.1.0-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: stooge-0.1.0.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for stooge-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9175c33b17d9e9c85e8724b6e5b42f646818f7e3e3f787b472e64ea924da41f8
MD5 503ebaac1b50d7c9f10ff950256bf836
BLAKE2b-256 5b119594eb99c9c2a96f10a7b676463076fac3f88bb21ec3e65762650be3d7bf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: stooge-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for stooge-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b38cec1f169a6b9183ebf925053205ecb3b3b3e014993061ddaeb1ea51e30c64
MD5 3e996984b97dab9f1e4e9e2160bd6a7f
BLAKE2b-256 79031cc5932c844c3994d85a647d74e76236caaaf69eb14bc9c4a167fcd873c4

See more details on using hashes here.

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