Skip to content

yvan-sraka/YeAST

Repository files navigation

YeAST Build Status

Yet Another Shell Trick

What's that?

YeAST is an extension of the bourne shell shebangsyntax.

YeAST aims to solve issues of interoperability, parallel programming, quick prototyping and progressive refactoring by invite users to use in their scripts and software features of UNIX systems and build things more KISS.

You can read more about it through:

Quick Running

These instructions will get you the last stable binaries of yeast on your local machine for standard usage purposes.

Binaries installation

..on macOS using brew:

You can install YeAST on macOS using our Homebrew custom Tap:

brew install yvan-sraka/YeAST/yeast

..on others UNIX-like using the install script:

Run the following line in your terminal, then follow the onscreen instructions:

curl https://raw.githubusercontent.com/yvan-sraka/YeAST/master/install.sh -sSf | sh

If you wonder what this previous command do, don't hesitate to inspect the script: it runs all instructions of the Getting Started section.

Bootstraping

To make scripts easily work out of the box, you can add this little hack at the beggining of your files:

#! /bin/sh
#! @ignore
if ! [ -x "$(command -v yeast)" ]; then
  curl "https://raw.githubusercontent.com/yvan-sraka/YeAST/master/install.sh" -sSf | sh
fi
yeast "$0"
exit

Editors integration

You now have YeAST installed on your machine! Cool next thing to do could be to get a syntax support extension for your favorite code editor:

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

Get a stable Rust toolchain:

curl https://sh.rustup.rs -sSf | sh

Building and running

git clone [email protected]:yvan-sraka/YeAST.git
cd YeAST
cargo run basic_example.yst

Ecosystem

  • Kombucha: a simple aliases manager for YeAST
  • Palombe: which lets you send and receive messages synchronously through different processes
  • Cleopatra: make YeAST be called in place of your standard interpreter in the current environment

Real-World Examples

The basic_example available in this repository is fun to get a general idea behind YeAST! But to understand the purpose of this tool, we will go through examples inspired from REAL WORLD, mainly by my scientific domain: "Bioinformatics and Modeling".

YeAST works like cat outside interpreters

#! /usr/bin/env yeast

This text will be printed on standard output!

Besides we experiment with a Python code we expect to say "Hello World":

#! python3
print("Hello, World!")
#!

Enjoy this nice way of writing code in notebook style.

It provides multithreading by default

#! /usr/bin/env yeast

Here we try to fold 3 different sequences, so we do it in parallel by
allocating 3 threads, there is no additional syntax needed:

#! python3 folding.py
;LCBO - Prolactin precursor - Bovine
; a sample sequence in FASTA format
MDSKGSSQKGSRLLLLLVVSNLLLCQGVVSTPVCPNGPGNCQVSLRDLFDRAVMVSHYIHDLSS
EMFNEFDKRYAQGKGFITMALNSCHTSSLPTPEDKEQAQQTHHEVLMSLILGLLRSWNDPLYHL
VTEVRGMKGAPDAILSRAIEIEEENKRLLEGMEMIFGQVIPGAKETEPYPVWSGLPSLQTKDED
ARYSAFYNLLHCLRRDSSKIDTYLKLLNCRIIYNNNC*
!#

Shebang in YeAST could be any shell command that's accepting as last argument a
given file, here we use the syntax to call our external script `folding.py`.

#! python3 folding.py
>MCHU - Calmodulin - Human, rabbit, bovine, rat, and chicken
ADQLTEEQIAEFKEAFSLFDKDGDGTITTKELGTVMRSLGQNPTEAELQDMINEVDADGNGTID
FPEFLTMMARKMKDTDSEEEIREAFRVFDKDGNGYISAAELRHVMTNLGEKLTDEEVDEMIREA
DIDGDGQVNYEEFVQMMTAK*
!#

Bonus: the output of this multithreading computation will be displayed the right
order as soon that the information is available!

#! python3 folding.py
>gi|5524211|gb|AAD44166.1| cytochrome b [Elephas maximus maximus]
LCLYTHIGRNIYYGSYLYSETWNTGIMLLLITMATAFMGYVLPWGQMSFWGATVITNLFSAIPYIGTNLV
EWIWGGFSVDKATLNRFFAFHFILPFTMVALAGVHLTFLHETGSNNPLGLTSDSDKIPFHPYYTIKDFLG
LLILILLLLLLALLSPDMLGDPDNHMPADPLNTPLHIKPEWYFLFAYAILRSVPNKLGGVLALFLSIVIL
GLMPFLHTSKHRSMMLRPLSQALFWTLTMDLLTLTWIGSQPVEYPYTIIGQMASILYFSIILAFLPIAGX
IENY
!#

Roadmap

  • Create a Makefile to handle make, make test & make install intructions.
  • Validate builds using Travis CI.
  • Read input file line by line using a Buffer.
  • Use clap.rs to enhance command line interactions.
  • Allow sub-scripts to read command-line arguments, using $0, $1, etc ...
  • ... and $* for all input args.
  • Handle scripts errors correctly and display a BACKTRACE in =1|full mode
  • Let the use of #! /usr/bin/env yeast not failed in stack overflow due to an infinite loop of self-calls.
  • Fix rules for inlining shell commands in scripts.
  • Let the user write multiline commands as he did in an interactive shell.
  • Add bunch of input / output tests scripts.
  • Provide true multithreading by getting ride of the waiting lock of shell command output!
  • Write a beautiful and comprehensive man page.
  • Create an install script for handling one-instruction installation.
  • Create packages for most UNIX distributions.
  • Host a beautiful landing page on the gh-page branch of this repository.
  • Add Windows support (use cmd instead of sh and Windowsnamedpipes instead of mkfifo).
  • Create a small lib in each language to uniform the use of named pipes in sharing serialized data between processes.
  • Provide a collection of alias by adding a special environment to the PATH of command launch by YeAST.
  • Add a simple script in the path to update aliases by running a git pull.
  • Provide plugins for syntactic coloration in VSCode.
  • Let user define a top level interpreter by set YEAST_CONTEXT env variable

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting a pull requests to us.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the 3rd version of the GPL License - see the LICENSE file for details.