Skip to main content

Compile Justfiles to portable shell scripts

Project description

just.sh

just.sh transpiles Justfiles to portable, POSIX-compatible shell scripts.

  • Run Justfile recipes without installing just
  • Run just commands in constrained environments (such as CI pipelines and Docker containers)
  • Use a justfile as a starting point for a shell script

just.sh is built as a drop-in replacement for just. It can parse any valid justfile, and generated scripts behave identically to just. In almost all cases, generated scripts even have byte-for-byte identical output to just. There are over 32,000 tests (covering every line of code!) that validate this compatibility for each commit.

Install & Quick Start

python3 -m pip install just.sh

Once installed, run just.sh to convert a justfile to a shell script. Then, run the generated script ./just.sh as you would run just.

$ ls
justfile

$ just --summary
build lint test

$ just.sh
Compiling Justfile to shell script: `justfile` -> `just.sh`

$ ls
justfile just.sh

$ ./just.sh --summary
build lint test

Project Status

I like tools that effectively achieve one well-defined goal, without growing indefinitely. My hope is for just.sh to be such a tool.

In other words, just.sh is "complete" software. I will fix bugs and make changes to matinain compatibility with just, but there are no new features planned.

As such, even if there are no recent commits, the project is not dead! Few commits means that everything has been running smoothly.

just.sh is written in Python with only one dependency outside the Python standard library: parsy, which itself has no external dependencies. All of the code is spread across two fairly small files (plus one more for tests), and every line of code is covered by tests.

Known Issues & Incompatibilities

  • Not all Just functions are implemented in shell
    • For example, many of the string manipulation functions such as trim_end_match, trim_start_match, titlecase, etc. remain to be implemented
    • Trying to compile a Justfile with an unimplemented function will raise an error
  • Some Just functions (sha256 in particular) cannot be made portable without depending on sha256sum or Python on the target system
  • Not all nested calls to just are detected. Calling just in the middle of a recipe may result in unexpected behavior
  • 100% Python line coverage guarantees that all Python code that generates shell scripts is exercised, but it does not guarantee that all generated lines of shell are exercised in tests
  • Just re-runs recipes if they are called again with a unique combination of arguments. just.sh approximates this behavior instead of replicating it, using simpler heuristics for whether a recipe has run before
  • Generated just.sh shell files may be hard to read, and are typically much larger than the Justfiles they replace
  • import, [confirm], and possibly some other recent features from Just versions greater than 1.14.0 may not yet be supported
  • The ./just.sh --dump command does not reformat Justfiles

Acknowledgments

  • Thanks to Logan Snow for testing early versions, consulting on design decisions, and being a great guy overall

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

just.sh-0.0.1rc1.tar.gz (70.4 kB view details)

Uploaded Source

Built Distribution

just.sh-0.0.1rc1-py3-none-any.whl (54.7 kB view details)

Uploaded Python 3

File details

Details for the file just.sh-0.0.1rc1.tar.gz.

File metadata

  • Download URL: just.sh-0.0.1rc1.tar.gz
  • Upload date:
  • Size: 70.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for just.sh-0.0.1rc1.tar.gz
Algorithm Hash digest
SHA256 421bd4d0385828eb639c908a164dca159f1476868bea5040b733af5a1969fdbe
MD5 7e06f402d3ffc34c9a5e1cb491c759d3
BLAKE2b-256 eb5b13299afcb115eed7f1a9ee19322a85d6c341b6fa85244776af1c0c05cae2

See more details on using hashes here.

File details

Details for the file just.sh-0.0.1rc1-py3-none-any.whl.

File metadata

  • Download URL: just.sh-0.0.1rc1-py3-none-any.whl
  • Upload date:
  • Size: 54.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for just.sh-0.0.1rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 6840bbbf3b948b8fbab1a506790bad8cbe9904cda88a7c1102dde9c726c52b2d
MD5 e7c44650182eccdcce2a108d96523288
BLAKE2b-256 be36ab0a24d5cb4cbd4063f40035da25af20f81ab5d62add929c3075893d67fc

See more details on using hashes here.

Supported by

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