-
Notifications
You must be signed in to change notification settings - Fork 25
Home
Igor Petruk edited this page Apr 10, 2023
·
10 revisions
scriptisto
is tool to enable writing one file scripts in languages that require compilation, dependencies fetching or preprocessing.
It works as a "shebang" for those scripts, extracting build instructions from a comment. If a script is changed, it rebuilds it and caches the result. If it was already built, it immediately delegates to a binary with only <1 ms overhead.
#!/usr/bin/env scriptisto
! scriptisto-begin
! script_src: script.f
! build_cmd: gfortran -ffree-form -O3 script.f -o ./script
! scriptisto-end
program script
print '("Hi, I am Fortran. Am I fast enough for you? ;)", I0)'
end program script
- Fast to develop and fast to run. Combine a scripting development experience and a performance of the heavily-optimized release build of strongly typed native languages such as C, C++ and Rust.
- Automatic dependency resolution. Fetch your dependencies behind the scenes from a language specific package manager - NPM or Cargo
-
Easy to distribute. Distribute scripts without any specific building instructions.
chmod +x
and go, provided users have a compiler andscriptisto
. -
Language agnostic.
scriptisto
's assumptions about what it runs are close to none, it fully delegates to your build+run commands andexec
. - Amortize heavy steps for scripting languages. Python does not need to be compiled, but verifying optional static types via mypy is slow. You can do it no more than once per file change.
-
Tasks for multiple files performed by one file. Example: You need to run a script in Docker - this requires multiple files, including
Dockerfile
. Produce those files behind the scenes in thescriptisto
cache directory and rebuild your Docker container only when you change your code. - Lightweight project bootstrap. Sometimes you just want to try that feature you learned in a particular programming language quickly and you don't want to go through a full project setup.
- Build in Docker. No need to have a compiler on the machine, the static binary can be linked in the container that has all the tools.
- Known disadvantages of scripts in general. As with Python/Perl scripts, if you change them, save them and you immediately rely on them working for the basic stability of your system - get ready to hit build errors at some point. Example: live editing a window manager panel script.
-
Highlighting, formatting and completion issues in editors/IDE. Strictly speaking if you add a "shebang" to your C file - this is not a correct C anymore. Use
scriptisto
if you don't heavily rely on your IDE help. Maybe someday there will be specialscriptisto
plugins for those.
If you haven't installed scriptisto
, proceed to Installation.
Ready to write some scripts? Go to Writing scripts.