https://github.com/open-nudge/cogeol
Align projects with supported Python versions - automated with endoflife.date
https://github.com/open-nudge/cogeol
automation endoflife-date eol github-actions pyproject python tooling
Last synced: 3 months ago
JSON representation
Align projects with supported Python versions - automated with endoflife.date
- Host: GitHub
- URL: https://github.com/open-nudge/cogeol
- Owner: open-nudge
- License: other
- Created: 2025-06-21T10:20:08.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-07-13T13:40:38.000Z (11 months ago)
- Last Synced: 2026-01-05T22:54:46.601Z (6 months ago)
- Topics: automation, endoflife-date, eol, github-actions, pyproject, python, tooling
- Language: Python
- Homepage: https://open-nudge.github.io/cogeol
- Size: 9.7 MB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
- Citation: CITATION.cff
- Codeowners: CODEOWNERS
- Security: SECURITY-DEPENDENCY.md
- Support: SUPPORT.md
- Governance: GOVERNANCE.md
- Roadmap: ROADMAP.md
- Dco: DCO.md
Awesome Lists containing this project
README
# cogeol
Align with supported Python versions - automated with endoflife.date





✨ Features
🚀 Quick start
📚 Documentation
🤝 Contribute
👍 Adopters
📜 Legal
______________________________________________________________________
## Features
__cogeol__ is a library which allows you to:
- __Works with any file format__ (e.g. updating Python versions in CI/CD tests)
- __No need to track Python EOL dates__ — cogeol does it for you
- __Align with [Scientific Python SPEC0](https://scientific-python.org/specs/spec-0000/)__:
`cogeol` will allow you to align your project to the three latest
supported Python versions
- __Caching__: retrieves data from https://endoflife.date/
and stores it locally to minimize network requests
- __Based on [cog](https://github.com/nedbat/cog)__: Manage versions of Python
by statically generated code (see examples below!)
## Quick start
### Installation
```sh
> pip install cogeol
```
### Usage
> [!TIP]
> Check out the [documentation](https://open-nudge.github.io/cogeol)
> for all available functionalities and public-facing API.
1. Open `pyproject.toml` of your project
and find __necessary to have `requires-python` field__.
1. Update it as follows (__comments are crucial!__):
```toml
# [[[cog
# import cog
# import cogeol
#
# cycle = cogeol.scientific()[-1]["cycle"]
# cog.out(f'requires-python = ">={cycle}"')
# ]]]
requires-python = ">=3.9"
# [[[end]]]
```
Now run the following from the command line:
```sh
> cog -c -r pyproject.toml
```
__Now your `requires-python` field will be updated to the
latest supported Python version!__
For example (Python `3.11` is the latest supported version
at the time of writing):
```toml
# [[[cog
# import cog
# import cogeol
#
# cycle = cogeol.scientific()[-1]["cycle"]
# cog.out(f'requires-python = ">={cycle}"')
# ]]]
requires-python = ">=3.11"
# [[[end]]] (sum: uZEo+p96oZ)
```
> [!NOTE]
> Please notice a checksum, which verifies consistency
> of the changes at each run
### Examples
Specifying Python version classifiers (click me)
You can automate the classifiers in your `pyproject.toml` file like this:
```toml
# [[[cog
# import cog
# import cogeol
#
# for version in reversed(cogeol.scientific()):
# cycle = version["cycle"]
# cog.outl(f' "Programming Language :: Python :: {cycle}",')
# ]]]
"Programming Language :: Python :: 3.11",
# [[[end]]]
```
Now run the following from the command line:
```sh
> cog -c -r pyproject.toml
```
and you should see the following (__notice all versions are present!__):
```toml
# [[[cog
# import cog
# import cogeol
#
# for version in reversed(cogeol.scientific()):
# cycle = version["cycle"]
# cog.outl(f' "Programming Language :: Python :: {cycle}",')
# ]]]
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
# [[[end]]] (sum: FeG7grp2Dw)
```
Caching (click me)
Let's assume you have the following code snippet in `github-workflow.yml`:
```yaml
...
jobs:
tests-reusable:
strategy:
matrix:
python:
#
# DO NOT EDIT UNTIL end marker
#
# [[[cog
# import cog
# import cogeol
#
# for version in reversed(cogeol.scientific()):
# cycle = version['cycle']
# cog.outl(f' - "{cycle}"')
# ]]]
- "3.11"
# [[[end]]] (sum: l3d2zGv79j)
```
in addition to your code in `pyproject.toml` using `cogeol`.
Now, if you run:
```sh
> cog -c -r pyproject.toml github-workflow.yml
```
The following will happen:
- Both files will be updated with appropriate Python versions
- __Only one call to [End of Life Date](https://endoflife.date) will be made__
(the results are cached on disk)
Next time you run the same command, the results will be read from the cache
Advanced (click me)
For more examples check out this project's:
- `pyproject.toml` file
(see [here](https://github.com/open-nudge/cogeol/blob/main/pyproject.toml))
- Tests of the last three versions in GitHub Actions workflow
(see [here](https://github.com/open-nudge/cogeol/blob/main/.github/workflows/tests-reusable.yml))
## Contribute
We welcome your contributions! Start here:
- [Code of Conduct](/CODE_OF_CONDUCT.md)
- [Contributing Guide](/CONTRIBUTING.md)
- [Roadmap](/ROADMAP.md)
- [Changelog](/CHANGELOG.md)
- [Report security vulnerabilities](/SECURITY.md)
- [Open an Issue](https://github.com/open-nudge/cogeol/issues)
## Legal
- This project is licensed under the _Apache 2.0 License_ - see
the [LICENSE](/LICENSE.md) file for details.
- This project is copyrighted by _open-nudge_ - the
appropriate copyright notice is included in each file.