fastgit 0.1.4__tar.gz → 0.1.5__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.
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastgit
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Summary: Use git from python, fast
5
5
  Author-email: Jeremy Howard <github@jhoward.fastmail.fm>
6
- License: Apache-2.0
6
+ License-Expression: Apache-2.0
7
7
  Project-URL: Repository, https://github.com/AnswerDotAI/fastgit
8
8
  Project-URL: Documentation, https://AnswerDotAI.github.io/fastgit
9
9
  Keywords: nbdev,jupyter,notebook,python
@@ -4,6 +4,6 @@
4
4
 
5
5
  Commands run through the installed `git` executable and return its text output. There is no separate object model for repositories and commits. Both synchronous and asynchronous clients are available."""
6
6
 
7
- __version__ = "0.1.4"
7
+ __version__ = "0.1.5"
8
8
 
9
9
  from .core import *
@@ -20,6 +20,7 @@ d = { 'settings': { 'branch': 'main',
20
20
  'fastgit.core.Git.top': ('core.html#git.top', 'fastgit/core.py'),
21
21
  'fastgit.core.GitRes': ('core.html#gitres', 'fastgit/core.py'),
22
22
  'fastgit.core.GitRes.__new__': ('core.html#gitres.__new__', 'fastgit/core.py'),
23
+ 'fastgit.core.GitRes.__repr__': ('core.html#gitres.__repr__', 'fastgit/core.py'),
23
24
  'fastgit.core._arunlocal': ('core.html#_arunlocal', 'fastgit/core.py'),
24
25
  'fastgit.core._depr_uname': ('core.html#_depr_uname', 'fastgit/core.py'),
25
26
  'fastgit.core._gitcmd': ('core.html#_gitcmd', 'fastgit/core.py'),
@@ -18,12 +18,14 @@ from functools import cache
18
18
  _ok1 = {'merge-tree','merge-base','grep','check-ignore','diff','diff-index','diff-files','diff-tree','show-ref','config','rev-parse'}
19
19
 
20
20
  class GitRes(str):
21
- "Git output `str`, carrying the command's `returncode`"
22
- def __new__(cls, s, returncode=0):
23
- self = super().__new__(cls, s)
24
- self.returncode = returncode
21
+ "Git output text for display, with raw `stdout`, `stderr` and `returncode`"
22
+ def __new__(cls, stdout, stderr, returncode=0):
23
+ self = super().__new__(cls, (stdout + stderr).strip())
24
+ self.stdout,self.stderr,self.returncode = stdout,stderr,returncode
25
25
  return self
26
26
 
27
+ def __repr__(self): return str(self)
28
+
27
29
  # %% ../nbs/00_core.ipynb #e4c0a290
28
30
  def _gitcmd(path, *args, pre=None):
29
31
  cmd = ['git', '-C', str(Path(path).expanduser().resolve())] + list(args)
@@ -38,7 +40,7 @@ def _depr_uname(uname, pre):
38
40
  def _gitres(args, out, err, returncode, ok_exit):
39
41
  if ok_exit is None: ok_exit = 1 if args and args[0] in _ok1 else 0
40
42
  if returncode not in (0, *listify(ok_exit)): raise CalledProcessError(returncode, ['git', *args], out, err)
41
- return GitRes((out + err).strip(), returncode)
43
+ return GitRes(out, err, returncode)
42
44
 
43
45
  def _runlocal(path, args, pre=None):
44
46
  "Default runner: compose the local argv and run it in a subprocess"
@@ -53,7 +55,7 @@ def callgit(
53
55
  ok_exit=None, # Extra accepted exit codes (default: 1 for `_ok1` commands)
54
56
  runner=None, # Replaces the local subprocess: `(path, args, pre) -> (stdout, stderr, returncode)`
55
57
  ):
56
- "Run git in `path`, returning stripped stdout+stderr as a `GitRes`"
58
+ "Run git in `path`; its `GitRes` displays stripped output and retains raw stdout/stderr"
57
59
  out,err,rc = (runner or _runlocal)(path, list(args), pre=_depr_uname(uname, pre))
58
60
  return _gitres(args, out, err, rc, ok_exit)
59
61
 
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastgit
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Summary: Use git from python, fast
5
5
  Author-email: Jeremy Howard <github@jhoward.fastmail.fm>
6
- License: Apache-2.0
6
+ License-Expression: Apache-2.0
7
7
  Project-URL: Repository, https://github.com/AnswerDotAI/fastgit
8
8
  Project-URL: Documentation, https://AnswerDotAI.github.io/fastgit
9
9
  Keywords: nbdev,jupyter,notebook,python
@@ -1,5 +1,5 @@
1
1
  [build-system]
2
- requires = ["setuptools>=64"]
2
+ requires = ["setuptools>=77"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
@@ -8,7 +8,7 @@ dynamic = ["version"]
8
8
  description = "Use git from python, fast"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
11
- license = {text = "Apache-2.0"}
11
+ license = "Apache-2.0"
12
12
  authors = [{name = "Jeremy Howard", email = "github@jhoward.fastmail.fm"}]
13
13
  keywords = ['nbdev', 'jupyter', 'notebook', 'python']
14
14
  classifiers = ["Natural Language :: English", "Intended Audience :: Developers", "Development Status :: 3 - Alpha", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only"]
File without changes
File without changes
File without changes