Python package and CLI template available on both PyCharm and Visual Studio Code (VSCode)
PyCharm | VSCode | Commands | |
---|---|---|---|
Type check | via PyCharm | via Pylance | make check |
Format/Check (black/isort) | ✔ | ✔ | make format/check |
Test (pytest/doctest) | ✔ | ✔ | make test |
- Click
Use this template
in github.com/sotetsuk/python-template - Write up
setup.py
- If you do not create CLI, please remove
entory_points
- If you do not create CLI, please remove
- Rename Python package name following the instruction below
- For CLI usage, please rename command name folowing the instruction below
- Attach new CI badge
- Attach new License
$ export PKG_NAME=<YOUR PACKAGE NAME>
$ git mv mypkg ${PKG_NAME}
$ for f in $(git grep mypkg | cut -d ":" -f 1); do sed -i "" -e "s/mypkg/${PKG_NAME}/" ${f} ; done
$ export CMD_NAME=<YOUR COMMAND NAME>
$ for f in $(git grep mycmd | cut -d ":" -f 1); do sed -i "" -e "s/mycmd/${PKG_NAME}/" ${f} ; done
This project uses virtualenv in <repo-root>/venv
. Please initialize it if not exists.
- PyCharm:
Preferences
=>Python Interpreter
=>Add
- VSCode: Manually prepare it or run
$ make venv
- PyCharm: Run tests - Help | PyCharm
- Add
pytest
Script path
:<project-root>/<your pkg name>
Parameters
:--doctest-modules
- Add
- VSCode: Python testing in Visual Studio Code
MIT License