Skip to main content

No Code

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.

Installation

[!TIP] It is highly recommended to use a virtual environment for proper installation of the no.pth file.

python -m pip install no-code

Python 3.10 or a newer version is required.

Usage

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:

$ cat some_code.py
print("Hello, world! 😁")

$ no_code some_code.py > no_code.py

$ cat no_code.py
# coding: no
​‌‌‌​​​​​‌‌‌​​‌​​‌‌​‌​​‌​‌‌​‌‌‌​​‌‌‌​‌​​​​‌​‌​​​​​‌​​​‌​​‌​​‌​​​​‌‌​​‌​‌​‌‌​‌‌​​​‌‌​‌‌​​​‌‌​‌‌‌‌​​‌​‌‌​​​​‌​​​​​​‌‌‌​‌‌‌​‌‌​‌‌‌‌​‌‌‌​​‌​​‌‌​‌‌​​​‌‌​​‌​​​​‌​​​​‌​​‌​​​​​‌‌‌‌​​​​‌​​‌‌‌‌‌‌​​‌‌​​​‌​​​​​​‌​​‌​​​‌​​​‌​‌​​‌​​​​‌​‌​

You can then run no code as usual:

$ python no_code.py
Hello, world! 😁

If, for some reason, you need to turn no code back into Python code:

$ yes_code no_code.py > some_code.py

$ cat some_code.py
print("Hello, world! 😁")

Troubleshooting

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:

  1. Run SITE_PACKAGES=$(python -c 'import sysconfig; print(sysconfig.get_path("purelib"))') to get the path to the Python site-packages directory.
  2. 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.

More details

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.

$ echo "print(bool(1))" | no_code | yes_code | python
True

Credits

Inspired by Kelsey Hightower, based on INVISIBLE.js by Martin Kleppe.

License

MIT License

Release files for no-code 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for no-code 0.0.2
File Size Uploaded
no_code-0.0.2.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for no-code 0.0.2
File Interpreter ABI Platform
no_code-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 10.6 kB

Release files / no_code-0.0.2.tar.gz

Download URL no_code-0.0.2.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
08cf1274596ea1dd8418102496c7c3b85ec05bce8d8242dd59e5e959fbb07b9e
BLAKE2b-256 checksum
How to use checksums
16800d6376b4e3485dc54e2d49dbb85b7f407a19911701b6f573ff5897091106
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.5 {"installer":{"name":"uv","version":"0.11.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / no_code-0.0.2-py3-none-any.whl

Download URL no_code-0.0.2-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0beaf987fe011c8027050cb0698c548b84cdd294ce3b11bd07bf13cf13819511
BLAKE2b-256 checksum
How to use checksums
294d6dcd3ddd4f0d82972eaeb7acc74a36005e213a4d37c6c3ce444bbedafa6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.5 {"installer":{"name":"uv","version":"0.11.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page