giterator 0.2.0__tar.gz → 0.3.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.
Files changed (38) hide show
  1. {giterator-0.2.0 → giterator-0.3.0}/.carthorse.yml +2 -2
  2. {giterator-0.2.0 → giterator-0.3.0}/.circleci/config.yml +4 -4
  3. {giterator-0.2.0 → giterator-0.3.0}/.coveragerc +1 -0
  4. giterator-0.3.0/.readthedocs.yml +16 -0
  5. {giterator-0.2.0 → giterator-0.3.0}/PKG-INFO +24 -8
  6. {giterator-0.2.0 → giterator-0.3.0}/docs/changes.rst +8 -0
  7. {giterator-0.2.0 → giterator-0.3.0}/docs/conf.py +1 -1
  8. {giterator-0.2.0 → giterator-0.3.0}/giterator/git.py +16 -5
  9. {giterator-0.2.0 → giterator-0.3.0}/giterator/testing.py +10 -3
  10. {giterator-0.2.0 → giterator-0.3.0}/giterator.egg-info/PKG-INFO +24 -8
  11. {giterator-0.2.0 → giterator-0.3.0}/giterator.egg-info/entry_points.txt +0 -1
  12. {giterator-0.2.0 → giterator-0.3.0}/giterator.egg-info/requires.txt +1 -0
  13. {giterator-0.2.0 → giterator-0.3.0}/setup.py +3 -3
  14. {giterator-0.2.0 → giterator-0.3.0}/tests/conftest.py +5 -0
  15. {giterator-0.2.0 → giterator-0.3.0}/tests/test_git.py +7 -2
  16. {giterator-0.2.0 → giterator-0.3.0}/tests/test_testing.py +9 -2
  17. giterator-0.2.0/.readthedocs.yml +0 -8
  18. {giterator-0.2.0 → giterator-0.3.0}/.gitignore +0 -0
  19. {giterator-0.2.0 → giterator-0.3.0}/LICENSE.rst +0 -0
  20. {giterator-0.2.0 → giterator-0.3.0}/README.rst +0 -0
  21. {giterator-0.2.0 → giterator-0.3.0}/docs/Makefile +0 -0
  22. {giterator-0.2.0 → giterator-0.3.0}/docs/api.rst +0 -0
  23. {giterator-0.2.0 → giterator-0.3.0}/docs/development.rst +0 -0
  24. {giterator-0.2.0 → giterator-0.3.0}/docs/index.rst +0 -0
  25. {giterator-0.2.0 → giterator-0.3.0}/docs/license.rst +0 -0
  26. {giterator-0.2.0 → giterator-0.3.0}/docs/use.rst +0 -0
  27. {giterator-0.2.0 → giterator-0.3.0}/giterator/__init__.py +0 -0
  28. {giterator-0.2.0 → giterator-0.3.0}/giterator/__main__.py +0 -0
  29. {giterator-0.2.0 → giterator-0.3.0}/giterator/cli.py +0 -0
  30. {giterator-0.2.0 → giterator-0.3.0}/giterator/clock.py +0 -0
  31. {giterator-0.2.0 → giterator-0.3.0}/giterator/typing.py +0 -0
  32. {giterator-0.2.0 → giterator-0.3.0}/giterator.egg-info/SOURCES.txt +0 -0
  33. {giterator-0.2.0 → giterator-0.3.0}/giterator.egg-info/dependency_links.txt +0 -0
  34. {giterator-0.2.0 → giterator-0.3.0}/giterator.egg-info/not-zip-safe +0 -0
  35. {giterator-0.2.0 → giterator-0.3.0}/giterator.egg-info/top_level.txt +0 -0
  36. {giterator-0.2.0 → giterator-0.3.0}/setup.cfg +0 -0
  37. {giterator-0.2.0 → giterator-0.3.0}/tests/__init__.py +0 -0
  38. {giterator-0.2.0 → giterator-0.3.0}/tests/test_cli.py +0 -0
@@ -3,7 +3,7 @@ carthorse:
3
3
  when:
4
4
  - version-not-tagged
5
5
  actions:
6
- - run: "sudo pip install -e .[build]"
7
- - run: "sudo python setup.py sdist bdist_wheel"
6
+ - run: "pip install -e .[build]"
7
+ - run: "python setup.py sdist bdist_wheel"
8
8
  - run: "twine upload -u __token__ -p $PYPI_TOKEN dist/*"
9
9
  - create-tag
@@ -1,16 +1,16 @@
1
1
  version: 2.1
2
2
 
3
3
  orbs:
4
- python: cjw296/python-ci@2.1
4
+ python: cjw296/python-ci@6
5
5
 
6
6
  common: &common
7
7
  jobs:
8
8
 
9
9
  - python/pip-run-tests:
10
+ name: tests
10
11
  matrix:
11
12
  parameters:
12
13
  image:
13
- - circleci/python:3.6
14
14
  - circleci/python:3.9
15
15
 
16
16
  - python/coverage:
@@ -22,7 +22,7 @@ common: &common
22
22
  name: release
23
23
  config: .carthorse.yml
24
24
  requires:
25
- - coverage
25
+ - tests
26
26
  filters:
27
27
  branches:
28
28
  only: master
@@ -34,7 +34,7 @@ workflows:
34
34
  <<: *common
35
35
  triggers:
36
36
  - schedule:
37
- cron: "0 0 * * *"
37
+ cron: "0 6 18 * *"
38
38
  filters:
39
39
  branches:
40
40
  only: master
@@ -1,2 +1,3 @@
1
1
  [run]
2
2
  source = giterator,tests
3
+ parallel = true
@@ -0,0 +1,16 @@
1
+ version: 2
2
+
3
+ build:
4
+ os: ubuntu-22.04
5
+ tools:
6
+ python: "3.12"
7
+
8
+ python:
9
+ install:
10
+ - method: pip
11
+ path: .
12
+ extra_requirements:
13
+ - build
14
+ sphinx:
15
+ fail_on_warning: true
16
+ configuration: docs/conf.py
@@ -1,19 +1,37 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: giterator
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: Python tools for doing git things.
5
5
  Home-page: https://github.com/simplistix/giterator
6
6
  Author: Chris Withers
7
7
  Author-email: chris@withers.org
8
8
  License: MIT
9
- Platform: UNKNOWN
10
9
  Classifier: License :: OSI Approved :: MIT License
11
10
  Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.6
13
- Classifier: Programming Language :: Python :: 3.9
11
+ Requires-Python: >=3.9
12
+ License-File: LICENSE.rst
14
13
  Provides-Extra: test
14
+ Requires-Dist: coverage-enable-subprocess; extra == "test"
15
+ Requires-Dist: pytest; extra == "test"
16
+ Requires-Dist: pytest-cov; extra == "test"
17
+ Requires-Dist: sybil; extra == "test"
18
+ Requires-Dist: testfixtures; extra == "test"
15
19
  Provides-Extra: build
16
- License-File: LICENSE.rst
20
+ Requires-Dist: furo; extra == "build"
21
+ Requires-Dist: sphinx; extra == "build"
22
+ Requires-Dist: setuptools-git; extra == "build"
23
+ Requires-Dist: twine; extra == "build"
24
+ Requires-Dist: wheel; extra == "build"
25
+ Dynamic: author
26
+ Dynamic: author-email
27
+ Dynamic: classifier
28
+ Dynamic: description
29
+ Dynamic: home-page
30
+ Dynamic: license
31
+ Dynamic: license-file
32
+ Dynamic: provides-extra
33
+ Dynamic: requires-python
34
+ Dynamic: summary
17
35
 
18
36
 
19
37
  giterator
@@ -28,5 +46,3 @@ giterator
28
46
  .. _Docs: http://giterator.readthedocs.org/en/latest/
29
47
 
30
48
  Python tools for doing git things.
31
-
32
-
@@ -3,6 +3,14 @@
3
3
  Changes
4
4
  =======
5
5
 
6
+ 0.3.0 (4 Feb 2026)
7
+ ------------------
8
+
9
+ - General refresh.
10
+
11
+ - Add ``short`` parameter to methods that return commit hashes,
12
+ allowing the full commit hash to be returned.
13
+
6
14
  0.2.0 (1 Oct 2021)
7
15
  ------------------
8
16
 
@@ -4,7 +4,7 @@ import datetime, os, pkg_resources
4
4
  on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
5
5
 
6
6
  intersphinx_mapping = {
7
- 'http://docs.python.org': None,
7
+ 'python': ('https://docs.python.org/3/', None),
8
8
  }
9
9
 
10
10
  extensions = [
@@ -92,13 +92,20 @@ class Git:
92
92
  def _coerce_date(dt):
93
93
  return dt if isinstance(dt, str) else dt.isoformat()
94
94
 
95
- def commit(self, msg: str, author_date: Date = None, commit_date: Date = None) -> str:
95
+ def commit(
96
+ self,
97
+ msg: str,
98
+ author_date: Date = None,
99
+ commit_date: Date = None,
100
+ short: bool = True,
101
+ ) -> str:
96
102
  """
97
103
  Commit changes in this repo, including and new or deleted files.
98
104
 
99
105
  :param msg: The commit message.
100
106
  :param author_date: The author date.
101
107
  :param commit_date: The commit date. Defaults to author date if not specified.
108
+ :param short: Return the short commit hash instead of the full 40-character hash.
102
109
  """
103
110
  self('add', '.')
104
111
  command = ['commit', '-m', msg]
@@ -108,10 +115,14 @@ class Git:
108
115
  if commit_date:
109
116
  env['GIT_COMMITTER_DATE'] = self._coerce_date(commit_date)
110
117
  self(*command, env=env)
111
- return self.rev_parse('HEAD')
112
-
113
- def rev_parse(self, label: str):
114
- return self('rev-parse', '--verify', '-q', '--short', label).strip()
118
+ return self.rev_parse('HEAD', short)
119
+
120
+ def rev_parse(self, label: str, short: bool = True) -> str:
121
+ command = ['rev-parse', '--verify', '-q']
122
+ if short:
123
+ command.append('--short')
124
+ command.append(label)
125
+ return self(*command).strip()
115
126
 
116
127
  def tag(self, name: str) -> None:
117
128
  """
@@ -26,8 +26,14 @@ class Repo(Git):
26
26
  repo.init(user or User(name='Giterator', email='giterator@example.com'))
27
27
  return repo
28
28
 
29
- def commit(self, msg: str, author_date: Date = None, commit_date: Date = None) -> str:
30
- return super().commit(msg, author_date, commit_date or author_date)
29
+ def commit(
30
+ self,
31
+ msg: str,
32
+ author_date: Date = None,
33
+ commit_date: Date = None,
34
+ short: bool = True,
35
+ ) -> str:
36
+ return super().commit(msg, author_date, commit_date or author_date, short=short)
31
37
 
32
38
  def commit_content(
33
39
  self,
@@ -36,6 +42,7 @@ class Repo(Git):
36
42
  *,
37
43
  tag: str = None,
38
44
  branch: str = None,
45
+ short: bool = True,
39
46
  ) -> str:
40
47
  """
41
48
  Write new context based on the prefix and then commit it
@@ -45,7 +52,7 @@ class Repo(Git):
45
52
  if branch:
46
53
  self.branch(branch)
47
54
  (self.path / prefix).write_text(f'{prefix} content')
48
- commit = self.commit('a commit', dt or self._clock.now())
55
+ commit = self.commit('a commit', dt or self._clock.now(), short=short)
49
56
  if tag:
50
57
  self.tag(tag)
51
58
  return commit
@@ -1,19 +1,37 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: giterator
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: Python tools for doing git things.
5
5
  Home-page: https://github.com/simplistix/giterator
6
6
  Author: Chris Withers
7
7
  Author-email: chris@withers.org
8
8
  License: MIT
9
- Platform: UNKNOWN
10
9
  Classifier: License :: OSI Approved :: MIT License
11
10
  Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.6
13
- Classifier: Programming Language :: Python :: 3.9
11
+ Requires-Python: >=3.9
12
+ License-File: LICENSE.rst
14
13
  Provides-Extra: test
14
+ Requires-Dist: coverage-enable-subprocess; extra == "test"
15
+ Requires-Dist: pytest; extra == "test"
16
+ Requires-Dist: pytest-cov; extra == "test"
17
+ Requires-Dist: sybil; extra == "test"
18
+ Requires-Dist: testfixtures; extra == "test"
15
19
  Provides-Extra: build
16
- License-File: LICENSE.rst
20
+ Requires-Dist: furo; extra == "build"
21
+ Requires-Dist: sphinx; extra == "build"
22
+ Requires-Dist: setuptools-git; extra == "build"
23
+ Requires-Dist: twine; extra == "build"
24
+ Requires-Dist: wheel; extra == "build"
25
+ Dynamic: author
26
+ Dynamic: author-email
27
+ Dynamic: classifier
28
+ Dynamic: description
29
+ Dynamic: home-page
30
+ Dynamic: license
31
+ Dynamic: license-file
32
+ Dynamic: provides-extra
33
+ Dynamic: requires-python
34
+ Dynamic: summary
17
35
 
18
36
 
19
37
  giterator
@@ -28,5 +46,3 @@ giterator
28
46
  .. _Docs: http://giterator.readthedocs.org/en/latest/
29
47
 
30
48
  Python tools for doing git things.
31
-
32
-
@@ -1,3 +1,2 @@
1
1
  [console_scripts]
2
2
  giterator = giterator.cli:main
3
-
@@ -7,6 +7,7 @@ twine
7
7
  wheel
8
8
 
9
9
  [test]
10
+ coverage-enable-subprocess
10
11
  pytest
11
12
  pytest-cov
12
13
  sybil
@@ -9,7 +9,7 @@ base_dir = os.path.dirname(__file__)
9
9
 
10
10
  setup(
11
11
  name='giterator',
12
- version='0.2.0',
12
+ version='0.3.0',
13
13
  author='Chris Withers',
14
14
  author_email='chris@withers.org',
15
15
  license='MIT',
@@ -21,14 +21,14 @@ setup(
21
21
  classifiers=[
22
22
  'License :: OSI Approved :: MIT License',
23
23
  'Programming Language :: Python :: 3',
24
- 'Programming Language :: Python :: 3.6',
25
- 'Programming Language :: Python :: 3.9',
26
24
  ],
27
25
  packages=find_packages(exclude=["tests"]),
28
26
  zip_safe=False,
29
27
  include_package_data=True,
28
+ python_requires=">=3.9",
30
29
  extras_require=dict(
31
30
  test=[
31
+ 'coverage-enable-subprocess',
32
32
  'pytest',
33
33
  'pytest-cov',
34
34
  'sybil',
@@ -1,3 +1,4 @@
1
+ import os
1
2
  from pathlib import Path
2
3
 
3
4
  import pytest
@@ -7,6 +8,10 @@ from giterator import Git, User
7
8
  from giterator.testing import Repo
8
9
 
9
10
 
11
+ # Enable coverage for subprocesses (CLI tests)
12
+ os.environ.setdefault('COVERAGE_PROCESS_START', str(Path(__file__).parent.parent / '.coveragerc'))
13
+
14
+
10
15
  @pytest.fixture()
11
16
  def tmpdir():
12
17
  with TempDirectory() as _dir:
@@ -134,14 +134,14 @@ class TestCommit:
134
134
  (git.path / 'a').write_text('content')
135
135
  dt = datetime(2001, 1, 1, 10)
136
136
  git.commit('a commit', dt, dt)
137
- compare(git('log', '--format=%aI %cI'),
137
+ compare(git('log', '--format=%aI %cI').replace("Z", "+00:00"),
138
138
  expected='2001-01-01T10:00:00+00:00 2001-01-01T10:00:00+00:00\n')
139
139
 
140
140
  def test_with_tz_datetime(self, git: Git):
141
141
  (git.path / 'a').write_text('content')
142
142
  dt = datetime(2001, 1, 1, 10).astimezone(timezone.utc)
143
143
  git.commit('a commit', dt, dt)
144
- compare(git('log', '--format=%aI %cI'),
144
+ compare(git('log', '--format=%aI %cI').replace("Z", "+00:00"),
145
145
  expected='2001-01-01T10:00:00+00:00 2001-01-01T10:00:00+00:00\n')
146
146
 
147
147
 
@@ -151,6 +151,11 @@ class TestLabels:
151
151
  repo.commit_content('a', datetime(2001, 1, 1, 10))
152
152
  compare(repo.rev_parse('HEAD'), expected='5ee580a')
153
153
 
154
+ def test_rev_parse_full(self, repo: Repo):
155
+ repo.commit_content('a', datetime(2001, 1, 1, 10))
156
+ compare(repo.rev_parse('HEAD', short=False),
157
+ expected='5ee580aba98816af22cfa4e76ddf96bb3994964b')
158
+
154
159
  def test_tags_empty(self, repo: Repo):
155
160
  compare(repo.tags(), expected=[])
156
161
 
@@ -32,7 +32,7 @@ class TestRepo:
32
32
  upstream = Repo.make(root / 'upstream')
33
33
  upstream.commit_content('a')
34
34
  clone = Repo.clone(upstream, root / 'clone')
35
- tmpdir.check('clone', 'upstream')
35
+ tmpdir.compare(('clone', 'upstream'), recursive=False)
36
36
  config = (clone.path / '.git' / 'config').read_text()
37
37
  assert 'name = Giterator' in config
38
38
  assert 'email = giterator@example.com' in config
@@ -40,7 +40,7 @@ class TestRepo:
40
40
  def test_with_user(self, repo: Repo, tmpdir: TempDirectory):
41
41
  repo.commit_content('a')
42
42
  clone = Repo.clone(repo, 'clone', User('Foo', 'bar@example.com'))
43
- tmpdir.check('clone', 'repo')
43
+ tmpdir.compare(('clone', 'repo'), recursive=False)
44
44
  config = (clone.path / '.git' / 'config').read_text()
45
45
  assert 'name = Foo' in config
46
46
  assert 'email = bar@example.com' in config
@@ -56,3 +56,10 @@ class TestRepo:
56
56
  ' a | 1 +\n'
57
57
  ' 1 file changed, 1 insertion(+)\n'
58
58
  ))
59
+
60
+ def test_commit_content(self, repo: Repo):
61
+ compare(repo.commit_content('a', datetime(2001, 1, 1, 10)), expected='5ee580a')
62
+
63
+ def test_commit_content_full(self, repo: Repo):
64
+ compare(repo.commit_content('a', datetime(2001, 1, 1, 10), short=False),
65
+ expected='5ee580aba98816af22cfa4e76ddf96bb3994964b')
@@ -1,8 +0,0 @@
1
- version: 2
2
- python:
3
- version: 3.8
4
- install:
5
- - method: pip
6
- path: .
7
- extra_requirements:
8
- - build
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