From d2edf150cf2c876971383a4a484f289ce7e7f680 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 6 Jan 2025 16:22:23 -0500 Subject: Remove Python main idiom and add coding conventions to README.md I realized I don't need this stupid `__main__` convention anymore because my build system always calls Python programs like `python -m main`, so I just need to have a function named `main()`. I also started adding some general coding conventions to the README and fixed a typo. --- README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index 142c07a..f7756df 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ this command to run tests for a namespace. is our cloud VM instance. The `--time 0` argument disables the timeout (which defaults to 10 minutes), this is useful for longer builds. -`bild --json Omni/Test.hs` this just does the analysis step, and prints a +`bild --plan Omni/Test.hs` this just does the analysis step, and prints a description of the build as JSON. It will not build anything. ### lint @@ -120,6 +120,19 @@ loaded. `repl.sh --bash Omni/Log.py` this creates a nix shell for `Omni/Log.py`, but starts a bash shell for the namespace instead of a Python repl. +## Coding Conventions + +There are some conventions we use for every program, across every language in +use. + +1. At the command line interface, the program must take `test` as a first + argument, which will run the program's test suite. This is used as a standard + interface for running tests in CI. +2. The entrypoint for every program shall be called `main.` In Python, the + convention `if __name__ == "__main__"` is not necessary because `bild` wraps + the program in a call like `python -m main`; the same is true of Guile + scheme. + ## Setting up remote builds The `Omni.Dev` machine acts as a remote build server and Nix cache. To use it from -- cgit v1.2.3