version-query 1.2.0__tar.gz → 1.4.0rc1__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.
Files changed (35) hide show
  1. {version-query-1.2.0 → version-query-1.4.0rc1}/NOTICE +1 -1
  2. {version-query-1.2.0/version_query.egg-info → version-query-1.4.0rc1}/PKG-INFO +13 -13
  3. {version-query-1.2.0 → version-query-1.4.0rc1}/README.rst +7 -7
  4. version-query-1.4.0rc1/requirements.txt +4 -0
  5. version-query-1.4.0rc1/requirements_test.txt +6 -0
  6. {version-query-1.2.0 → version-query-1.4.0rc1}/setup.py +1 -1
  7. {version-query-1.2.0 → version-query-1.4.0rc1}/setup_boilerplate.py +2 -8
  8. {version-query-1.2.0 → version-query-1.4.0rc1}/test/examples.py +7 -2
  9. {version-query-1.2.0 → version-query-1.4.0rc1}/test/test_git.py +13 -13
  10. {version-query-1.2.0 → version-query-1.4.0rc1}/test/test_setup.py +23 -7
  11. {version-query-1.2.0 → version-query-1.4.0rc1}/version_query/git_query.py +1 -1
  12. {version-query-1.2.0 → version-query-1.4.0rc1}/version_query/main.py +1 -1
  13. {version-query-1.2.0 → version-query-1.4.0rc1}/version_query/version.py +6 -2
  14. {version-query-1.2.0 → version-query-1.4.0rc1/version_query.egg-info}/PKG-INFO +13 -13
  15. version-query-1.4.0rc1/version_query.egg-info/requires.txt +4 -0
  16. version-query-1.2.0/requirements.txt +0 -4
  17. version-query-1.2.0/requirements_test.txt +0 -6
  18. version-query-1.2.0/version_query.egg-info/requires.txt +0 -4
  19. {version-query-1.2.0 → version-query-1.4.0rc1}/LICENSE +0 -0
  20. {version-query-1.2.0 → version-query-1.4.0rc1}/MANIFEST.in +0 -0
  21. {version-query-1.2.0 → version-query-1.4.0rc1}/pyproject.toml +0 -0
  22. {version-query-1.2.0 → version-query-1.4.0rc1}/setup.cfg +0 -0
  23. {version-query-1.2.0 → version-query-1.4.0rc1}/test/__init__.py +0 -0
  24. {version-query-1.2.0 → version-query-1.4.0rc1}/test/test_query.py +0 -0
  25. {version-query-1.2.0 → version-query-1.4.0rc1}/test/test_version.py +0 -0
  26. {version-query-1.2.0 → version-query-1.4.0rc1}/test/test_with_git_repo.py +0 -0
  27. {version-query-1.2.0 → version-query-1.4.0rc1}/version_query/__init__.py +0 -0
  28. {version-query-1.2.0 → version-query-1.4.0rc1}/version_query/__main__.py +0 -0
  29. {version-query-1.2.0 → version-query-1.4.0rc1}/version_query/_version.py +0 -0
  30. {version-query-1.2.0 → version-query-1.4.0rc1}/version_query/py.typed +0 -0
  31. {version-query-1.2.0 → version-query-1.4.0rc1}/version_query/py_query.py +0 -0
  32. {version-query-1.2.0 → version-query-1.4.0rc1}/version_query/query.py +0 -0
  33. {version-query-1.2.0 → version-query-1.4.0rc1}/version_query.egg-info/SOURCES.txt +0 -0
  34. {version-query-1.2.0 → version-query-1.4.0rc1}/version_query.egg-info/dependency_links.txt +0 -0
  35. {version-query-1.2.0 → version-query-1.4.0rc1}/version_query.egg-info/top_level.txt +0 -0
@@ -1,5 +1,5 @@
1
1
  version-query
2
- Copyright (c) 2017-2020 Mateusz Bysiek https://mbdevpl.github.io/
2
+ Copyright (c) 2017-2023 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
1
  Metadata-Version: 2.1
2
2
  Name: version-query
3
- Version: 1.2.0
3
+ Version: 1.4.0rc1
4
4
  Summary: Zero-overhead package versioning for Python.
5
5
  Home-page: https://github.com/mbdevpl/version-query
6
6
  Download-URL:
@@ -18,16 +18,16 @@ Classifier: Natural Language :: English
18
18
  Classifier: Operating System :: MacOS :: MacOS X
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
23
+ Classifier: Programming Language :: Python :: 3.11
24
24
  Classifier: Programming Language :: Python :: 3 :: Only
25
25
  Classifier: Topic :: Software Development :: Version Control
26
26
  Classifier: Topic :: Software Development :: Version Control :: Git
27
27
  Classifier: Topic :: System :: Software Distribution
28
28
  Classifier: Topic :: Utilities
29
29
  Classifier: Typing :: Typed
30
- Requires-Python: >=3.8
30
+ Requires-Python: >=3.9
31
31
  Description-Content-Type: text/x-rst; charset=UTF-8
32
32
  License-File: LICENSE
33
33
  License-File: NOTICE
@@ -62,7 +62,7 @@ Zero-overhead package versioning for Python.
62
62
  :alt: grade from Codacy
63
63
 
64
64
  .. image:: https://img.shields.io/github/license/mbdevpl/version-query.svg
65
- :target: https://github.com/mbdevpl/version-query/blob/v1.2.0/NOTICE
65
+ :target: https://github.com/mbdevpl/version-query/blob/v1.4.0rc1/NOTICE
66
66
  :alt: license
67
67
 
68
68
  Package versioning toolkit for Python which relies on git tags, git history traversal
@@ -229,7 +229,7 @@ Examples of valid version tags:
229
229
  * ``v1.0``
230
230
  * ``v0.16.0``
231
231
  * ``v1.0.dev3``
232
- * ``ver0.5.1-4.0.0+a1de3012``
232
+ * ``ver0.5.1-4.0.0+gita1de3012``
233
233
  * ``42.0``
234
234
  * ``3.14-15``
235
235
 
@@ -274,8 +274,8 @@ the current commit and the most recent version tag.
274
274
 
275
275
  Additionally, the ``<patch>`` version component is incremented by ``1``.
276
276
 
277
- Additionally, a plus (``+``) character and the first 8 characters of SHA of the latest commit
278
- are appended to version identifier, e.g. ``+a3014fe0``.
277
+ Additionally, a plus (``+``) character, word ``git`` and the first 8 characters of SHA
278
+ of the latest commit are appended to version identifier, e.g. ``+gita3014fe0``.
279
279
 
280
280
 
281
281
  Repository index status
@@ -290,16 +290,16 @@ of the repository:
290
290
 
291
291
  * Most recent version tag is ``v0.4.5``, there were 2 commits since,
292
292
  latest having SHA starting with ``812f12ea``.
293
- Version identifier will be ``0.4.6.dev2+812f12ea``.
293
+ Version identifier will be ``0.4.6.dev2+git812f12ea``.
294
294
 
295
295
  * Most recent version tag is ``ver6.0``, and there was 1 commit since
296
296
  having SHA starting with ``e10ac365``.
297
- Version identifier will be ``6.0.1.dev1+e10ac365``.
297
+ Version identifier will be ``6.0.1.dev1+gite10ac365``.
298
298
 
299
299
  * Most recent version tag is ``v9``, there were 40 commit since,
300
300
  latest having SHA starting with ``1ad22355``, the repository has uncommitted changes and
301
301
  version was queried at 19:52.20, 8th June 2017.
302
- the result is ``9.0.1.dev40+1ad22355.dirty20170608195220``.
302
+ the result is ``9.0.1.dev40+git1ad22355.dirty20170608195220``.
303
303
 
304
304
 
305
305
  How exactly version numbers are compared
@@ -470,10 +470,10 @@ using version-query without any issues.
470
470
  Requirements
471
471
  ============
472
472
 
473
- Python version 3.8 or later.
473
+ Python version 3.9 or later.
474
474
 
475
- Python libraries as specified in `requirements.txt <https://github.com/mbdevpl/version-query/blob/v1.2.0/requirements.txt>`_.
475
+ Python libraries as specified in `requirements.txt <https://github.com/mbdevpl/version-query/blob/v1.4.0rc1/requirements.txt>`_.
476
476
 
477
- Building and running tests additionally requires packages listed in `requirements_test.txt <https://github.com/mbdevpl/version-query/blob/v1.2.0/requirements_test.txt>`_.
477
+ Building and running tests additionally requires packages listed in `requirements_test.txt <https://github.com/mbdevpl/version-query/blob/v1.4.0rc1/requirements_test.txt>`_.
478
478
 
479
479
  Tested on Linux, OS X and Windows.
@@ -195,7 +195,7 @@ Examples of valid version tags:
195
195
  * ``v1.0``
196
196
  * ``v0.16.0``
197
197
  * ``v1.0.dev3``
198
- * ``ver0.5.1-4.0.0+a1de3012``
198
+ * ``ver0.5.1-4.0.0+gita1de3012``
199
199
  * ``42.0``
200
200
  * ``3.14-15``
201
201
 
@@ -240,8 +240,8 @@ the current commit and the most recent version tag.
240
240
 
241
241
  Additionally, the ``<patch>`` version component is incremented by ``1``.
242
242
 
243
- Additionally, a plus (``+``) character and the first 8 characters of SHA of the latest commit
244
- are appended to version identifier, e.g. ``+a3014fe0``.
243
+ Additionally, a plus (``+``) character, word ``git`` and the first 8 characters of SHA
244
+ of the latest commit are appended to version identifier, e.g. ``+gita3014fe0``.
245
245
 
246
246
 
247
247
  Repository index status
@@ -256,16 +256,16 @@ of the repository:
256
256
 
257
257
  * Most recent version tag is ``v0.4.5``, there were 2 commits since,
258
258
  latest having SHA starting with ``812f12ea``.
259
- Version identifier will be ``0.4.6.dev2+812f12ea``.
259
+ Version identifier will be ``0.4.6.dev2+git812f12ea``.
260
260
 
261
261
  * Most recent version tag is ``ver6.0``, and there was 1 commit since
262
262
  having SHA starting with ``e10ac365``.
263
- Version identifier will be ``6.0.1.dev1+e10ac365``.
263
+ Version identifier will be ``6.0.1.dev1+gite10ac365``.
264
264
 
265
265
  * Most recent version tag is ``v9``, there were 40 commit since,
266
266
  latest having SHA starting with ``1ad22355``, the repository has uncommitted changes and
267
267
  version was queried at 19:52.20, 8th June 2017.
268
- the result is ``9.0.1.dev40+1ad22355.dirty20170608195220``.
268
+ the result is ``9.0.1.dev40+git1ad22355.dirty20170608195220``.
269
269
 
270
270
 
271
271
  How exactly version numbers are compared
@@ -436,7 +436,7 @@ using version-query without any issues.
436
436
  Requirements
437
437
  ============
438
438
 
439
- Python version 3.8 or later.
439
+ Python version 3.9 or later.
440
440
 
441
441
  Python libraries as specified in `<requirements.txt>`_.
442
442
 
@@ -0,0 +1,4 @@
1
+ GitPython ~= 3.1
2
+ packaging >= 23.0
3
+ semver ~= 2.13
4
+ setuptools >= 67.4
@@ -0,0 +1,6 @@
1
+ colorlog ~= 6.7
2
+ docutils ~= 0.19
3
+ pip >= 23.0
4
+ Pygments ~= 2.14
5
+ wheel >= 0.40
6
+ -r requirements.txt
@@ -20,9 +20,9 @@ class Package(setup_boilerplate.Package):
20
20
  'Operating System :: MacOS :: MacOS X',
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',
25
+ 'Programming Language :: Python :: 3.11',
26
26
  'Programming Language :: Python :: 3 :: Only',
27
27
  'Topic :: Software Development :: Version Control',
28
28
  'Topic :: Software Development :: Version Control :: Git',
@@ -44,7 +44,7 @@ import docutils.parsers.rst
44
44
  import docutils.utils
45
45
  import setuptools
46
46
 
47
- __version__ = '2022.08.27'
47
+ __version__ = '2023.03.09'
48
48
 
49
49
  _LOG = logging.getLogger(__name__)
50
50
 
@@ -202,15 +202,9 @@ class RelativeRefFinder(docutils.nodes.NodeVisitor):
202
202
  # we ignore the section part when checking if file exists
203
203
  path = path.with_name(path.name[:path.name.index('#')])
204
204
  try:
205
- resolved_path = path.resolve(strict=True)
205
+ self.root_dir.joinpath(path).resolve(strict=True)
206
206
  except FileNotFoundError:
207
207
  return
208
- try:
209
- resolved_path.relative_to(self.root_dir)
210
- except ValueError:
211
- return
212
- if not path.is_file():
213
- return
214
208
  _LOG.debug('RelativeRefFinder: reference points to existing file')
215
209
  self.references.append(node)
216
210
 
@@ -70,7 +70,10 @@ INIT_CASES: t.Dict[str, t.Tuple[tuple, dict]] = {
70
70
  '1': ((1,), {}),
71
71
  '1.0': ((1, 0), {}),
72
72
  '1.0.0': ((1, 0, 0), {}),
73
+ '1.0.0rc1': ((1, 0, 0, None, 'rc', 1), {}),
74
+ '1.0.0rc2': ((1, 0, 0, None, 'rc', 2), {}),
73
75
  '1.0.0.rc2': ((1, 0, 0, '.', 'rc', 2), {}),
76
+ '1.0.0rc3': ((1, 0, 0, None, 'rc', 3), {}),
74
77
  '1.0.0.rc3': ((1, 0, 0, ('.', 'rc', 3)), {}),
75
78
  '1.0.0.rc2+local': ((1, 0, 0, '.', 'rc', 2, 'local'), {}),
76
79
  '1.0.0.rc3+local': ((1, 0, 0, ('.', 'rc', 3), 'local'), {}),
@@ -126,14 +129,16 @@ COMPATIBLE_STR_CASES = {
126
129
  '1.0.0.4': ((1, 0, 0, '.', None, 4), {}),
127
130
  '2.0.0.8+cc81cee': ((2, 0, 0, '.', None, 8, 'cc81cee'), {}),
128
131
  '4.5.0.dev1234': ((4, 5, 0, '.', 'dev', 1234), {}),
129
- '1.0.0.rc3': ((1, 0, 0, '.', 'rc', 3), {}),
132
+ '1.0.0rc1': ((1, 0, 0, None, 'rc', 1), {}),
133
+ '1.0.0rc3': ((1, 0, 0, None, 'rc', 3), {}),
130
134
  '1.0.1.dev0': ((1, 0, 1, '.', 'dev', 0), {}),
131
135
  '0.4.4.dev5+84e1d430': ((0, 4, 4, '.', 'dev', 5, '84e1d430'), {}),
132
136
  '0.4.4.dev5+20171003.84e1d430': ((0, 4, 4, '.', 'dev', 5, '20171003', '.', '84e1d430'), {})}
133
137
 
134
138
  INCOMPATIBLE_STR_CASES: t.Dict[str, t.Tuple[tuple, dict]] = {
135
139
  '1.0.0-2': ((1, 0, 0, '-', None, 2), {}),
136
- '1.0.0-0.2': ((1, 0, 0, '-', None, 0, '.', None, 2), {}),
140
+ # '1.0.0-0.2': ((1, 0, 0, '-', None, 0, '.', None, 2), {}),
141
+ '1.0.0.rc3': ((1, 0, 0, '.', 'rc', 3), {}),
137
142
  '4.5.0.dev': ((4, 5, 0, '.', 'dev', None), {})}
138
143
 
139
144
  STR_CASES = dict(itertools.chain(COMPATIBLE_STR_CASES.items(),
@@ -35,7 +35,7 @@ class Tests(GitRepoTests):
35
35
  with self.assertRaises(ValueError):
36
36
  query_git_repo(self.repo_path)
37
37
  version = predict_git_repo(self.repo_path)
38
- self.assertEqual(version.to_str(), f'0.1.0.dev{i}+{self.repo_head_hexsha}')
38
+ self.assertEqual(version.to_str(), f'0.1.0.dev{i}+git{self.repo_head_hexsha}')
39
39
 
40
40
  def test_only_nonversion_tags(self):
41
41
  for i in range(1, 5):
@@ -44,7 +44,7 @@ class Tests(GitRepoTests):
44
44
  with self.assertRaises(ValueError):
45
45
  query_git_repo(self.repo_path)
46
46
  version = predict_git_repo(self.repo_path)
47
- self.assertEqual(version.to_str(), f'0.1.0.dev{i}+{self.repo_head_hexsha}')
47
+ self.assertEqual(version.to_str(), f'0.1.0.dev{i}+git{self.repo_head_hexsha}')
48
48
 
49
49
  def test_inconsistent_tag_prefix(self):
50
50
  version = Version.from_str('1.0')
@@ -70,7 +70,7 @@ class Tests(GitRepoTests):
70
70
  upcoming_version = predict_git_repo(self.repo_path)
71
71
  version.increment(VersionComponent.Patch, 1)
72
72
  version.increment(VersionComponent.DevPatch, 2)
73
- version.local = (self.repo_head_hexsha,)
73
+ version.local = (f'git{self.repo_head_hexsha}',)
74
74
  self.assertEqual(version, upcoming_version)
75
75
 
76
76
  def test_too_long_no_tag(self):
@@ -103,7 +103,7 @@ class Tests(GitRepoTests):
103
103
  with self.assertRaises(ValueError):
104
104
  query_git_repo(self.repo_path)
105
105
  upcoming_version = predict_git_repo(self.repo_path)
106
- self.assertEqual(upcoming_version.to_str(), f'0.1.0.dev6+{self.repo_head_hexsha}')
106
+ self.assertEqual(upcoming_version.to_str(), f'0.1.0.dev6+git{self.repo_head_hexsha}')
107
107
 
108
108
  def test_invalid_version_tags(self):
109
109
  for i in range(1, 3):
@@ -116,7 +116,7 @@ class Tests(GitRepoTests):
116
116
  self.assertEqual(current_version.to_str(), f'{i}.0.0')
117
117
  upcoming_version = predict_git_repo(self.repo_path)
118
118
  current_version.devel_increment(1)
119
- current_version.local = (self.repo_head_hexsha,)
119
+ current_version.local = (f'git{self.repo_head_hexsha}',)
120
120
  self.assertEqual(current_version, upcoming_version)
121
121
 
122
122
  def test_dirty_repo(self):
@@ -133,9 +133,9 @@ class Tests(GitRepoTests):
133
133
  self.assertLess(version, upcoming_version)
134
134
  if new_commit:
135
135
  current_version.devel_increment(1)
136
- current_version.local = (self.repo_head_hexsha,)
136
+ current_version.local = (f'git{self.repo_head_hexsha}',)
137
137
  self.assertTupleEqual(current_version.local, upcoming_version.local[:1])
138
- local_prefix = f'+{self.repo_head_hexsha}.dirty'
138
+ local_prefix = f'+git{self.repo_head_hexsha}.dirty'
139
139
  else:
140
140
  local_prefix = '+dirty'
141
141
  self.assertTrue(upcoming_version.local_to_str().startswith(local_prefix),
@@ -157,12 +157,12 @@ class Tests(GitRepoTests):
157
157
  current_version = query_git_repo(self.repo_path)
158
158
  self.assertEqual(current_version.to_str(), '0.1.0')
159
159
  upcoming_version = predict_git_repo(self.repo_path)
160
- self.assertEqual(upcoming_version.to_str(), f'0.1.1.dev1+{self.repo_head_hexsha}')
160
+ self.assertEqual(upcoming_version.to_str(), f'0.1.1.dev1+git{self.repo_head_hexsha}')
161
161
  self.repo.git.checkout('devel')
162
162
  current_version = query_git_repo(self.repo_path)
163
163
  self.assertEqual(current_version.to_str(), '0.2.0')
164
164
  upcoming_version = predict_git_repo(self.repo_path)
165
- self.assertEqual(upcoming_version.to_str(), f'0.2.1.dev1+{self.repo_head_hexsha}')
165
+ self.assertEqual(upcoming_version.to_str(), f'0.2.1.dev1+git{self.repo_head_hexsha}')
166
166
 
167
167
  def test_tags_on_merged_branches(self):
168
168
  self.git_commit_new_file()
@@ -182,7 +182,7 @@ class Tests(GitRepoTests):
182
182
  current_version = query_git_repo(self.repo_path)
183
183
  self.assertEqual(current_version.to_str(), '0.2.0')
184
184
  upcoming_version = predict_git_repo(self.repo_path)
185
- self.assertEqual(upcoming_version.to_str(), f'0.2.1.dev5+{self.repo_head_hexsha}')
185
+ self.assertEqual(upcoming_version.to_str(), f'0.2.1.dev5+git{self.repo_head_hexsha}')
186
186
 
187
187
  def test_tag_on_merged_branch(self):
188
188
  self.git_commit_new_file()
@@ -196,7 +196,7 @@ class Tests(GitRepoTests):
196
196
  current_version = query_git_repo(self.repo_path)
197
197
  self.assertEqual(current_version.to_str(), '1.0.0')
198
198
  upcoming_version = predict_git_repo(self.repo_path)
199
- self.assertEqual(upcoming_version.to_str(), f'1.0.1.dev1+{self.repo_head_hexsha}')
199
+ self.assertEqual(upcoming_version.to_str(), f'1.0.1.dev1+git{self.repo_head_hexsha}')
200
200
 
201
201
  def test_many_versions_on_one_commit(self):
202
202
  self.git_commit_new_file()
@@ -207,7 +207,7 @@ class Tests(GitRepoTests):
207
207
  current_version = query_git_repo(self.repo_path)
208
208
  self.assertEqual(current_version.to_str(), '0.3.0')
209
209
  upcoming_version = predict_git_repo(self.repo_path)
210
- self.assertEqual(upcoming_version.to_str(), f'0.3.1.dev1+{self.repo_head_hexsha}')
210
+ self.assertEqual(upcoming_version.to_str(), f'0.3.1.dev1+git{self.repo_head_hexsha}')
211
211
 
212
212
  def test_version_decreased(self):
213
213
  self.git_commit_new_file()
@@ -218,4 +218,4 @@ class Tests(GitRepoTests):
218
218
  current_version = query_git_repo(self.repo_path)
219
219
  self.assertEqual(current_version.to_str(), '0.1.0')
220
220
  upcoming_version = predict_git_repo(self.repo_path)
221
- self.assertEqual(upcoming_version.to_str(), f'0.1.1.dev1+{self.repo_head_hexsha}')
221
+ self.assertEqual(upcoming_version.to_str(), f'0.1.1.dev1+git{self.repo_head_hexsha}')
@@ -2,6 +2,7 @@
2
2
 
3
3
  import importlib
4
4
  import itertools
5
+ import logging
5
6
  import os
6
7
  import pathlib
7
8
  import runpy
@@ -12,16 +13,31 @@ import types
12
13
  import typing as t
13
14
  import unittest
14
15
 
15
- __version__ = '2022.08.27'
16
+ __version__ = '2023.03.09'
17
+
18
+ _LOG = logging.getLogger(__name__)
19
+
20
+
21
+ def expand_args_by_globbing_items(*args: str) -> t.Tuple[str, ...]:
22
+ """Expand a list of glob expressions."""
23
+ cwd = pathlib.Path.cwd()
24
+ expanded_args = []
25
+ for arg in args:
26
+ if '*' not in arg:
27
+ expanded_args.append(arg)
28
+ continue
29
+ expanded_arg = [str(_.relative_to(cwd)) for _ in cwd.glob(arg)]
30
+ assert expanded_arg, arg
31
+ _LOG.debug('expanded arg "%s" to %s', arg, expanded_arg)
32
+ expanded_args += expanded_arg
33
+ _LOG.debug('expanded args to %s', expanded_args)
34
+ return tuple(expanded_args)
16
35
 
17
36
 
18
37
  def run_program(*args, glob: bool = False) -> None:
19
38
  """Run subprocess with given args. Use path globbing for each arg that contains an asterisk."""
20
39
  if glob:
21
- cwd = pathlib.Path.cwd()
22
- args = tuple(itertools.chain.from_iterable(
23
- list(str(_.relative_to(cwd)) for _ in cwd.glob(arg)) if '*' in arg else [arg]
24
- for arg in args))
40
+ args = expand_args_by_globbing_items(*args)
25
41
  try:
26
42
  subprocess.run(args, check=True)
27
43
  except subprocess.CalledProcessError as err:
@@ -97,7 +113,7 @@ LINK_EXAMPLES = [
97
113
  (None, 'setup.py', True), ('this file', 'setup.py', True), (None, 'test/test_setup.py', True),
98
114
  (None, 'test/test_setup.py#L98', True), ('line 5 of this file', 'setup.py#L5', True),
99
115
  (None, 'http://site.com', False), (None, '../something/else', False), (None, 'no.thing', False),
100
- (None, '/my/abs/path', False)]
116
+ (None, '/my/abs/path', False), ('test dir', 'test', True)]
101
117
 
102
118
 
103
119
  def get_package_folder_name():
@@ -293,7 +309,7 @@ class PackageTests(unittest.TestCase):
293
309
 
294
310
  @unittest.skipUnless(os.environ.get('TEST_PACKAGING') or os.environ.get('CI'),
295
311
  'skipping packaging tests for actual package')
296
- class IntergrationTests(unittest.TestCase):
312
+ class IntegrationTests(unittest.TestCase):
297
313
  """Test if the boilerplate can actually create a valid package."""
298
314
 
299
315
  pkg_name = get_package_folder_name()
@@ -145,7 +145,7 @@ def predict_git_repo(repo_path: pathlib.Path, search_parent_directories: bool =
145
145
  assert isinstance(version, Version), version
146
146
  if commit_distance > 0:
147
147
  version.devel_increment(commit_distance)
148
- version.local = (repo.head.commit.hexsha[:8],)
148
+ version.local = (f'git{repo.head.commit.hexsha[:8]}',)
149
149
  if is_repo_dirty:
150
150
  dt_ = f'dirty{datetime.datetime.strftime(datetime.datetime.now(), "%Y%m%d%H%M%S")}'
151
151
  if version.has_local:
@@ -24,7 +24,7 @@ def main(args=None, namespace=None) -> None:
24
24
  prog='version_query',
25
25
  description='''Tool for querying current versions of Python packages. Use LOGGING_LEVEL
26
26
  environment variable to adjust logging level.''',
27
- epilog='''Copyright 2017-2020 by the contributors, Apache License 2.0,
27
+ epilog='''Copyright 2017-2023 by the contributors, Apache License 2.0,
28
28
  https://github.com/mbdevpl/version-query''',
29
29
  formatter_class=argparse.ArgumentDefaultsHelpFormatter)
30
30
  parser.add_argument('-i', '--increment', action='store_true', help='''output version string for
@@ -12,6 +12,8 @@ import semver
12
12
 
13
13
  _LOG = logging.getLogger(__name__)
14
14
 
15
+ PY_PRE_RELEASE_INDICATORS = {'a', 'b', 'c', 'rc'}
16
+
15
17
 
16
18
  @enum.unique
17
19
  class VersionComponent(enum.IntEnum):
@@ -168,8 +170,8 @@ class Version(collections.abc.Hashable): # pylint: disable = too-many-public-me
168
170
  elif ver.pre:
169
171
  pre_ver = ver.pre
170
172
  if pre_ver:
171
- pre_release = [('.', pre_ver[0] if len(pre_ver) > 0 else None,
172
- pre_ver[1] if len(pre_ver) > 1 else None)]
173
+ prefix_dot = None if pre_ver[0] in PY_PRE_RELEASE_INDICATORS else '.'
174
+ pre_release = [(prefix_dot, pre_ver[0], pre_ver[1] if len(pre_ver) > 1 else None)]
173
175
  if ver.local:
174
176
  local = tuple(itertools.chain.from_iterable(
175
177
  (dot, str(_)) for dot, _ in zip('.' * len(ver.local), ver.local)))[1:]
@@ -502,6 +504,8 @@ class Version(collections.abc.Hashable): # pylint: disable = too-many-public-me
502
504
  return '{}{}'.format(*version_tuple[:2])
503
505
  if _version_tuple_checker(version_tuple, (True, False, True)):
504
506
  return f'{version_tuple[0]}{version_tuple[2]}'
507
+ if _version_tuple_checker(version_tuple, (False, True, True)):
508
+ return '{}{}'.format(*version_tuple[1:])
505
509
  if _version_tuple_checker(version_tuple, (True, True, True)):
506
510
  return '{}{}{}'.format(*version_tuple)
507
511
  raise ValueError(f'cannot generate valid version string from {repr(self)}')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: version-query
3
- Version: 1.2.0
3
+ Version: 1.4.0rc1
4
4
  Summary: Zero-overhead package versioning for Python.
5
5
  Home-page: https://github.com/mbdevpl/version-query
6
6
  Download-URL:
@@ -18,16 +18,16 @@ Classifier: Natural Language :: English
18
18
  Classifier: Operating System :: MacOS :: MacOS X
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
23
+ Classifier: Programming Language :: Python :: 3.11
24
24
  Classifier: Programming Language :: Python :: 3 :: Only
25
25
  Classifier: Topic :: Software Development :: Version Control
26
26
  Classifier: Topic :: Software Development :: Version Control :: Git
27
27
  Classifier: Topic :: System :: Software Distribution
28
28
  Classifier: Topic :: Utilities
29
29
  Classifier: Typing :: Typed
30
- Requires-Python: >=3.8
30
+ Requires-Python: >=3.9
31
31
  Description-Content-Type: text/x-rst; charset=UTF-8
32
32
  License-File: LICENSE
33
33
  License-File: NOTICE
@@ -62,7 +62,7 @@ Zero-overhead package versioning for Python.
62
62
  :alt: grade from Codacy
63
63
 
64
64
  .. image:: https://img.shields.io/github/license/mbdevpl/version-query.svg
65
- :target: https://github.com/mbdevpl/version-query/blob/v1.2.0/NOTICE
65
+ :target: https://github.com/mbdevpl/version-query/blob/v1.4.0rc1/NOTICE
66
66
  :alt: license
67
67
 
68
68
  Package versioning toolkit for Python which relies on git tags, git history traversal
@@ -229,7 +229,7 @@ Examples of valid version tags:
229
229
  * ``v1.0``
230
230
  * ``v0.16.0``
231
231
  * ``v1.0.dev3``
232
- * ``ver0.5.1-4.0.0+a1de3012``
232
+ * ``ver0.5.1-4.0.0+gita1de3012``
233
233
  * ``42.0``
234
234
  * ``3.14-15``
235
235
 
@@ -274,8 +274,8 @@ the current commit and the most recent version tag.
274
274
 
275
275
  Additionally, the ``<patch>`` version component is incremented by ``1``.
276
276
 
277
- Additionally, a plus (``+``) character and the first 8 characters of SHA of the latest commit
278
- are appended to version identifier, e.g. ``+a3014fe0``.
277
+ Additionally, a plus (``+``) character, word ``git`` and the first 8 characters of SHA
278
+ of the latest commit are appended to version identifier, e.g. ``+gita3014fe0``.
279
279
 
280
280
 
281
281
  Repository index status
@@ -290,16 +290,16 @@ of the repository:
290
290
 
291
291
  * Most recent version tag is ``v0.4.5``, there were 2 commits since,
292
292
  latest having SHA starting with ``812f12ea``.
293
- Version identifier will be ``0.4.6.dev2+812f12ea``.
293
+ Version identifier will be ``0.4.6.dev2+git812f12ea``.
294
294
 
295
295
  * Most recent version tag is ``ver6.0``, and there was 1 commit since
296
296
  having SHA starting with ``e10ac365``.
297
- Version identifier will be ``6.0.1.dev1+e10ac365``.
297
+ Version identifier will be ``6.0.1.dev1+gite10ac365``.
298
298
 
299
299
  * Most recent version tag is ``v9``, there were 40 commit since,
300
300
  latest having SHA starting with ``1ad22355``, the repository has uncommitted changes and
301
301
  version was queried at 19:52.20, 8th June 2017.
302
- the result is ``9.0.1.dev40+1ad22355.dirty20170608195220``.
302
+ the result is ``9.0.1.dev40+git1ad22355.dirty20170608195220``.
303
303
 
304
304
 
305
305
  How exactly version numbers are compared
@@ -470,10 +470,10 @@ using version-query without any issues.
470
470
  Requirements
471
471
  ============
472
472
 
473
- Python version 3.8 or later.
473
+ Python version 3.9 or later.
474
474
 
475
- Python libraries as specified in `requirements.txt <https://github.com/mbdevpl/version-query/blob/v1.2.0/requirements.txt>`_.
475
+ Python libraries as specified in `requirements.txt <https://github.com/mbdevpl/version-query/blob/v1.4.0rc1/requirements.txt>`_.
476
476
 
477
- Building and running tests additionally requires packages listed in `requirements_test.txt <https://github.com/mbdevpl/version-query/blob/v1.2.0/requirements_test.txt>`_.
477
+ Building and running tests additionally requires packages listed in `requirements_test.txt <https://github.com/mbdevpl/version-query/blob/v1.4.0rc1/requirements_test.txt>`_.
478
478
 
479
479
  Tested on Linux, OS X and Windows.
@@ -0,0 +1,4 @@
1
+ GitPython~=3.1
2
+ packaging>=23.0
3
+ semver~=2.13
4
+ setuptools>=67.4
@@ -1,4 +0,0 @@
1
- GitPython ~= 3.1
2
- packaging >= 21.0
3
- semver ~= 2.13
4
- setuptools >= 60.4
@@ -1,6 +0,0 @@
1
- colorlog ~= 6.6
2
- docutils >= 0.18
3
- pip >= 21.0
4
- Pygments >= 2.5
5
- wheel >= 0.37
6
- -r requirements.txt
@@ -1,4 +0,0 @@
1
- GitPython~=3.1
2
- packaging>=21.0
3
- semver~=2.13
4
- setuptools>=60.4
File without changes