gitbolt 0.0.0.dev10__tar.gz → 0.0.0.dev11__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 (36) hide show
  1. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/PKG-INFO +22 -3
  2. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/README.md +19 -0
  3. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/pyproject.toml +4 -4
  4. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt/git_subprocess/impl/simple.py +84 -8
  5. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt.egg-info/PKG-INFO +22 -3
  6. gitbolt-0.0.0.dev11/src/gitbolt.egg-info/requires.txt +8 -0
  7. gitbolt-0.0.0.dev10/src/gitbolt.egg-info/requires.txt +0 -8
  8. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/LICENSE +0 -0
  9. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/setup.cfg +0 -0
  10. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt/__init__.py +0 -0
  11. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt/_internal_init.py +0 -0
  12. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt/add.py +0 -0
  13. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt/base.py +0 -0
  14. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt/constants.py +0 -0
  15. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt/exceptions.py +0 -0
  16. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt/git_subprocess/__init__.py +0 -0
  17. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt/git_subprocess/_internal_init.py +0 -0
  18. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt/git_subprocess/add.py +0 -0
  19. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt/git_subprocess/base.py +0 -0
  20. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt/git_subprocess/constants.py +0 -0
  21. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt/git_subprocess/exceptions.py +0 -0
  22. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt/git_subprocess/impl/__init__.py +0 -0
  23. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt/git_subprocess/ls_tree.py +0 -0
  24. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt/git_subprocess/runner/__init__.py +0 -0
  25. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt/git_subprocess/runner/base.py +0 -0
  26. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt/git_subprocess/runner/simple_impl.py +0 -0
  27. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt/git_subprocess/utils.py +0 -0
  28. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt/ls_tree.py +0 -0
  29. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt/models.py +0 -0
  30. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt/py.typed +0 -0
  31. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt/pytest_plugin.py +0 -0
  32. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt/utils.py +0 -0
  33. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt.egg-info/SOURCES.txt +0 -0
  34. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt.egg-info/dependency_links.txt +0 -0
  35. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt.egg-info/entry_points.txt +0 -0
  36. {gitbolt-0.0.0.dev10 → gitbolt-0.0.0.dev11}/src/gitbolt.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitbolt
3
- Version: 0.0.0.dev10
3
+ Version: 0.0.0.dev11
4
4
  Summary: Fast, flexible and type-safe Git commands in Python.
5
5
  Author-email: Suhas Krishna Srivastava <suhas.srivastava@vaastav.tech>
6
6
  Maintainer-email: Suhas Krishna Srivastava <suhas.srivastava@vaastav.tech>
@@ -26,8 +26,8 @@ Classifier: Typing :: Typed
26
26
  Requires-Python: >=3.12
27
27
  Description-Content-Type: text/markdown
28
28
  License-File: LICENSE
29
- Requires-Dist: vt-err-hndlr>=0.0.0dev3
30
- Requires-Dist: vt-commons>=0.0.1.dev4
29
+ Requires-Dist: vt-err-hndlr>=0.0.0dev5
30
+ Requires-Dist: vt-commons>=0.0.1.dev9
31
31
  Provides-Extra: pygit2
32
32
  Requires-Dist: pygit2; extra == "pygit2"
33
33
  Provides-Extra: test
@@ -64,6 +64,7 @@ Dynamic: license-file
64
64
  * 🧪 **Terminal Functions:** Git subcommands are terminal functions.
65
65
  * 🧼 **Idiomatic Python:** Write commands in idiomatic Python at compile-time and be confident they’ll execute smoothly at runtime.
66
66
  * 🎀 **Add-ons:** Special features provided to ease programming with git. These can be added if required.
67
+ * 💻 **CLI-cmd:** Take commands from cli and run in `gitbolt`.
67
68
 
68
69
  ---
69
70
 
@@ -340,6 +341,24 @@ git.subcmd_unchecked.run(['--version']) # run the version option for git.
340
341
  git.subcmd_unchecked.run(['version']) # run the version subcommand.
341
342
  ```
342
343
 
344
+ #### 💻 Run commands received from CLI
345
+
346
+ Introduced in `0.0.0dev11` is the ability to take commands from CLI and run it inside `gitbolt`.
347
+
348
+ While making a system it may be required to run cli commands as received from cli using gitbolt. An obvious example
349
+ would be to make a system that receives CLI commands and does certain modifications/additions inside `gitbolt` before
350
+ actually running them. An example:
351
+
352
+ ```python
353
+ from gitbolt.git_subprocess.impl.simple import CLISimpleGitCommand
354
+
355
+ opts = ["--no-pager", "--namespace", "n1"] # options received from outside your program.
356
+ envs = dict(GIT_AUTHOR_NAME="ss") # env-vars received form outside your program.
357
+ git = CLISimpleGitCommand(opts=opts, envs=envs)
358
+
359
+ # these can later be overridden
360
+ git = git.git_opts_override(namespace="n2")
361
+ ```
343
362
 
344
363
  ---
345
364
 
@@ -28,6 +28,7 @@
28
28
  * 🧪 **Terminal Functions:** Git subcommands are terminal functions.
29
29
  * 🧼 **Idiomatic Python:** Write commands in idiomatic Python at compile-time and be confident they’ll execute smoothly at runtime.
30
30
  * 🎀 **Add-ons:** Special features provided to ease programming with git. These can be added if required.
31
+ * 💻 **CLI-cmd:** Take commands from cli and run in `gitbolt`.
31
32
 
32
33
  ---
33
34
 
@@ -304,6 +305,24 @@ git.subcmd_unchecked.run(['--version']) # run the version option for git.
304
305
  git.subcmd_unchecked.run(['version']) # run the version subcommand.
305
306
  ```
306
307
 
308
+ #### 💻 Run commands received from CLI
309
+
310
+ Introduced in `0.0.0dev11` is the ability to take commands from CLI and run it inside `gitbolt`.
311
+
312
+ While making a system it may be required to run cli commands as received from cli using gitbolt. An obvious example
313
+ would be to make a system that receives CLI commands and does certain modifications/additions inside `gitbolt` before
314
+ actually running them. An example:
315
+
316
+ ```python
317
+ from gitbolt.git_subprocess.impl.simple import CLISimpleGitCommand
318
+
319
+ opts = ["--no-pager", "--namespace", "n1"] # options received from outside your program.
320
+ envs = dict(GIT_AUTHOR_NAME="ss") # env-vars received form outside your program.
321
+ git = CLISimpleGitCommand(opts=opts, envs=envs)
322
+
323
+ # these can later be overridden
324
+ git = git.git_opts_override(namespace="n2")
325
+ ```
307
326
 
308
327
  ---
309
328
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "gitbolt"
3
- version = "0.0.0dev10"
3
+ version = "0.0.0dev11"
4
4
  description = "Fast, flexible and type-safe Git commands in Python."
5
5
  requires-python = ">=3.12"
6
6
  readme = "README.md"
@@ -36,8 +36,8 @@ classifiers = [
36
36
  "Typing :: Typed"
37
37
  ]
38
38
  dependencies = [
39
- "vt-err-hndlr >= 0.0.0dev3",
40
- "vt-commons >= 0.0.1.dev4",
39
+ "vt-err-hndlr >= 0.0.0dev5",
40
+ "vt-commons >= 0.0.1.dev9",
41
41
  ]
42
42
 
43
43
  [project.optional-dependencies]
@@ -49,7 +49,7 @@ test = ['pytest']
49
49
  # btw, this error doesn't show in the latest developer version. So, this error will go away with 1.17.0 relase
50
50
  dev = ["mypy==1.15.0", "ruff"]
51
51
  doc = ['sphinx', 'sphinx-argparse']
52
- test = ["pytest", 'pytest-cov']
52
+ test = ["pytest", 'pytest-cov', "pytest-xdist"]
53
53
  multitest = ['tox']
54
54
 
55
55
 
@@ -196,9 +196,21 @@ class SimpleGitCommand(GitCommand, RootDirOp):
196
196
  return add_subcmd
197
197
 
198
198
  @override
199
- def clone(self) -> "SimpleGitCommand":
199
+ def clone(self) -> SimpleGitCommand:
200
200
  # region obtain class instance
201
- cloned = SimpleGitCommand(
201
+ cloned = self._subclass_clone()
202
+ # endregion
203
+ # region clone protected members
204
+ cloned._main_cmd_opts = self._main_cmd_opts
205
+ cloned._env_vars = self._env_vars
206
+ # endregion
207
+ return cloned
208
+
209
+ def _subclass_clone(self) -> SimpleGitCommand:
210
+ """
211
+ :returns: clone as defined by the subclass.
212
+ """
213
+ return SimpleGitCommand(
202
214
  self.root_dir,
203
215
  self.runner,
204
216
  version_subcmd=self.version_subcmd,
@@ -206,12 +218,6 @@ class SimpleGitCommand(GitCommand, RootDirOp):
206
218
  add_subcmd=self.add_subcmd,
207
219
  subcmd_unchecked=self.subcmd_unchecked,
208
220
  )
209
- # endregion
210
- # region clone protected members
211
- cloned._main_cmd_opts = self._main_cmd_opts
212
- cloned._env_vars = self._env_vars
213
- # endregion
214
- return cloned
215
221
 
216
222
  @override
217
223
  @property
@@ -223,3 +229,73 @@ class SimpleGitCommand(GitCommand, RootDirOp):
223
229
  subcmd_unchecked = self._subcmd_unchecked.clone()
224
230
  subcmd_unchecked._set_underlying_git(self)
225
231
  return subcmd_unchecked
232
+
233
+
234
+ class CLISimpleGitCommand(SimpleGitCommand):
235
+ """
236
+ A simple git command that can run using CLI params.
237
+ """
238
+
239
+ def __init__(
240
+ self,
241
+ git_root_dir: Path = Path.cwd(),
242
+ runner: GitCommandRunner = SimpleGitCR(),
243
+ *,
244
+ opts: list[str] | None = None,
245
+ envs: dict[str, str] | None = None,
246
+ prefer_cli: bool = False,
247
+ version_subcmd: VersionCommand | None = None,
248
+ ls_tree_subcmd: LsTreeCommand | None = None,
249
+ add_subcmd: AddCommand | None = None,
250
+ subcmd_unchecked: UncheckedSubcmd | None = None,
251
+ ):
252
+ """
253
+ :param opts: main git cli options.
254
+ :param envs: main git cli env vars.
255
+ :param prefer_cli: cli opts and envs will be given priority over programmatically set opts and envs. Setting
256
+ this param to ``True`` will make cli opts and envs appear later in the opts and envs strings which will
257
+ make them override previously programmatically set opts and envs.
258
+ """
259
+ super().__init__(
260
+ git_root_dir,
261
+ runner,
262
+ version_subcmd=version_subcmd,
263
+ ls_tree_subcmd=ls_tree_subcmd,
264
+ add_subcmd=add_subcmd,
265
+ subcmd_unchecked=subcmd_unchecked,
266
+ )
267
+ self._main_cmd_cli_opts = opts
268
+ self._cmd_cli_envs = envs
269
+ self.prefer_cli = prefer_cli
270
+
271
+ @override
272
+ def build_main_cmd_args(self) -> list[str]:
273
+ if self._main_cmd_cli_opts:
274
+ if self.prefer_cli:
275
+ return super().build_main_cmd_args() + self._main_cmd_cli_opts
276
+ else:
277
+ return self._main_cmd_cli_opts + super().build_main_cmd_args()
278
+ return super().build_main_cmd_args()
279
+
280
+ @override
281
+ def build_git_envs(self) -> dict[str, str]:
282
+ if self._cmd_cli_envs:
283
+ if self.prefer_cli:
284
+ return super().build_git_envs() | self._cmd_cli_envs
285
+ else:
286
+ return self._cmd_cli_envs | super().build_git_envs()
287
+ return super().build_git_envs()
288
+
289
+ @override
290
+ def _subclass_clone(self) -> CLISimpleGitCommand:
291
+ return CLISimpleGitCommand(
292
+ self.root_dir,
293
+ self.runner,
294
+ opts=self._main_cmd_cli_opts,
295
+ envs=self._cmd_cli_envs,
296
+ prefer_cli=self.prefer_cli,
297
+ version_subcmd=self.version_subcmd,
298
+ ls_tree_subcmd=self.ls_tree_subcmd,
299
+ add_subcmd=self.add_subcmd,
300
+ subcmd_unchecked=self.subcmd_unchecked,
301
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitbolt
3
- Version: 0.0.0.dev10
3
+ Version: 0.0.0.dev11
4
4
  Summary: Fast, flexible and type-safe Git commands in Python.
5
5
  Author-email: Suhas Krishna Srivastava <suhas.srivastava@vaastav.tech>
6
6
  Maintainer-email: Suhas Krishna Srivastava <suhas.srivastava@vaastav.tech>
@@ -26,8 +26,8 @@ Classifier: Typing :: Typed
26
26
  Requires-Python: >=3.12
27
27
  Description-Content-Type: text/markdown
28
28
  License-File: LICENSE
29
- Requires-Dist: vt-err-hndlr>=0.0.0dev3
30
- Requires-Dist: vt-commons>=0.0.1.dev4
29
+ Requires-Dist: vt-err-hndlr>=0.0.0dev5
30
+ Requires-Dist: vt-commons>=0.0.1.dev9
31
31
  Provides-Extra: pygit2
32
32
  Requires-Dist: pygit2; extra == "pygit2"
33
33
  Provides-Extra: test
@@ -64,6 +64,7 @@ Dynamic: license-file
64
64
  * 🧪 **Terminal Functions:** Git subcommands are terminal functions.
65
65
  * 🧼 **Idiomatic Python:** Write commands in idiomatic Python at compile-time and be confident they’ll execute smoothly at runtime.
66
66
  * 🎀 **Add-ons:** Special features provided to ease programming with git. These can be added if required.
67
+ * 💻 **CLI-cmd:** Take commands from cli and run in `gitbolt`.
67
68
 
68
69
  ---
69
70
 
@@ -340,6 +341,24 @@ git.subcmd_unchecked.run(['--version']) # run the version option for git.
340
341
  git.subcmd_unchecked.run(['version']) # run the version subcommand.
341
342
  ```
342
343
 
344
+ #### 💻 Run commands received from CLI
345
+
346
+ Introduced in `0.0.0dev11` is the ability to take commands from CLI and run it inside `gitbolt`.
347
+
348
+ While making a system it may be required to run cli commands as received from cli using gitbolt. An obvious example
349
+ would be to make a system that receives CLI commands and does certain modifications/additions inside `gitbolt` before
350
+ actually running them. An example:
351
+
352
+ ```python
353
+ from gitbolt.git_subprocess.impl.simple import CLISimpleGitCommand
354
+
355
+ opts = ["--no-pager", "--namespace", "n1"] # options received from outside your program.
356
+ envs = dict(GIT_AUTHOR_NAME="ss") # env-vars received form outside your program.
357
+ git = CLISimpleGitCommand(opts=opts, envs=envs)
358
+
359
+ # these can later be overridden
360
+ git = git.git_opts_override(namespace="n2")
361
+ ```
343
362
 
344
363
  ---
345
364
 
@@ -0,0 +1,8 @@
1
+ vt-err-hndlr>=0.0.0dev5
2
+ vt-commons>=0.0.1.dev9
3
+
4
+ [pygit2]
5
+ pygit2
6
+
7
+ [test]
8
+ pytest
@@ -1,8 +0,0 @@
1
- vt-err-hndlr>=0.0.0dev3
2
- vt-commons>=0.0.1.dev4
3
-
4
- [pygit2]
5
- pygit2
6
-
7
- [test]
8
- pytest
File without changes
File without changes