Tetris with Apulian elements - a Software Engineering project.
Project description
Python project template
A simple template of Python projects, with a rigid file structure, and predisposition for unit testing and release on PyPi.
Relevant features
- All your project code into a single main package (
OrecchietTetris-artifact/) - All your project tests into a single test package (
test/) - Unit testing support via
unittest - Automatic testing on all branches via GitHub Actions
- Semi-automatic versioning via Git
- Packaging support via
setuptools - Automatic release on PyPi via GitHub Actions and
semantic-release - Automatic dependencies updates via Renovate
Project structure
Overview:
<root directory>
├── OrecchietTetris/ # main package (should be named after your project)
│ ├── __init__.py # python package marker
│ └── __main__.py # application entry point
├── tests/ # test package (should contain unit tests)
├── .github/ # configuration of GitHub CI
│ └── workflows/ # configuration of GitHub Workflows
│ ├── check.yml # runs tests on multiple OS and versions of Python
│ └── deploy.yml # if check succeeds, and the current branch is one of {main, master}, triggers automatic releas on PyPi
├── LICENSE # license file (Apache 2.0 by default)
├── pyproject.toml # project configuration file as prescribed by Poetry
├── renovate.json # configuration of Renovate bot, for automatic dependency updates
├── requirements.txt # only declares a dependency on Poetry. DO NOT EDIT THIS FILE
└── release.config.js # script to release on PyPi, and GitHub via semantic-release
TODO-list for template usage
-
Use this template to create a new GitHub repository, say
OrecchietTetris-artifact- this name will also be used to identify the package on PyPi
- so, we suggest choosing a name which has not been used on PyPi, yet
- we also suggest choosing a name which is a valid Python package name (i.e.
using_snake_case)
- this name will also be used to identify the package on PyPi
-
Clone the
OrecchietTetris-artifactrepository -
Open a shell into your local
OrecchietTetris-artifactdirectory and run./rename-template.sh OrecchietTetris-artifactThis will coherently rename the template's project name with the one chosen by you (i.e.
OrecchietTetris-artifact, in this example)- Remark: this step is now automatic thanks to the
init.ymlworkflow which is triggered when using this template to create a new repository
- Remark: this step is now automatic thanks to the
-
Commit & push
-
Ensure you like the Apache 2.0 License. If you don't, change the content of the
LICENSEfile -
Ensure the versions-range of Python reported in
pyproject.tomlfits the versions you want to support- currently defaults to
>= 3.9 - if you change this, please also change the versions of Python tests should be run on in CI, by looking the file
.github/workflows/check.yml
- currently defaults to
-
Check the Python version and OS tests should be run on in CI, by looking the file
.github/workflows/check.yml -
Add your runtime, development, and build dependencies to
pyproject.toml -
Check the other metadata in
pyproject.toml -
Change the assignee for pull-requests for automatic dependency updates by editing
renovate.json- currently defaults to @gciatto
-
Add your PyPI credentials as secrets of the GitHub repository
PYPI_USERNAME(resp.PYPI_PASSWORD) for your username (resp. password)- this may require you to register on PyPi first
- Note: PyPI no longer allows authentication with a username and password. Please follow these steps instead:
- Authenticate on PyPi
- Go to your account settings and generate a new API token
- Add the API Token to the
PYPI_PASSWORDsecret - Add the string
__token__to thePYPI_USERNAMEsecret
-
Generate a GitHub token and add it as a secret of the GitHub repository, named
RELEASE_TOKEN- cf. https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic
- the token must allow pushing to the repository
-
Put your main (resp. test) code in
OrecchietTetris-artifact/(resp.test/)
How to do stuff
Restore dev dependencies
-
Install Poetry if you don't have it yet
pip install -r requirements.txt
-
Install the project's dependencies
poetry install
Run unit tests
poetry run poe test
Tests are automatically run in CI, on all pushes on all branches. There, tests are executed on multiple OS (Win, Mac, Ubuntu) and on multiple Python versions.
Run your code as an application
This will execute the __main__.py file in the OrecchietTetris-artifact package:
python -m OrecchietTetris-artifact
or alternatively:
OrecchietTetris-artifact
the latter is possible because of the script defined in the pyproject.toml file.
Release a new version on PyPi
New versions are automatically released on PyPi via GitHub Actions, when a push is made on the main or master branch.
The version number is updated automatically by the semantic-release tool, which uses the commit messages to infer the type of the release (major, minor, patch).
It is paramount that the commit messages follow the Conventional Commits specification,
in order for semantic-release to compute version numbers correctly.
Automatic updates of dependencies (via Renovate)
The project is configured to use Renovate to automatically open pull-requests
to update dependencies declared in pyproject.toml.
By default, Renovate will assign such pull-requests to the user who created the repository from this template.
If the project has tests (which is the case for this template), Renovate will only merge such pull-requests if all tests pass.
When some test fails, Renovate will leave a comment on the pull-request, so that you can fix the issue manually.
To make Renovate work, you need to enable it for your repository. To do so, please follow the instruction at https://docs.renovatebot.com/getting-started/installing-onboarding/#hosted-githubcom-app
Finally, please remember to enable PR auto-merging in your repository settings, otherwise Renovate will not be able to merge the pull-requests it opens, even if all tests pass. To do so, please follow the instructions available here.
Notice that the combination between Renovate, and Semantic Release may lead to a number of releases being created automatically.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file orecchiettetris-0.2.0.tar.gz.
File metadata
- Download URL: orecchiettetris-0.2.0.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98f6586257a4ac129e115d5189569cc1e4f84b52527ab75371992c55a905c371
|
|
| MD5 |
7a08a0ff50b3020559b53f5443afdaf7
|
|
| BLAKE2b-256 |
2d0bdf8128a77498e1ba6482efa8b7813a628129fbd6b390ea2fa8092b92e24a
|
Provenance
The following attestation bundles were made for orecchiettetris-0.2.0.tar.gz:
Publisher:
deploy.yml on unibo-dtm-se-2425-OrecchietTetris/OrecchietTetris-artifact
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
orecchiettetris-0.2.0.tar.gz -
Subject digest:
98f6586257a4ac129e115d5189569cc1e4f84b52527ab75371992c55a905c371 - Sigstore transparency entry: 1059862786
- Sigstore integration time:
-
Permalink:
unibo-dtm-se-2425-OrecchietTetris/OrecchietTetris-artifact@53e0a2b7f0e08db0c320afe8fbd12e391f8416fe -
Branch / Tag:
refs/heads/master - Owner: https://github.com/unibo-dtm-se-2425-OrecchietTetris
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@53e0a2b7f0e08db0c320afe8fbd12e391f8416fe -
Trigger Event:
push
-
Statement type:
File details
Details for the file orecchiettetris-0.2.0-py3-none-any.whl.
File metadata
- Download URL: orecchiettetris-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0eece28b6809576ba9b44c62133cde3f12a1d770c5b9e149480165b70c5ad5f
|
|
| MD5 |
a6157c35f4a5618d38f01ec43a5f3904
|
|
| BLAKE2b-256 |
7d26f601956dcfa350d70fd14756c10eff0b8a697ee59b37d19e729133f2a78a
|
Provenance
The following attestation bundles were made for orecchiettetris-0.2.0-py3-none-any.whl:
Publisher:
deploy.yml on unibo-dtm-se-2425-OrecchietTetris/OrecchietTetris-artifact
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
orecchiettetris-0.2.0-py3-none-any.whl -
Subject digest:
f0eece28b6809576ba9b44c62133cde3f12a1d770c5b9e149480165b70c5ad5f - Sigstore transparency entry: 1059862789
- Sigstore integration time:
-
Permalink:
unibo-dtm-se-2425-OrecchietTetris/OrecchietTetris-artifact@53e0a2b7f0e08db0c320afe8fbd12e391f8416fe -
Branch / Tag:
refs/heads/master - Owner: https://github.com/unibo-dtm-se-2425-OrecchietTetris
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@53e0a2b7f0e08db0c320afe8fbd12e391f8416fe -
Trigger Event:
push
-
Statement type: