1919
2020`GitHub <https://github.com/jwodder/pyversion-info >`_
2121| `PyPI <https://pypi.org/project/pyversion-info/>`_
22+ | `Documentation <https://pyversion-info.readthedocs.io>`_
2223| `Issues <https://github.com/jwodder/pyversion-info/issues>`_
2324| `Changelog <https://github.com/jwodder/pyversion-info/blob/master/CHANGELOG.md>`_
2425
2728
2829Ever needed to know what Python versions were currently supported, or how many
2930subversions a given Python version had? Wondering how long until a given
30- version came out or reached end-of-life? The answers to these and some other
31+ version came out or reached end-of-life? Need to know what CPython versions a
32+ given PyPy version corresponds to? The answers to these and some other
3133questions can be found with this library.
3234
3335``pyversion-info `` pulls its data every run from
@@ -36,6 +38,9 @@ on GitHub. Prerelease versions are not (currently) included. I promise
363824-hour turnaround times for keeping the database up-to-date until I am hit by
3739a bus.
3840
41+ See `the documentation <https://pyversion-info.readthedocs.io >`_ for more
42+ information.
43+
3944
4045Installation
4146============
@@ -49,228 +54,48 @@ Installation
4954Examples
5055========
5156
52- Start out by fetching the database:
53-
54- >>> from pyversion_info import get_pyversion_info
55- >>> pyvinfo = get_pyversion_info()
56-
57- Get a list of all currently-supported Python series:
58-
59- >>> pyvinfo.supported_series()
60- ['2.7', '3.5', '3.6', '3.7']
61-
62- When does 3.8 come out?
63-
64- >>> pyvinfo.release_date(" 3.8" )
65- datetime.date(2019, 10, 21)
66-
67- When does 2.7 reach end-of-life?
68-
69- >>> pyvinfo.eol_date(" 2.7" )
70- datetime.date(2020, 1, 1)
71-
72- Just how many micro versions does 2.7 have, anyway?
73-
74- >>> pyvinfo.subversions(" 2.7" )
75- ['2.7.0', '2.7.1', '2.7.2', '2.7.3', '2.7.4', '2.7.5', '2.7.6', '2.7.7', '2.7.8', '2.7.9', '2.7.10', '2.7.11', '2.7.12', '2.7.13', '2.7.14', '2.7.15', '2.7.16']
76-
77- How many versions of Python 3 have been released?
78-
79- >>> pyvinfo.subversions(" 3" )
80- ['3.0', '3.1', '3.2', '3.3', '3.4', '3.5', '3.6', '3.7']
81-
82-
83- API
84- ===
85-
86- Versions are passed to & returned from methods as strings in the form ``"X" ``
87- (a major version), ``"X.Y" `` (a minor version), or ``"X.Y.Z" `` (a micro
88- version).
89-
90- All dates are returned as ``datetime.date `` objects.
91-
92- ``PyVersionInfo ``
93- -----------------
94- A class for querying Python versions and their release & EOL dates
95-
96- ``PyVersionInfo(data: dict) ``
97- Construct a new ``PyVersionInfo `` object from a `dict ` containing version
98- release dates and series EOL dates structured in accordance with `this
99- JSON Schema `__
100-
101- __ https://raw.githubusercontent.com/jwodder/pyversion-info-data/master/
102- pyversion-info-data.v1.schema.json
103-
104- ``pyvinfo.eol_date(series: str) -> Optional[date] ``
105- Returns the end-of-life date of the given Python version series (i.e., a
106- minor version like 3.5). The return value may be ``None ``, indicating that,
107- though the series is known to the database, its EOL date is not; use
108- ``is_eol() `` to determine whether such a version has reached end-of-life yet
109- or not.
110-
111- ``pyvinfo.is_eol(series: str) -> bool ``
112- Returns whether the given version series has reached end-of-life yet
113-
114- ``pyvinfo.is_released(version: str) -> bool ``
115- Returns whether the given version has been released yet. For a major or
116- minor version, this is the whether the first (in version order) micro
117- version has been released.
118-
119- ``pyvinfo.is_supported(version: str) -> bool ``
120- Returns whether the given version is currently supported. For a micro
121- version, this is whether it has been released and the corresponding minor
122- version is not yet end-of-life. For a major or minor version, this is
123- whether at least one subversion is supported.
124-
125- ``pyvinfo.major_versions() -> List[str] ``
126- Returns a list in version order of all known Python major versions (as
127- strings).
128-
129- ``pyinfo.micro_versions() -> List[str] ``
130- Returns a list in version order of all Python micro versions. Versions in
131- the form ``X.Y `` are included here as ``X.Y.0 ``.
132-
133- ``pyvinfo.minor_versions() -> List[str] ``
134- Returns a list in version order of all Python minor versions.
135-
136- ``pyvinfo.release_date(version: str) -> Optional[date] ``
137- Returns the release date of the given Python version. For a major or minor
138- version, this is the release date of its first (in version order) micro
139- version. The return value may be ``None ``, indicating that, though the
140- version is known to the database, its release date is not; use
141- ``is_released() `` to determine whether such a version has been released or
142- not.
57+ (The given outputs are current as of 2021-11-04.)
14358
144- ``pyvinfo.subversions(version: str) -> List[str] ``
145- Returns a list in version order of all subversions of the given version. If
146- ``version `` is a major version, this is all of its released minor versions.
147- If ``version `` is a minor version, this is all of its released micro
148- versions.
149-
150- ``pyvinfo.supported_series() -> List[str] ``
151- Returns a list in version order of all Python version series (i.e., minor
152- versions like 3.5) that are currently supported (i.e., that have at least
153- one release made and are not yet end-of-life)
154-
155-
156- Utilities
157- ---------
158-
159- ``UnknownVersionError ``
160- Subclass of ``ValueError `` raised when ``PyVersionInfo `` is asked for
161- information about a version that does not appear in its database.
162- Operations that result in an ``UnknownVersionError `` may succeed later as
163- more Python versions are announced & released.
164-
165- The unknown version is stored in an ``UnknownVersionError `` instance's
166- ``version `` attribute.
167-
168- ``get_pyversion_info(url: str = pyversion_info.DATA_URL, cache_dir: Optional[str] = pyversion_info.CACHE_DIR) -> PyVersionInfo ``
169- Fetches the latest version release data from ``url `` and returns a new
170- ``PyVersionInfo `` object. The HTTP response is cached in ``cache_dir `` to
171- speed up future requests (or ``cache_dir `` can be set to ``None `` to
172- disable caching).
173-
174-
175- Command
176- =======
177-
178- *New in version 0.4.0 *
179-
180- ``pyversion-info `` also provides a command of the same name for querying
181- information about Python versions from the command line::
182-
183- pyversion-info [<global-options>] <command> [<args> ...]
184-
185- Currently, ``pyversion-info `` has two subcommands, ``list `` and ``show ``.
186-
187-
188- Global Options
189- --------------
190-
191- -d DATABASE, --database DATABASE
192- Use the given JSON file as the version
193- information database instead of fetching data
194- from the default URL. ``DATABASE `` can be
195- either an HTTP or HTTPS URL or a path to a
196- local file.
197-
198-
199- ``pyversion-info list ``
200- -----------------------
201-
202- ::
203-
204- pyversion-info [<global-options>] list [<options>] {major|minor|micro}
205-
206- List all major, minor, or micro Python versions, one per line.
207-
208-
209- Options
210- ^^^^^^^
211-
212- -a, --all List all known versions of the given level
213- -n, --not-eol Only list versions that have not yet reached
214- end-of-life (i.e., all supported versions plus
215- all unreleased versions)
216- -r, --released Only list released versions. This is the
217- default.
218- -s, --supported Only list currently-supported versions
219-
220-
221- ``pyversion-info show ``
222- -----------------------
59+ Start out by fetching the database:
22360
224- ::
61+ >>> from pyversion_info import VersionDatabase
62+ >>> vd = VersionDatabase.fetch()
22563
226- pyversion-info [<global-options>] show [<options>] <version>
64+ Get a list of all currently-supported CPython series:
22765
228- Show various information about a given Python version.
66+ >>> vd.cpython.supported_series()
67+ ['3.6', '3.7', '3.8', '3.9', '3.10']
22968
230- For a major version, the output is of the form::
69+ When does 3.11 come out?
23170
232- Version: 3
233- Level: major
234- Release-date: 2008-12-03
235- Is-released: yes
236- Is-supported: yes
237- Subversions: 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9
71+ >>> vd.cpython.release_date(" 3.11" )
72+ datetime.date(2022, 10, 3)
23873
239- For a minor version, the output is of the form::
74+ When does 3.6 reach end-of-life?
24075
241- Version: 3.3
242- Level: minor
243- Release-date: 2012-09-29
244- Is-released: yes
245- Is-supported: no
246- EOL-date: 2017-09-29
247- Is-EOL: yes
248- Subversions: 3.3.0, 3.3.1, 3.3.2, 3.3.3, 3.3.4, 3.3.5, 3.3.6, 3.3.7
76+ >>> vd.cpython.eol_date(" 3.6" )
77+ datetime.date(2021, 12, 23)
24978
250- For a micro version, the output is of the form::
79+ Just how many micro versions does 3.9 have, anyway?
25180
252- Version: 3.9.5
253- Level: micro
254- Release-date: 2021-05-03
255- Is-released: yes
256- Is-supported: yes
81+ >>> vd.cpython.subversions(" 3.9" )
82+ ['3.9.0', '3.9.1', '3.9.2', '3.9.3', '3.9.4', '3.9.5', '3.9.6', '3.9.7', '3.9.8', '3.9.9', '3.9.10', '3.9.11']
25783
84+ What major versions of PyPy are there?
25885
259- Options
260- ^^^^^^^
86+ >>> vd.pypy.major_versions()
87+ ['1', '2', '4', '5', '6', '7']
26188
262- -J, --json Output JSON
89+ What CPython series do PyPy 7.3. \* support?
26390
264- -S, --subversions <all|not-eol|released|supported>
265- Which subversions to list; the choices have the
266- same meanings as the ``list `` options of the
267- same name [default: released]
91+ >>> vd.pypy.supports_cpython_series(" 7.3" )
92+ ['2.7', '3.6', '3.7', '3.8']
26893
26994
27095Caveats
27196=======
27297
273- The database is generally only updated when an edit is made to a release
274- schedule PEP. Occasionally, a deadline listed in a PEP is missed, but the PEP
275- is not updated for a couple days, and so for a brief period this library will
276- falsely report the given version as released.
98+ The CPython database is generally only updated when an edit is made to a
99+ release schedule PEP. Occasionally, a deadline listed in a PEP is missed, but
100+ the PEP is not updated for a couple days, and so for a brief period this
101+ library will falsely report the given version as released.
0 commit comments