Compare commits
2 Commits
ec2c2ea536
...
71a814045c
Author | SHA1 | Date | |
---|---|---|---|
71a814045c | |||
f9037273e8 |
@ -10,7 +10,7 @@ do
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [ -z "${template}" ]; then
|
if [ -z "${template}" ]; then
|
||||||
echo "Available templates: flask"
|
echo "Available templates: Flask"
|
||||||
read -p "Enter template name: " template
|
read -p "Enter template name: " template
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ function download_template {
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo "Using template:${template}"
|
echo "Using template:${template}"
|
||||||
template_url="https://github.com/rochacbruno/${template}-project-template"
|
template_url="https://git.disi.dev/Templates/${template}"
|
||||||
template_dir=".gitea/templates/${template}"
|
template_dir=".gitea/templates/${template}"
|
||||||
if [ -d "${template_dir}" ]; then
|
if [ -d "${template_dir}" ]; then
|
||||||
# Template directory already exists
|
# Template directory already exists
|
||||||
|
@ -30,23 +30,23 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
body_path: release_message.md
|
body_path: release_message.md
|
||||||
|
|
||||||
deploy:
|
# deploy:
|
||||||
needs: release
|
# needs: release
|
||||||
runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
steps:
|
# steps:
|
||||||
- uses: actions/checkout@v3
|
# - uses: actions/checkout@v3
|
||||||
- name: Set up Python
|
# - name: Set up Python
|
||||||
uses: actions/setup-python@v4
|
# uses: actions/setup-python@v4
|
||||||
with:
|
# with:
|
||||||
python-version: '3.x'
|
# python-version: '3.x'
|
||||||
- name: Install dependencies
|
# - name: Install dependencies
|
||||||
run: |
|
# run: |
|
||||||
python -m pip install --upgrade pip
|
# python -m pip install --upgrade pip
|
||||||
pip install setuptools wheel twine
|
# pip install setuptools wheel twine
|
||||||
- name: Build and publish
|
# - name: Build and publish
|
||||||
env:
|
# env:
|
||||||
TWINE_USERNAME: __token__
|
# TWINE_USERNAME: __token__
|
||||||
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
# TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
||||||
run: |
|
# run: |
|
||||||
python setup.py sdist bdist_wheel
|
# python setup.py sdist bdist_wheel
|
||||||
twine upload dist/*
|
# twine upload dist/*
|
||||||
|
@ -93,11 +93,8 @@ People automating CI for your project will be grateful for having a setup.py fil
|
|||||||
### Why isn't this template made as a cookiecutter template?
|
### Why isn't this template made as a cookiecutter template?
|
||||||
|
|
||||||
I really like [cookiecutter](https://github.com/cookiecutter/cookiecutter) and it is a great way to create new projects,
|
I really like [cookiecutter](https://github.com/cookiecutter/cookiecutter) and it is a great way to create new projects,
|
||||||
but for this template I wanted to use the Github `Use this template` button,
|
|
||||||
to use this template doesn't require to install extra tooling such as cookiecutter.
|
to use this template doesn't require to install extra tooling such as cookiecutter.
|
||||||
|
|
||||||
Just click on [Use this template](https://github.com/rochacbruno/python-project-template/generate) and you are good to go.
|
|
||||||
|
|
||||||
The substituions are done using gitea actions and a simple sed script.
|
The substituions are done using gitea actions and a simple sed script.
|
||||||
|
|
||||||
### Why `VERSION` is kept in a static plain text file?
|
### Why `VERSION` is kept in a static plain text file?
|
||||||
@ -115,7 +112,7 @@ with module imports or anything else, it is useful for CI, logs and debugging.
|
|||||||
### Why to include `tests`, `history` and `Containerfile` as part of the release?
|
### Why to include `tests`, `history` and `Containerfile` as part of the release?
|
||||||
|
|
||||||
The `MANIFEST.in` file is used to include the files in the release, once the
|
The `MANIFEST.in` file is used to include the files in the release, once the
|
||||||
project is released to PyPI all the files listed on MANIFEST.in will be included
|
project is released to artifactory all the files listed on MANIFEST.in will be included
|
||||||
even if the files are static or not related to Python.
|
even if the files are static or not related to Python.
|
||||||
|
|
||||||
Some build systems such as RPM, DEB, AUR for some Linux distributions, and also
|
Some build systems such as RPM, DEB, AUR for some Linux distributions, and also
|
||||||
|
@ -7,10 +7,10 @@ project_name welcomes contributions from the community.
|
|||||||
This instructions are for linux base systems. (Linux, MacOS, BSD, etc.)
|
This instructions are for linux base systems. (Linux, MacOS, BSD, etc.)
|
||||||
## Setting up your own fork of this repo.
|
## Setting up your own fork of this repo.
|
||||||
|
|
||||||
- On github interface click on `Fork` button.
|
- On gitea interface click on `Fork` button.
|
||||||
- Clone your fork of this repo. `git clone git@github.com:YOUR_GIT_USERNAME/project_urlname.git`
|
- Clone your fork of this repo. `git clone git@git.disi.dev:YOUR_GIT_USERNAME/project_urlname.git`
|
||||||
- Enter the directory `cd project_urlname`
|
- Enter the directory `cd project_urlname`
|
||||||
- Add upstream repo `git remote add upstream https://github.com/author_name/project_urlname`
|
- Add upstream repo `git remote add upstream https://git.disi.dev/author_name/project_urlname`
|
||||||
|
|
||||||
## Setting up your own virtual environment
|
## Setting up your own virtual environment
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ Run `git push origin my_contribution`
|
|||||||
|
|
||||||
## Submit a pull request
|
## Submit a pull request
|
||||||
|
|
||||||
On github interface, click on `Pull Request` button.
|
On gitea interface, click on `Pull Request` button.
|
||||||
|
|
||||||
Wait CI to run and one of the developers will review your PR.
|
Wait CI to run and one of the developers will review your PR.
|
||||||
## Makefile utilities
|
## Makefile utilities
|
||||||
@ -94,11 +94,8 @@ init: ## Initialize the project based on an application template.
|
|||||||
## Making a new release
|
## Making a new release
|
||||||
|
|
||||||
This project uses [semantic versioning](https://semver.org/) and tags releases with `X.Y.Z`
|
This project uses [semantic versioning](https://semver.org/) and tags releases with `X.Y.Z`
|
||||||
Every time a new tag is created and pushed to the remote repo, github actions will
|
Every time a new tag is created and pushed to the remote repo, gitea actions will
|
||||||
automatically create a new release on github and trigger a release on PyPI.
|
automatically create a new release on gitea.
|
||||||
|
|
||||||
For this to work you need to setup a secret called `PIPY_API_TOKEN` on the project settings>secrets,
|
|
||||||
this token can be generated on [pypi.org](https://pypi.org/account/).
|
|
||||||
|
|
||||||
To trigger a new release all you need to do is.
|
To trigger a new release all you need to do is.
|
||||||
|
|
||||||
|
4
Makefile
4
Makefile
@ -76,7 +76,7 @@ virtualenv: ## Create a virtual environment.
|
|||||||
|
|
||||||
.PHONY: release
|
.PHONY: release
|
||||||
release: ## Create a new tag for release.
|
release: ## Create a new tag for release.
|
||||||
@echo "WARNING: This operation will create s version tag and push to github"
|
@echo "WARNING: This operation will create a version tag and push to gitea"
|
||||||
@read -p "Version? (provide the next x.y.z semver) : " TAG
|
@read -p "Version? (provide the next x.y.z semver) : " TAG
|
||||||
@echo "$${TAG}" > project_name/VERSION
|
@echo "$${TAG}" > project_name/VERSION
|
||||||
@$(ENV_PREFIX)gitchangelog > HISTORY.md
|
@$(ENV_PREFIX)gitchangelog > HISTORY.md
|
||||||
@ -85,7 +85,7 @@ release: ## Create a new tag for release.
|
|||||||
@echo "creating git tag : $${TAG}"
|
@echo "creating git tag : $${TAG}"
|
||||||
@git tag $${TAG}
|
@git tag $${TAG}
|
||||||
@git push -u origin HEAD --tags
|
@git push -u origin HEAD --tags
|
||||||
@echo "Github Actions will detect the new tag and release the new version."
|
@echo "Gitea Actions will detect the new tag and release the new version."
|
||||||
|
|
||||||
.PHONY: docs
|
.PHONY: docs
|
||||||
docs: ## Build the documentation.
|
docs: ## Build the documentation.
|
||||||
|
33
README.md
33
README.md
@ -4,27 +4,22 @@
|
|||||||
A low dependency and really simple to start project template for Python Projects.
|
A low dependency and really simple to start project template for Python Projects.
|
||||||
|
|
||||||
See also
|
See also
|
||||||
- [Flask-Project-Template](https://github.com/rochacbruno/flask-project-template/) for a full feature Flask project including database, API, admin interface, etc.
|
- [Flask-Project-Template](https://git.disi.dev/Templates/Flask/) for a full feature Flask project including database, API, admin interface, etc.
|
||||||
- [FastAPI-Project-Template](https://github.com/rochacbruno/fastapi-project-template/) The base to start an openapi project featuring: SQLModel, Typer, FastAPI, JWT Token Auth, Interactive Shell, Management Commands.
|
|
||||||
|
|
||||||
### HOW TO USE THIS TEMPLATE
|
### HOW TO USE THIS TEMPLATE
|
||||||
|
|
||||||
1. Choose a name for your project
|
1. Create a new repository from this template and choose a name for your project
|
||||||
(e.g. `my_awesome_project` recommendation is to use all lowercase and underscores separation for repo names.)
|
(e.g. `my_awesome_project` - recommendation is to use all lowercase and underscores separation for repo names.)
|
||||||
2. Replace all text instances of "project_name" in this repo with your new name
|
2. Wait until the first run of CI finishes (Gitea Actions will process the template and commit to your new repo)
|
||||||
3. If you want Automatic Release to [PyPI](https://pypi.org)
|
3. Read the file [CONTRIBUTING.md](CONTRIBUTING.md)
|
||||||
On the new repository `settings->secrets` add your `PYPI_API_TOKEN` (get the tokens on PyPI website)
|
4. Then clone your new project and happy coding!
|
||||||
4. Read the file [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
||||||
5. Then clone your new project and happy coding!
|
|
||||||
|
|
||||||
> **NOTE**: **WAIT** until first CI run on github actions before cloning your new project.
|
> **NOTE**: **WAIT** until first CI run on gitea actions before cloning your new project.
|
||||||
|
|
||||||
### What is included on this template?
|
### What is included on this template?
|
||||||
|
|
||||||
- 🖼️ Templates for starting multiple application types:
|
- 🖼️ Templates for starting multiple application types:
|
||||||
* **Basic low dependency** Python program (default) [use this template](https://github.com/rochacbruno/python-project-template/generate)
|
**Run `make init` after cloning to generate a new project based on a template.**
|
||||||
* **Flask** with database, admin interface, restapi and authentication [use this template](https://github.com/rochacbruno/flask-project-template/generate).
|
|
||||||
**or Run `make init` after cloning to generate a new project based on a template.**
|
|
||||||
- 📦 A basic [setup.py](setup.py) file to provide installation, packaging and distribution for your project.
|
- 📦 A basic [setup.py](setup.py) file to provide installation, packaging and distribution for your project.
|
||||||
Template uses setuptools because it's the de-facto standard for Python packages, you can run `make switch-to-poetry` later if you want.
|
Template uses setuptools because it's the de-facto standard for Python packages, you can run `make switch-to-poetry` later if you want.
|
||||||
- 🤖 A [Makefile](Makefile) with the most useful commands to install, test, lint, format and release your project.
|
- 🤖 A [Makefile](Makefile) with the most useful commands to install, test, lint, format and release your project.
|
||||||
@ -34,14 +29,10 @@ See also
|
|||||||
`Containerfile` is a more open standard for building container images than Dockerfile, you can use buildah or docker with this file.
|
`Containerfile` is a more open standard for building container images than Dockerfile, you can use buildah or docker with this file.
|
||||||
- 🧪 Testing structure using [pytest](https://docs.pytest.org/en/latest/)
|
- 🧪 Testing structure using [pytest](https://docs.pytest.org/en/latest/)
|
||||||
- ✅ Code linting using [flake8](https://flake8.pycqa.org/en/latest/)
|
- ✅ Code linting using [flake8](https://flake8.pycqa.org/en/latest/)
|
||||||
- 🛳️ Automatic release to [PyPI](https://pypi.org) using [twine](https://twine.readthedocs.io/en/latest/) and github actions.
|
|
||||||
- 🎯 Entry points to execute your program using `python -m <project_name>` or `$ project_name` with basic CLI argument parsing.
|
- 🎯 Entry points to execute your program using `python -m <project_name>` or `$ project_name` with basic CLI argument parsing.
|
||||||
- 🔄 Continuous integration using [Github Actions](.gitea/workflows/) with jobs to lint, test and release your project on Linux, Mac and Windows environments.
|
- 🔄 Continuous integration using [Gitea Actions](.gitea/workflows/) with jobs to lint, test and release your project on Linux, Mac and Windows environments.
|
||||||
|
|
||||||
> Curious about architectural decisions on this template? read [ABOUT_THIS_TEMPLATE.md](ABOUT_THIS_TEMPLATE.md)
|
> Curious about architectural decisions on this template? read [ABOUT_THIS_TEMPLATE.md](ABOUT_THIS_TEMPLATE.md)
|
||||||
> If you want to contribute to this template please open an [issue](https://github.com/rochacbruno/python-project-template/issues) or fork and send a PULL REQUEST.
|
|
||||||
|
|
||||||
[❤️ Sponsor this project](https://github.com/sponsors/rochacbruno/)
|
|
||||||
|
|
||||||
<!-- DELETE THE LINES ABOVE THIS AND WRITE YOUR PROJECT README BELOW -->
|
<!-- DELETE THE LINES ABOVE THIS AND WRITE YOUR PROJECT README BELOW -->
|
||||||
|
|
||||||
@ -50,12 +41,6 @@ See also
|
|||||||
|
|
||||||
project_description
|
project_description
|
||||||
|
|
||||||
## Install it from PyPI
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pip install project_name
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```py
|
```py
|
||||||
|
Loading…
Reference in New Issue
Block a user