https://github.com/mohsenhariri/template-python
A [simple] [general-purpose] Python template 🐍🚀🎉🦕
https://github.com/mohsenhariri/template-python
boilerplate makefile package python
Last synced: 2 months ago
JSON representation
A [simple] [general-purpose] Python template 🐍🚀🎉🦕
- Host: GitHub
- URL: https://github.com/mohsenhariri/template-python
- Owner: mohsenhariri
- License: gpl-3.0
- Created: 2022-05-08T16:10:47.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-22T03:12:22.000Z (10 months ago)
- Last Synced: 2024-07-22T06:25:38.125Z (10 months ago)
- Topics: boilerplate, makefile, package, python
- Language: Makefile
- Homepage:
- Size: 68.4 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Python Template
A [simple] [general-purpose] Python template 🐍🚀🎉🦕
I used this template for [fesenjoon](https://pypi.org/project/fesenjoon/) and [medviz](https://pypi.org/project/medviz/).
## How to use
- Linux and Mac
Use GCC Makefile- Install Makefile
https://community.chocolatey.org/packages/make
http://www.cygwin.com/
### Bootstrap
Set a name for the package:
```bash
make init newName
```To use env in pool:
``` bash
make env
```There is no need to active virtual environment when the `PY` command is used from Makefile.
To use env here (local directory)
``` bash
make env-local
`````` bash
source env_platform_ver/bin/activate
```
Check Python and pip version``` bash
make
```Update pip and build tools
``` bash
make check
```Install the requirements
``` bash
make pireq
```### Install a package
``` bash
make piu numpy matplotlib scipy
```## Features
- Linter: Pylint
- Formatter: Black
- CI: GitHub Actions### ToDo
- [x] Formatter: Black + isort
- [x] Type checker: MyPy
- [x] Linter: Ruff
- [x] Linter: Pylint
- [x] GitHub Actions
- [x] Git Hooks
- [x] PyPI Publish
- [x] Flit
- [x] Poetry
- [x] Ruff### Git
Git hooks are available in ./scripts/.githooks
``` bash
chmod +x ./scripts/.githooks/scriptgit config core.hooksPath ./scripts/.githooks
```
## Publish to PyPI
1. To build a package, run:
``` bash
make pkg-build
```2. To check the build, run:
``` bash
make pkg-check
```3. To install the package locally, run:
``` bash
make pkg-install
```4. Create `.pypirc` file in the root directory of the project. It should look like this:
``` bash
[distutils]
index-servers =
pypi
testpypi[pypi]
repository: https://upload.pypi.org/legacy/
username:
password:[testpypi]
repository: https://test.pypi.org/legacy/
username:
password:
```4. To publish to PyPI, run:
``` bash
make pkg-publish
```