tests were failing due to too restrictive python version requirements
(<=3.12 when 3.12.X exist).
switching to <3.13 allows every python 3.12 patch version to work normally
this is causing too many weird conflicts to merge next into master. Also,
requirements file was deprecated in next branch in lieu of
pyproject.toml
This reverts commit 68f9b2859d45a60e699839f87b1b9558cd36a329.
This GitHub Actions workflow automates two tasks:
1. **Create Release:**
- Triggered when a new version tag (formatted as `vX.X.X`) is pushed.
- Creates a release with the tag name, marking it as the latest version.
2. **Publish to PyPI:**
- Runs after the release is created successfully.
- Builds and publishes the Python package to PyPI using Poetry.
- Ignores development requirements during the publishing process.
This ensures that each new version gets a release on GitHub and the corresponding Python package is published on PyPI.
Co-authored-by: Darwish Ahmad Herati <13837531+daherati@users.noreply.github.com>
Co-authored-by: mateuslatrova <57113699+mateuslatrova@users.noreply.github.com>
**TL;DR: this post-commit hook ensures that valid versions are automatically tagged based on changes in the `pyproject.toml` file.**
This post-commit hook automates the tagging of the project based on changes in the `pyproject.toml` file. Here's a breakdown of what it does:
**1. Extracting the version number:**
* `git diff HEAD^..HEAD`: This line compares the current commit (`HEAD`) to its immediate predecessor (`HEAD^`).
* `-- "$(git rev-parse --show-toplevel)"/pyproject.toml`: This specifies the `pyproject.toml` file within the project root directory.
* `grep -m 1 '^\+.*version'`: This searches for the first line starting with a "+" and containing the word "version".
* `sed -s 's/[^A-Z0-9\.\-]//g'`: This removes any characters except numbers, letters, dots, and hyphens from the matched line.
* `version=`: Finally, the extracted version string is stored in the `version` variable.
**2. Validating the version format:**
* `if [[ ! $version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)(\-[A-Z]+\.[0-9]+)?$ ]]; then`: This checks if the extracted version string matches a specific format:
* `^`: Starts with the beginning of the string.
* `([0-9]+)`: Matches one or more digits (major version).
* `\.`: Matches a literal dot.
* `([0-9]+)`: Matches one or more digits (minor version).
* `\.`: Matches a literal dot.
* `([0-9]+)`: Matches one or more digits (patch version).
* `(\-[A-Z]+\.[0-9]+)?`: This is optional and matches a hyphen followed by one or more uppercase letters and a dot and another number (pre-release + build information).
* `$`: Matches the end of the string.
* If the format is invalid, it logs a message and exits with an error code.
**3. Creating the tag:**
* `git tag -a "v$version"`: This creates a new annotated tag named `v$version` (with the prefix "v") using the extracted version number.
* ``-m "`git log -1 --format=%s`"``: This sets the tag message with the full commit message of the current commit.
* `echo "Created a new tag, v$version"`: This prints a confirmation message.
Co-authored-by: Darwish Ahmad Herati <13837531+daherati@users.noreply.github.com>
The way we configured the tox.ini file makes flake8 not to be run. Tox is only running python tests for the flake8 environment.
With this PR, tox will run flake8 for the pipreqs and tests folders as desired.
- The pypy v7.3.13, used by GitHub Actions, was failing. So I force to use pypy v7.3.12 that was passing.
- The original PR was done by @EwoutH at #334 and modified by @willianrocha at #398.
A bit of CI maintenance:
- Add Python 3.10 and 3.11 runs, and update the PyPy run to PyPy 3.9
- Removed Python 3.7 as it is deprecated
- Update the used actions (checkout and setup-python) to the latest versions
- Also run on pushes, when manually triggered (workflow_dispatch)
The original PR was done by @EwoutH at #334