The best way to write code is to write no code at all.
Project description
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.pthfile.
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 runtends 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:
- 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 thenoencoding on startup.
[!NOTE] If using PowerShell, use
$SITE_PACKAGESinstead ofSITE_PACKAGESto 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file no_code-0.0.2.tar.gz.
File metadata
- Download URL: no_code-0.0.2.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08cf1274596ea1dd8418102496c7c3b85ec05bce8d8242dd59e5e959fbb07b9e
|
|
| MD5 |
8b7af2a1ad91bf65de6ea0a54076b4c2
|
|
| BLAKE2b-256 |
16800d6376b4e3485dc54e2d49dbb85b7f407a19911701b6f573ff5897091106
|
File details
Details for the file no_code-0.0.2-py3-none-any.whl.
File metadata
- Download URL: no_code-0.0.2-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0beaf987fe011c8027050cb0698c548b84cdd294ce3b11bd07bf13cf13819511
|
|
| MD5 |
138676a29d85a1320eb9d2c0f57c221d
|
|
| BLAKE2b-256 |
294d6dcd3ddd4f0d82972eaeb7acc74a36005e213a4d37c6c3ce444bbedafa6c
|