_
_ allows you to write Python code using only _.
Installation
[!TIP] It is highly recommended to use a virtual environment for proper installation of the
_.pthfile.
python -m pip install underscores
Python 3.9 or a newer version is required.
Usage
The following script is a "Hello, world!" program which can be executed by the Python interpreter:
# coding: _
_ ____ _ _____ _ ____ __ _ _ ___ ______ ____ _ ____ _ ___ _ ____ __ ___ _ __ _
_____ _ _ ______ _____ _ ___ _ _ _ ___ _____ ______ _ ____ _ _ _ ____ _ _ _ ____
_ ____ _ __ __ ___ _ _ ______ ___ _ ____ __ ______ _ ____ _ ____ _ ____ __ _ _
____ _ _ _ ___ _____ _____ _ _ ______ ____ _ _ ______ _____ _ __ _ ______
You can generate a script with _:
print('print("Hello, world!")'.encode("_").decode("utf-8"))
A _ command is also provided:
_ script1.py > script2.py
# or
echo 'print("Hello, world!")' | _ > script.py
Troubleshooting
If you get SyntaxError: invalid syntax, make sure the line # coding: _ is present at the top of your script.
If you get SyntaxError: encoding problem: _, follow the steps below to make sure the _ 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 underscores" > "$SITE_PACKAGES/_.pth"to register the_encoding on startup.
[!NOTE] If using PowerShell, use
$SITE_PACKAGESinstead ofSITE_PACKAGESto assign the variable.
This issue is commonly encountered when installing _ into the user site-packages.
Credits
_ is a port of _ from Ruby to Python.
Please check out the original creator mame.
Big thanks to shailist for this awesome post about custom encodings.
License
Metadata
Release files for underscores 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| underscores-0.0.4.tar.gz | 4.3 kB | Without provenance | Details |
Release files / underscores-0.0.4.tar.gz
| Download URL | underscores-0.0.4.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4afbbe4b255125223786e568b1251c35a9c0e5beb42e47cd6f8a2e10e7732739
|
|
BLAKE2b-256 checksum How to use checksums |
00c8ca5ec8918f03c13cd2d44ac850fdad5fa05ba409670a52400673e10b8d4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","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}
|
Security for underscores 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.