The best way to write code is to write no code at all.
Writing code that does nothing is great, but sometimes you still want your code to do something. This package allows you to write nothing, and still have your code do something.
Tip
It is highly recommended to use a virtual environment for proper installation of the no.pth file.
Python 3.10 or a newer version is required.
This package is intended to be used as a command-line tool.
Important
Make sure you are in an activated virtual environment. Using uv run tends to break this package.
To turn your code into no code:
You can then run no code as usual:
If, for some reason, you need to turn no code back into Python code:
If you get SyntaxError: invalid syntax, make sure the line # coding: no is present at the top of your script.
If you get SyntaxError: encoding problem: no, follow the steps below to make sure the no encoding is registered on startup:
- Run SITE_PACKAGES=$(python -c 'import sysconfig; print(sysconfig.get_path("purelib"))') to get the path to the Python site-packages directory.
- Run echo "import no_code" > "$SITE_PACKAGES/no.pth" to register the no encoding on startup.
Note
If using PowerShell, use $SITE_PACKAGES instead of SITE_PACKAGES to assign the variable.
This issue is commonly encountered when installing no-code into the user site-packages.
Not satisfied with no code? The package also provides two functions to easily convert between something and nothing.
- no_code.nothing(): Transform something (a string or bytes-like object) into nothing.
- no_code.something(): Transform nothing into something (a string or bytes-like object).
The commands no_code and yes_code also accept input from stdin if no file is provided.
Inspired by Kelsey Hightower, based on INVISIBLE.js by Martin Kleppe.
.png)

