version-query 1.5.5__tar.gz → 1.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {version_query-1.5.5 → version_query-1.6.0}/NOTICE +1 -1
- {version_query-1.5.5/version_query.egg-info → version_query-1.6.0}/PKG-INFO +22 -9
- {version_query-1.5.5 → version_query-1.6.0}/README.rst +1 -1
- {version_query-1.5.5 → version_query-1.6.0}/pyproject.toml +2 -2
- {version_query-1.5.5 → version_query-1.6.0}/requirements.txt +1 -1
- {version_query-1.5.5 → version_query-1.6.0}/setup.py +1 -1
- {version_query-1.5.5 → version_query-1.6.0}/version_query/main.py +1 -1
- version_query-1.6.0/version_query/py_query.py +69 -0
- {version_query-1.5.5 → version_query-1.6.0}/version_query/query.py +1 -1
- {version_query-1.5.5 → version_query-1.6.0/version_query.egg-info}/PKG-INFO +22 -9
- {version_query-1.5.5 → version_query-1.6.0}/version_query.egg-info/SOURCES.txt +10 -0
- {version_query-1.5.5 → version_query-1.6.0}/version_query.egg-info/requires.txt +1 -1
- version_query-1.5.5/version_query/py_query.py +0 -44
- {version_query-1.5.5 → version_query-1.6.0}/LICENSE +0 -0
- {version_query-1.5.5 → version_query-1.6.0}/MANIFEST.in +0 -0
- {version_query-1.5.5 → version_query-1.6.0}/requirements_test.txt +0 -0
- {version_query-1.5.5 → version_query-1.6.0}/setup.cfg +0 -0
- {version_query-1.5.5 → version_query-1.6.0}/test/__init__.py +0 -0
- {version_query-1.5.5 → version_query-1.6.0}/test/examples.py +0 -0
- {version_query-1.5.5 → version_query-1.6.0}/test/test_git.py +0 -0
- {version_query-1.5.5 → version_query-1.6.0}/test/test_packaging.py +0 -0
- {version_query-1.5.5 → version_query-1.6.0}/test/test_query.py +0 -0
- {version_query-1.5.5 → version_query-1.6.0}/test/test_version.py +0 -0
- {version_query-1.5.5 → version_query-1.6.0}/version_query/__init__.py +0 -0
- {version_query-1.5.5 → version_query-1.6.0}/version_query/__main__.py +0 -0
- {version_query-1.5.5 → version_query-1.6.0}/version_query/_version.py +0 -0
- {version_query-1.5.5 → version_query-1.6.0}/version_query/git_query.py +0 -0
- {version_query-1.5.5 → version_query-1.6.0}/version_query/py.typed +0 -0
- {version_query-1.5.5 → version_query-1.6.0}/version_query/version.py +0 -0
- {version_query-1.5.5 → version_query-1.6.0}/version_query.egg-info/dependency_links.txt +0 -0
- {version_query-1.5.5 → version_query-1.6.0}/version_query.egg-info/top_level.txt +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
version-query
|
|
2
|
-
Copyright (c) 2017-
|
|
2
|
+
Copyright (c) 2017-2025 Mateusz Bysiek https://mbdevpl.github.io/
|
|
3
3
|
Copyright (c) 2020 John Vandenberg https://github.com/jayvdb
|
|
4
4
|
|
|
5
5
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: version-query
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.6.0
|
|
4
4
|
Summary: Zero-overhead package versioning for Python.
|
|
5
5
|
Home-page: https://github.com/mbdevpl/version-query
|
|
6
6
|
Download-URL:
|
|
@@ -18,25 +18,38 @@ Classifier: Natural Language :: English
|
|
|
18
18
|
Classifier: Operating System :: MacOS
|
|
19
19
|
Classifier: Operating System :: Microsoft :: Windows
|
|
20
20
|
Classifier: Operating System :: POSIX :: Linux
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.9
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.10
|
|
24
23
|
Classifier: Programming Language :: Python :: 3.11
|
|
25
24
|
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
26
26
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
27
27
|
Classifier: Topic :: Software Development :: Version Control
|
|
28
28
|
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
29
29
|
Classifier: Topic :: System :: Software Distribution
|
|
30
30
|
Classifier: Topic :: Utilities
|
|
31
31
|
Classifier: Typing :: Typed
|
|
32
|
-
Requires-Python: >=3.
|
|
32
|
+
Requires-Python: >=3.9
|
|
33
33
|
Description-Content-Type: text/x-rst; charset=UTF-8
|
|
34
34
|
License-File: LICENSE
|
|
35
35
|
License-File: NOTICE
|
|
36
36
|
Requires-Dist: boilerplates[cli,logging]~=1.0
|
|
37
37
|
Requires-Dist: GitPython~=3.1
|
|
38
|
-
Requires-Dist: packaging>=
|
|
38
|
+
Requires-Dist: packaging>=24.0
|
|
39
39
|
Requires-Dist: semver<3.1,>=2.13
|
|
40
|
+
Dynamic: author
|
|
41
|
+
Dynamic: author-email
|
|
42
|
+
Dynamic: classifier
|
|
43
|
+
Dynamic: description
|
|
44
|
+
Dynamic: description-content-type
|
|
45
|
+
Dynamic: home-page
|
|
46
|
+
Dynamic: keywords
|
|
47
|
+
Dynamic: license
|
|
48
|
+
Dynamic: maintainer
|
|
49
|
+
Dynamic: maintainer-email
|
|
50
|
+
Dynamic: requires-dist
|
|
51
|
+
Dynamic: requires-python
|
|
52
|
+
Dynamic: summary
|
|
40
53
|
|
|
41
54
|
.. role:: bash(code)
|
|
42
55
|
:language: bash
|
|
@@ -68,7 +81,7 @@ Zero-overhead package versioning for Python.
|
|
|
68
81
|
:alt: grade from Codacy
|
|
69
82
|
|
|
70
83
|
.. image:: https://img.shields.io/github/license/mbdevpl/version-query.svg
|
|
71
|
-
:target: https://github.com/mbdevpl/version-query/blob/v1.
|
|
84
|
+
:target: https://github.com/mbdevpl/version-query/blob/v1.6.0/NOTICE
|
|
72
85
|
:alt: license
|
|
73
86
|
|
|
74
87
|
Package versioning toolkit for Python which relies on git tags, git history traversal
|
|
@@ -476,10 +489,10 @@ using version-query without any issues.
|
|
|
476
489
|
Requirements
|
|
477
490
|
============
|
|
478
491
|
|
|
479
|
-
Python version 3.
|
|
492
|
+
Python version 3.9 or later.
|
|
480
493
|
|
|
481
|
-
Python libraries as specified in `requirements.txt <https://github.com/mbdevpl/version-query/blob/v1.
|
|
494
|
+
Python libraries as specified in `requirements.txt <https://github.com/mbdevpl/version-query/blob/v1.6.0/requirements.txt>`_.
|
|
482
495
|
|
|
483
|
-
Building and running tests additionally requires packages listed in `requirements_test.txt <https://github.com/mbdevpl/version-query/blob/v1.
|
|
496
|
+
Building and running tests additionally requires packages listed in `requirements_test.txt <https://github.com/mbdevpl/version-query/blob/v1.6.0/requirements_test.txt>`_.
|
|
484
497
|
|
|
485
498
|
Tested on Linux, macOS and Windows.
|
|
@@ -20,11 +20,11 @@ class Package(boilerplates.setup.Package):
|
|
|
20
20
|
'Operating System :: MacOS',
|
|
21
21
|
'Operating System :: Microsoft :: Windows',
|
|
22
22
|
'Operating System :: POSIX :: Linux',
|
|
23
|
-
'Programming Language :: Python :: 3.8',
|
|
24
23
|
'Programming Language :: Python :: 3.9',
|
|
25
24
|
'Programming Language :: Python :: 3.10',
|
|
26
25
|
'Programming Language :: Python :: 3.11',
|
|
27
26
|
'Programming Language :: Python :: 3.12',
|
|
27
|
+
'Programming Language :: Python :: 3.13',
|
|
28
28
|
'Programming Language :: Python :: 3 :: Only',
|
|
29
29
|
'Topic :: Software Development :: Version Control',
|
|
30
30
|
'Topic :: Software Development :: Version Control :: Git',
|
|
@@ -20,7 +20,7 @@ def main(args=None, namespace=None) -> None:
|
|
|
20
20
|
description='''Tool for querying current versions of Python packages. Use LOGGING_LEVEL
|
|
21
21
|
environment variable to adjust logging level.''',
|
|
22
22
|
epilog=make_copyright_notice(
|
|
23
|
-
2017,
|
|
23
|
+
2017, 2025, author='the contributors', url='https://github.com/mbdevpl/version-query'),
|
|
24
24
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
|
25
25
|
add_version_option(parser, VERSION)
|
|
26
26
|
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""Python package version query tools."""
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
import json
|
|
5
|
+
import pathlib
|
|
6
|
+
|
|
7
|
+
from .version import Version
|
|
8
|
+
|
|
9
|
+
_LOG = logging.getLogger(__name__)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def query_metadata_json(path: pathlib.Path) -> Version:
|
|
13
|
+
"""Get version from metadata.json file."""
|
|
14
|
+
with path.open('r') as metadata_file:
|
|
15
|
+
metadata = json.load(metadata_file)
|
|
16
|
+
version_str = metadata['version']
|
|
17
|
+
return Version.from_str(version_str)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def query_pkg_info(path: pathlib.Path) -> Version:
|
|
21
|
+
"""Get version from PKG-INFO file."""
|
|
22
|
+
with path.open('r') as pkginfo_file:
|
|
23
|
+
for line in pkginfo_file:
|
|
24
|
+
if line.startswith('Version:'):
|
|
25
|
+
version_str = line.replace('Version:', '').strip()
|
|
26
|
+
return Version.from_str(version_str)
|
|
27
|
+
raise ValueError(path)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def query_package_folder(path: pathlib.Path, search_parent_directories: bool = False) -> Version:
|
|
31
|
+
"""Get version from Python package folder."""
|
|
32
|
+
global_metadata_json_paths, global_pkg_info_paths = [], []
|
|
33
|
+
if path.joinpath('pyproject.toml').exists() or path.joinpath('setup.py').exists():
|
|
34
|
+
metadata_json_paths = list(path.glob('*.dist-info/metadata.json'))
|
|
35
|
+
pkg_info_paths = list(path.glob('*.egg-info/PKG-INFO'))
|
|
36
|
+
pkg_info_paths += list(path.glob('*.dist-info/METADATA'))
|
|
37
|
+
if len(metadata_json_paths) == 1 and not pkg_info_paths:
|
|
38
|
+
return query_metadata_json(metadata_json_paths[0])
|
|
39
|
+
if not metadata_json_paths and len(pkg_info_paths) == 1:
|
|
40
|
+
return query_pkg_info(pkg_info_paths[0])
|
|
41
|
+
_LOG.debug(
|
|
42
|
+
'in %s found pyproject.toml or setup.py, as well as'
|
|
43
|
+
' %i JSON metadata: %s and %i PKG-INFO metadata: %s'
|
|
44
|
+
' - unable to infer package metadata, continuing search',
|
|
45
|
+
path, len(metadata_json_paths), metadata_json_paths, len(pkg_info_paths),
|
|
46
|
+
pkg_info_paths)
|
|
47
|
+
global_metadata_json_paths.extend(metadata_json_paths)
|
|
48
|
+
global_pkg_info_paths.extend(pkg_info_paths)
|
|
49
|
+
paths = [path]
|
|
50
|
+
if search_parent_directories:
|
|
51
|
+
paths += path.parents
|
|
52
|
+
for pth in paths:
|
|
53
|
+
metadata_json_paths = list(pth.parent.glob(f'{pth.name}*.dist-info/metadata.json'))
|
|
54
|
+
pkg_info_paths = list(pth.parent.glob(f'{pth.name}*.egg-info/PKG-INFO'))
|
|
55
|
+
pkg_info_paths += list(pth.parent.glob(f'{pth.name}*.dist-info/METADATA'))
|
|
56
|
+
if len(metadata_json_paths) == 1 and not pkg_info_paths:
|
|
57
|
+
return query_metadata_json(metadata_json_paths[0])
|
|
58
|
+
if not metadata_json_paths and len(pkg_info_paths) == 1:
|
|
59
|
+
return query_pkg_info(pkg_info_paths[0])
|
|
60
|
+
_LOG.debug(
|
|
61
|
+
'in %s found %i JSON metadata: %s and %i PKG-INFO metadata: %s'
|
|
62
|
+
' - unable to infer package metadata, continuing search',
|
|
63
|
+
pth, len(metadata_json_paths), metadata_json_paths, len(pkg_info_paths), pkg_info_paths)
|
|
64
|
+
global_metadata_json_paths.extend(metadata_json_paths)
|
|
65
|
+
global_pkg_info_paths.extend(pkg_info_paths)
|
|
66
|
+
raise ValueError(
|
|
67
|
+
f'unable to infer package metadata from the following paths {paths} '
|
|
68
|
+
f'- found {len(global_metadata_json_paths)} JSON metadata: {global_metadata_json_paths}'
|
|
69
|
+
f' and {len(global_pkg_info_paths)} PKG-INFO metadata: {global_pkg_info_paths}')
|
|
@@ -19,7 +19,7 @@ def _caller_folder(stack_level: int = 1) -> pathlib.Path:
|
|
|
19
19
|
caller_path = frame_info[1] # frame_info.filename
|
|
20
20
|
|
|
21
21
|
here = pathlib.Path(caller_path).absolute().resolve()
|
|
22
|
-
assert here.is_file(), here
|
|
22
|
+
assert here.is_file() or here.name == '<string>', here
|
|
23
23
|
here = here.parent
|
|
24
24
|
assert here.is_dir(), here
|
|
25
25
|
_LOG.debug('found directory "%s"', here)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: version-query
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.6.0
|
|
4
4
|
Summary: Zero-overhead package versioning for Python.
|
|
5
5
|
Home-page: https://github.com/mbdevpl/version-query
|
|
6
6
|
Download-URL:
|
|
@@ -18,25 +18,38 @@ Classifier: Natural Language :: English
|
|
|
18
18
|
Classifier: Operating System :: MacOS
|
|
19
19
|
Classifier: Operating System :: Microsoft :: Windows
|
|
20
20
|
Classifier: Operating System :: POSIX :: Linux
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.9
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.10
|
|
24
23
|
Classifier: Programming Language :: Python :: 3.11
|
|
25
24
|
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
26
26
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
27
27
|
Classifier: Topic :: Software Development :: Version Control
|
|
28
28
|
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
29
29
|
Classifier: Topic :: System :: Software Distribution
|
|
30
30
|
Classifier: Topic :: Utilities
|
|
31
31
|
Classifier: Typing :: Typed
|
|
32
|
-
Requires-Python: >=3.
|
|
32
|
+
Requires-Python: >=3.9
|
|
33
33
|
Description-Content-Type: text/x-rst; charset=UTF-8
|
|
34
34
|
License-File: LICENSE
|
|
35
35
|
License-File: NOTICE
|
|
36
36
|
Requires-Dist: boilerplates[cli,logging]~=1.0
|
|
37
37
|
Requires-Dist: GitPython~=3.1
|
|
38
|
-
Requires-Dist: packaging>=
|
|
38
|
+
Requires-Dist: packaging>=24.0
|
|
39
39
|
Requires-Dist: semver<3.1,>=2.13
|
|
40
|
+
Dynamic: author
|
|
41
|
+
Dynamic: author-email
|
|
42
|
+
Dynamic: classifier
|
|
43
|
+
Dynamic: description
|
|
44
|
+
Dynamic: description-content-type
|
|
45
|
+
Dynamic: home-page
|
|
46
|
+
Dynamic: keywords
|
|
47
|
+
Dynamic: license
|
|
48
|
+
Dynamic: maintainer
|
|
49
|
+
Dynamic: maintainer-email
|
|
50
|
+
Dynamic: requires-dist
|
|
51
|
+
Dynamic: requires-python
|
|
52
|
+
Dynamic: summary
|
|
40
53
|
|
|
41
54
|
.. role:: bash(code)
|
|
42
55
|
:language: bash
|
|
@@ -68,7 +81,7 @@ Zero-overhead package versioning for Python.
|
|
|
68
81
|
:alt: grade from Codacy
|
|
69
82
|
|
|
70
83
|
.. image:: https://img.shields.io/github/license/mbdevpl/version-query.svg
|
|
71
|
-
:target: https://github.com/mbdevpl/version-query/blob/v1.
|
|
84
|
+
:target: https://github.com/mbdevpl/version-query/blob/v1.6.0/NOTICE
|
|
72
85
|
:alt: license
|
|
73
86
|
|
|
74
87
|
Package versioning toolkit for Python which relies on git tags, git history traversal
|
|
@@ -476,10 +489,10 @@ using version-query without any issues.
|
|
|
476
489
|
Requirements
|
|
477
490
|
============
|
|
478
491
|
|
|
479
|
-
Python version 3.
|
|
492
|
+
Python version 3.9 or later.
|
|
480
493
|
|
|
481
|
-
Python libraries as specified in `requirements.txt <https://github.com/mbdevpl/version-query/blob/v1.
|
|
494
|
+
Python libraries as specified in `requirements.txt <https://github.com/mbdevpl/version-query/blob/v1.6.0/requirements.txt>`_.
|
|
482
495
|
|
|
483
|
-
Building and running tests additionally requires packages listed in `requirements_test.txt <https://github.com/mbdevpl/version-query/blob/v1.
|
|
496
|
+
Building and running tests additionally requires packages listed in `requirements_test.txt <https://github.com/mbdevpl/version-query/blob/v1.6.0/requirements_test.txt>`_.
|
|
484
497
|
|
|
485
498
|
Tested on Linux, macOS and Windows.
|
|
@@ -21,11 +21,21 @@ setup.py
|
|
|
21
21
|
./version_query/py_query.py
|
|
22
22
|
./version_query/query.py
|
|
23
23
|
./version_query/version.py
|
|
24
|
+
test/__init__.py
|
|
24
25
|
test/examples.py
|
|
25
26
|
test/test_git.py
|
|
26
27
|
test/test_packaging.py
|
|
27
28
|
test/test_query.py
|
|
28
29
|
test/test_version.py
|
|
30
|
+
version_query/__init__.py
|
|
31
|
+
version_query/__main__.py
|
|
32
|
+
version_query/_version.py
|
|
33
|
+
version_query/git_query.py
|
|
34
|
+
version_query/main.py
|
|
35
|
+
version_query/py.typed
|
|
36
|
+
version_query/py_query.py
|
|
37
|
+
version_query/query.py
|
|
38
|
+
version_query/version.py
|
|
29
39
|
version_query.egg-info/PKG-INFO
|
|
30
40
|
version_query.egg-info/SOURCES.txt
|
|
31
41
|
version_query.egg-info/dependency_links.txt
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"""Python package version query tools."""
|
|
2
|
-
|
|
3
|
-
import logging
|
|
4
|
-
import json
|
|
5
|
-
import pathlib
|
|
6
|
-
|
|
7
|
-
from .version import Version
|
|
8
|
-
|
|
9
|
-
_LOG = logging.getLogger(__name__)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def query_metadata_json(path: pathlib.Path) -> Version:
|
|
13
|
-
"""Get version from metadata.json file."""
|
|
14
|
-
with path.open('r') as metadata_file:
|
|
15
|
-
metadata = json.load(metadata_file)
|
|
16
|
-
version_str = metadata['version']
|
|
17
|
-
return Version.from_str(version_str)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def query_pkg_info(path: pathlib.Path) -> Version:
|
|
21
|
-
"""Get version from PKG-INFO file."""
|
|
22
|
-
with path.open('r') as pkginfo_file:
|
|
23
|
-
for line in pkginfo_file:
|
|
24
|
-
if line.startswith('Version:'):
|
|
25
|
-
version_str = line.replace('Version:', '').strip()
|
|
26
|
-
return Version.from_str(version_str)
|
|
27
|
-
raise ValueError(path)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def query_package_folder(path: pathlib.Path, search_parent_directories: bool = False) -> Version:
|
|
31
|
-
"""Get version from Python package folder."""
|
|
32
|
-
paths = [path]
|
|
33
|
-
if search_parent_directories:
|
|
34
|
-
paths += path.parents
|
|
35
|
-
metadata_json_paths, pkg_info_paths = None, None
|
|
36
|
-
for pth in paths:
|
|
37
|
-
metadata_json_paths = list(pth.parent.glob(f'{pth.name}*.dist-info/metadata.json'))
|
|
38
|
-
pkg_info_paths = list(pth.parent.glob(f'{pth.name}*.egg-info/PKG-INFO'))
|
|
39
|
-
pkg_info_paths += list(pth.parent.glob(f'{pth.name}*.dist-info/METADATA'))
|
|
40
|
-
if len(metadata_json_paths) == 1 and not pkg_info_paths:
|
|
41
|
-
return query_metadata_json(metadata_json_paths[0])
|
|
42
|
-
if not metadata_json_paths and len(pkg_info_paths) == 1:
|
|
43
|
-
return query_pkg_info(pkg_info_paths[0])
|
|
44
|
-
raise ValueError(paths, metadata_json_paths, pkg_info_paths)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|