Align with supported Python versions - automated with endoflife.date
Project description
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:
cogeolwill 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: Manage versions of Python by statically generated code (see examples below!)
Quick start
Installation
> pip install cogeol
Usage
[!TIP] Check out the documentation for all available functionalities and public-facing API.
- Open
pyproject.tomlof your project and find necessary to haverequires-pythonfield. - Update it as follows (comments are crucial!):
# [[[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:
> 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):
# [[[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:
# [[[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:
> cog -c -r pyproject.toml
and you should see the following (notice all versions are present!):
# [[[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:
...
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:
> 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 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:
Contribute
We welcome your contributions! Start here:
Legal
- This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
- This project is copyrighted by open-nudge - the appropriate copyright notice is included in each file.
Project details
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 cogeol-0.1.5.tar.gz.
File metadata
- Download URL: cogeol-0.1.5.tar.gz
- Upload date:
- Size: 14.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b19606bb1c84c8dcbb13c6b3622dcf4facd9e678e5308b72c186b7c9a5e76674
|
|
| MD5 |
8540afbf712b1e3b5e453c972a007a82
|
|
| BLAKE2b-256 |
f07a26a41c57d31f5b58d65239272daf9f8fb41db2b0b0d4a80641acda304511
|
Provenance
The following attestation bundles were made for cogeol-0.1.5.tar.gz:
Publisher:
release.yml on open-nudge/cogeol
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cogeol-0.1.5.tar.gz -
Subject digest:
b19606bb1c84c8dcbb13c6b3622dcf4facd9e678e5308b72c186b7c9a5e76674 - Sigstore transparency entry: 273026494
- Sigstore integration time:
-
Permalink:
open-nudge/cogeol@43897bac2de3837c77495e4f21d647c358099329 -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/open-nudge
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@43897bac2de3837c77495e4f21d647c358099329 -
Trigger Event:
release
-
Statement type:
File details
Details for the file cogeol-0.1.5-py3-none-any.whl.
File metadata
- Download URL: cogeol-0.1.5-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6888ccd45d70bdfb10287ea2cd49538ba21545125e2843adf8180c7d80436275
|
|
| MD5 |
b6a2c2d378dd9c255086eb251bc09913
|
|
| BLAKE2b-256 |
ee3011b47a7b0233167222cb4030e5de9b8f15eeb1484d7763b501dd533b1637
|
Provenance
The following attestation bundles were made for cogeol-0.1.5-py3-none-any.whl:
Publisher:
release.yml on open-nudge/cogeol
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cogeol-0.1.5-py3-none-any.whl -
Subject digest:
6888ccd45d70bdfb10287ea2cd49538ba21545125e2843adf8180c7d80436275 - Sigstore transparency entry: 273026497
- Sigstore integration time:
-
Permalink:
open-nudge/cogeol@43897bac2de3837c77495e4f21d647c358099329 -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/open-nudge
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@43897bac2de3837c77495e4f21d647c358099329 -
Trigger Event:
release
-
Statement type: