Strip comments from scripts, intended for use with MicroPython and other storage constrained environments
Nudatus is a tool to remove comments from Python scripts.
It was created for use in uflash to help squeeze longer programs onto the micro:bit but it should be suitable for various environments with restricted storage.
Note Nudatus uses the tokenizer built into Python so only supports the syntax of the version it’s running on, but it’s extremely unlikely this will cause you any issues (print is handled fine).
Personally I pronounce nudatus as new-dat-us which I appreciate is probably ‘wrong’.
nudatus [-h] [--version] [input] [output]
An input file must be specified but if output is omitted the result will be printed on stdout.
Calling from a Python script is quite simple:
import nudatus source = '' # Input script result = nudatus.mangle(source) # Result as str
- Drop support for everything below Python 3.5
- Format with black
- Add type annotations (not that there is much to type)
- Respect the contents of lists and dicts
- Initial release.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size nudatus-0.0.5.tar.gz (4.8 kB)||File type Source||Python version None||Upload date||Hashes View|
|Filename, size nudatus-0.0.5-py3-none-any.whl (5.3 kB)||File type Wheel||Python version py3||Upload date||Hashes View|