Oil is a new Unix shell. It's our upgrade path from bash to a better language and runtime

Related tags

Command-line Toolsoil
Overview

Oil Source Code

Build Status

Oil is a new Unix shell. It's our upgrade path from bash to a better language and runtime! (Why Create a New Unix Shell? / 2019 FAQ)

It's written in Python, so the code is short and easy to change. But we automatically translate it to C++ with custom tools, to make it fast and small. The deployed executable doesn't depend on Python.

This README is at the root of the git repo.

Contributing

  • Try making the dev build of Oil with the instructions on the Contributing page. This should take 1 to 5 minutes if you have a Linux machine.
  • If it doesn't, let us know. You can post on the #oil-dev channel of oilshell.zulipchat.com, or file an issue on Github.
  • Feel free to grab an issue from Github. Let us know what you're thinking before you get too far.

Quick Start on Linux

After following the instructions on the Contributing page, you'll have a Python program that you can quickly run and change! Try it interactively:

bash$ bin/osh

osh$ name=world
osh$ echo "hello $name"
hello world
  • Try running a shell script you wrote with bin/osh myscript.sh.
  • Try the Oil language with bin/oil.

Let us know if any of these things don't work! The continuous build tests them at every commit.

Dev Build vs. Release Build

Again, note that the developer build is very different from the release tarball. The Contributing page describes this difference in detail.

The release tarballs are linked from the home page. (Developer builds don't work on OS X, so use the release tarballs on OS X.)

Important: We Accept Small Contributions!

Oil is full of many ideas, which may be intimidating at first.

But the bar to contribution is very low. It's basically a medium size Python program with many tests, and many programmers know how to change such programs. It's great for prototyping.

  • For OSH compatibility, I often merge failing spec tests. You don't even have to write code! The tests alone help. I search for related tests with grep xtrace spec/*.test.sh, where xtrace is a shell feature.
  • You only have to make your code work in Python. Plain Python programs are easy to modify. The semi-automated translation to C++ is a separate step, although it often just works.
  • You can influence the design of the Oil language. If you have an itch to scratch, be ambitious. For example, you might want to show us how to implement nonlinear pipelines.

Docs

The Wiki has many developer docs. Feel free to edit them. If you make a major change, let us know on Zulip!

There are also READMEs in some subdirectories, like opy/ and mycpp/.

If you're confused, the best thing to do is to ask on Zulip and someone should produce a pointer and/or improve the docs.

Docs for end users are linked from each release page.

Repository Structure

Try this to show a summary of what's in the repo and their line counts:

$ metrics/source-code.sh overview

(Other functions in this file may be useful as well.)

A Collection of Interpreters

Oil is naturally structured as a set of mutually recursive parsers and evaluators. These interpreters are specified at a high-level: with regular languages, Zephyr ASDL, and a statically-typed subset of Python.

bin/              # Main entry points like bin/osh (source in bin/oil.py)
frontend/         # Lexing/Parsing code common to Oil and OSH
osh/              # OSH parsers and evaluators (cmd, word, sh_expr)
oil_lang/         # Oil parser and evaluator
core/             # Other code shared between Oil and OSH
pylib/            # Borrowed from the Python standard library.
tools/            # User-facing tools, e.g. the osh2oil translator

DSLs / Code Generators

Here are the tools that transform that high-level code to efficient code:

asdl/             # ASDL implementation, derived from CPython
pgen2/            # Parser Generator, borrowed from CPython
mycpp/            # Experimental translator from typed Python to C++.
                  # Depends on MyPy.
opy/              # Python compiler in Python (mycpp/ will replace it)
  lib/            # Common code
  compiler2/      # Bytecode compiler
  byterun/        # Metacircular bytecode VM in Python
  gold/           # tests
  byterun/        # Unused bytecode interpreter

Native Code

We have native code to support both the dev build (running under CPython) and the oil-native build (pure C++):

Python-2.7.13/    # CPython is the initial basis for the Oil VM
native/           # Python extension modules, e.g. libc.c
cpp/              # C++ code which complements the mycpp translation

Several Kinds of Tests

Unit tests are named foo_test.py and live next to foo.py.

test/             # Test automation
  gold/           # Gold Test cases
  gold.sh         
  sh_spec.py      # shell spec test framework
  spec.sh         # Types of test runner: spec, unit, gold, wild
  unit.sh         
  wild.sh
testdata/
spec/             # Spec test cases
  bin/            # tools used in many spec tests
  testdata/       # scripts for specific test cases
  errors/         # TODO: migrate these bad shell scripts
types/            # Scripts for running MyPy and PyAnnotate, etc.

Dev Tools and Scripts

We use a lot of automation to improve the dev process. It's largely written in shell, of course!

benchmarks/       # Benchmarks should be run on multiple machines.
metrics/          # Metrics don't change between machines (e.g. code size)
client/           # Demonstration of OSH as a headless server.
build/            # Build automation
  oil-defs/       # Files that define our slice of CPython.
  dev.sh          # For development builds, running CPython
devtools/         # For Oil developers (not end users)
  release.sh      # The (large) release process.
demo/             # Demonstrations of bash/shell features.  Could be
                  # moved to tests/ if automated.
  old/            # A junk drawer.
web/              # HTML/JS/CSS for tests and tools
soil/             # Multi-cloud continuous build (e.g. sourcehut, Github)
services/         # Other cloud services

Temp Dirs

Directories that begin with _ are not stored in git. The dev tools above create and use these dirs.

_bin/             # Native executables are put here
_build/           # Temporary build files
_devbuild/        # Developer build files not deleted upon 'make clean'
  gen/            # Generated Python and C code
_deps/            # build dependencies like re2c
_tmp/             # Test suites and other temp files
  spec/
  wild/
    raw/
    www/
  osh-parser/
  osh-runtime/
  vm-baseline/
  oheap/
  startup/
  ...
_release/         # Source release tarballs are put here
  VERSION/        # Published at oilshell.org/release/$VERSION/
    benchmarks/
    doc/
    metrics/
    test/
      spec.wwz
      wild.wwz
      ...
    web/          # Static files, copy of $REPO_ROOT/web
      table/

Build System for End Users

This is very different than the developer build of Oil.

Makefile
configure
install

Doc Sources

doc/              # A mix of docs
doctools/         # Tools that use lazylex/ to transform Markdown/HTML
lazylex/          # An HTML lexer which doctools/ builds upon.
README.md         # This page, which is For Oil developers

LICENSE.txt       # For end users
INSTALL.txt

More info

Python Files Not Translated to C++

mycpp/
  mylib.py  # statically typed equivalents of Python's data structures
pylib/      # copied from Python stdlib
core/
  py{error,os,util}.py  # too complicated to translate
*/*_def.py  # abstract definitions
*/*_gen.py  # code generators
A simple command line tool written in python to manage a to-do list

A simple command line tool written in python to manage a to-do list Dependencies: python Commands: todolist (-a | --add) [(-p | --priority)] [(-l | --

edwloef 0 Nov 02, 2021
Runs a command in P4wnP1 and displays the output on OLED screen (SH1106)

p4wnp1-oled-terminal Runs a command in P4wnP1 and displays the output on OLED screen (SH1106) Works on Raspberry Pi Zero 2 W Tested successfully on RP

PawnSolo 1 Dec 14, 2021
OneDriveExplorer - A command line and GUI based application for reconstructing the folder structure of OneDrive from the UserCid.dat file

OneDriveExplorer - A command line and GUI based application for reconstructing the folder structure of OneDrive from the UserCid.dat file

Brian Maloney 100 Dec 13, 2022
A Python-based Wordle solver and CLI player

Wordle A Python-based Wordle solver and CLI player This was created using Python 3.9.7. SPOILER ALERT: the data directory contains spoilers for upcomi

Will Fitzgerald 1 Jul 24, 2022
Spotify Offline is a command line tool that allows one to download Spotify playlists in MP3 format.

Spotify Offline v0.0.2 listen to your favorite spotify songs, offline Overview Spotify Offline (spotifyoffline) is a command line tool that allows one

Aarush Gupta 1 Nov 28, 2021
Dead simple CLI tool to try Python packages - It's never been easier! :package:

try - It's never been easier to try Python packages try is an easy-to-use cli tool to try out Python packages. Features Install specific package versi

Timo Furrer 659 Dec 28, 2022
A command-line utility that creates projects from cookiecutters (project templates), e.g. Python package projects, VueJS projects.

Cookiecutter A command-line utility that creates projects from cookiecutters (project templates), e.g. creating a Python package project from a Python

18.6k Dec 30, 2022
CLI tool to develop StarkNet projects written in Cairo

OpenZeppelin Nile ⛵ Navigate your StarkNet projects written in Cairo. Getting started Create a folder for your project and cd into it: mkdir myproject

OpenZeppelin 305 Dec 30, 2022
Python API and CLI for the ikea IDÅSEN desk.

idasen This is a heavily modified fork of rhyst/idasen-controller. The IDÅSEN is an electric sitting standing desk with a Linak controller sold by ike

Alex 79 Dec 14, 2022
Module for converting 2D Python lists to fancy ASCII tables. Table2Ascii lets you display pretty tables in the terminal and on Discord.

table2ascii Module for converting 2D Python lists to a fancy ASCII/Unicode tables table2ascii 📥 Installation 🧑‍💻 Usage Convert lists to ASCII table

Jonah Lawrence 40 Jan 03, 2023
A small system that allow you to manage hosts stored in your .ssh/config file

A small system that allow you to manage hosts stored in your .ssh/config using simple commands.

Simone Ostini 1 Jan 24, 2022
Regis-ltmpt-auto - Program register ltmpt 2022 automatis

LTMPT Register Otomatis 2022 Program register ltmpt 2022 automatis dibuat untuk

1 Jan 13, 2022
A Julia library for solving Wordle puzzles.

Wordle.jl A Julia library for solving Wordle puzzles. Usage julia import Wordle: play julia play("panic") 4 julia play("panic", verbose = true) I

John Myles White 3 Jan 23, 2022
A collection of command-line interface games written in python

Command Line Interface Python Games Collection of some starter python game projects for beginners How to play these games Clone this repository git cl

Paras Gupta 7 Jun 06, 2022
Run an FFmpeg command and see the percentage progress and ETA.

Run an FFmpeg command and see the percentage progress and ETA.

25 Dec 22, 2022
CLI Web-CAT interface for people who use VIM.

CLI Web-CAT CLI Web-CAT interface. Installation git clone https://github.com/phuang1024/cliwebcat cd cliwebcat python setup.py bdist_wheel sdist cd di

Patrick 4 Apr 11, 2022
A simple CLI application helps you to find giant files that are eating up your system storage

Large file finder Sometimes it's very hard to find if some giant files are eating up your system storage. We might need to hunt those down. This simpl

Rahul Baruri 5 Nov 18, 2022
Command-line parsing library for Python 3.

Command-line parsing library for Python 3.

36 Dec 15, 2022
Enriches Click with option groups, constraints, command aliases, help sections for subcommands, themes for --help and other stuff.

Enriches Click with option groups, constraints, command aliases, help sections for subcommands, themes for --help and other stuff.

Gianluca Gippetto 62 Dec 22, 2022
Command line tool for interacting and testing warehouse components

Warehouse debug CLI Example usage for Zumo debugging See all messages queued and handled. Enable by compiling the zumo-controller with -DDEBUG_MODE_EN

1 Jan 03, 2022