Add shebang to python files is a utility
that allows python developers
to add a shebang
to their Python files.
This script can be used to add a shebang
to a python file, and also a Module Docstring
and if __name__ == '__main__'
to empty Python files.
Personally I use it in vscode
with Run on Save.
To install add shebang to python files, follow these steps:
Linux and macOS:
- Clone this repo
- Copy
add_shebang_cli.py
to yourPATH
- Make
add_shebang_cli.py
executable withchmod +x add_shebang_cli.py
To use add shebang to python files, follow these steps:
- Add the following lines in
settings.json
invscode
:
"runOnSave.commands": [
{
"match": ".*\\.py$",
"command": "add_shebang_cli.py ${file}",
"runIn": "backend"
}
]
Your python files will now be checked for shebang and if it's not present it will be added.
Add run commands and examples you think users will find useful. Provide an options reference for bonus points!
To contribute to add shebang to python files, follow these steps:
- Fork this repository.
- Create a branch:
git checkout -b <branch_name>
. - Make your changes and commit them:
git commit -m '<commit_message>'
- Push to the original branch:
git push origin <project_name>/<location>
- Create the pull request.
Alternatively see the GitHub documentation on creating a pull request.
This project uses the following license: MIT License.