dev-shell 0.10.2__tar.gz → 0.11.1__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 (39) hide show
  1. {dev_shell-0.10.2 → dev_shell-0.11.1}/.gitignore +10 -7
  2. {dev_shell-0.10.2 → dev_shell-0.11.1}/.pre-commit-config.yaml +1 -1
  3. {dev_shell-0.10.2 → dev_shell-0.11.1}/PKG-INFO +21 -8
  4. {dev_shell-0.10.2 → dev_shell-0.11.1}/README.md +20 -7
  5. {dev_shell-0.10.2 → dev_shell-0.11.1}/dev_shell/__init__.py +1 -1
  6. {dev_shell-0.10.2 → dev_shell-0.11.1}/dev_shell/base_cmd2_app.py +1 -1
  7. {dev_shell-0.10.2 → dev_shell-0.11.1}/dev_shell/bootstrap-source.py +5 -2
  8. dev_shell-0.11.1/dev_shell/command_sets/__init__.py +43 -0
  9. {dev_shell-0.10.2 → dev_shell-0.11.1}/dev_shell/command_sets/dev_shell_commands.py +0 -1
  10. {dev_shell-0.10.2 → dev_shell-0.11.1}/dev_shell/dev_shell_app.py +8 -8
  11. {dev_shell-0.10.2 → dev_shell-0.11.1}/dev_shell/tests/__init__.py +2 -2
  12. {dev_shell-0.10.2 → dev_shell-0.11.1}/dev_shell/tests/test_readme.py +10 -2
  13. {dev_shell-0.10.2 → dev_shell-0.11.1}/dev_shell/utils/subprocess_utils.py +20 -1
  14. {dev_shell-0.10.2 → dev_shell-0.11.1}/devshell.py +5 -2
  15. {dev_shell-0.10.2 → dev_shell-0.11.1}/noxfile.py +1 -0
  16. {dev_shell-0.10.2 → dev_shell-0.11.1}/pyproject.toml +1 -0
  17. dev_shell-0.10.2/dev_shell/command_sets/__init__.py +0 -10
  18. dev_shell-0.10.2/uv.lock +0 -1634
  19. {dev_shell-0.10.2 → dev_shell-0.11.1}/.editorconfig +0 -0
  20. {dev_shell-0.10.2 → dev_shell-0.11.1}/.github/workflows/tests.yml +0 -0
  21. {dev_shell-0.10.2 → dev_shell-0.11.1}/.idea/.gitignore +0 -0
  22. {dev_shell-0.10.2 → dev_shell-0.11.1}/.pre-commit-hooks.yaml +0 -0
  23. {dev_shell-0.10.2 → dev_shell-0.11.1}/.run/Template Python tests.run.xml +0 -0
  24. {dev_shell-0.10.2 → dev_shell-0.11.1}/.run/Unittests __all__.run.xml +0 -0
  25. {dev_shell-0.10.2 → dev_shell-0.11.1}/LICENSE +0 -0
  26. {dev_shell-0.10.2 → dev_shell-0.11.1}/dev_shell/__main__.py +0 -0
  27. {dev_shell-0.10.2 → dev_shell-0.11.1}/dev_shell/config.py +0 -0
  28. {dev_shell-0.10.2 → dev_shell-0.11.1}/dev_shell/constants.py +0 -0
  29. {dev_shell-0.10.2 → dev_shell-0.11.1}/dev_shell/tests/constants.py +0 -0
  30. {dev_shell-0.10.2 → dev_shell-0.11.1}/dev_shell/tests/fixtures.py +0 -0
  31. {dev_shell-0.10.2 → dev_shell-0.11.1}/dev_shell/tests/test_bootstrap.py +0 -0
  32. {dev_shell-0.10.2 → dev_shell-0.11.1}/dev_shell/tests/test_dev_shell_app.py +0 -0
  33. {dev_shell-0.10.2 → dev_shell-0.11.1}/dev_shell/tests/test_doctests.py +0 -0
  34. {dev_shell-0.10.2 → dev_shell-0.11.1}/dev_shell/tests/test_project_setup.py +0 -0
  35. {dev_shell-0.10.2 → dev_shell-0.11.1}/dev_shell/tests/test_readme_history.py +0 -0
  36. {dev_shell-0.10.2 → dev_shell-0.11.1}/dev_shell/tests/test_source_file.py +0 -0
  37. {dev_shell-0.10.2 → dev_shell-0.11.1}/dev_shell/utils/__init__.py +0 -0
  38. {dev_shell-0.10.2 → dev_shell-0.11.1}/dev_shell/utils/colorful.py +0 -0
  39. {dev_shell-0.10.2 → dev_shell-0.11.1}/dist/.gitignore +0 -0
@@ -1,11 +1,4 @@
1
1
  .*
2
- *.egg-info
3
- __pycache__
4
- /dist/
5
- /build/
6
- /coverage.*
7
- *.orig
8
-
9
2
  !.github
10
3
  !.run
11
4
  !.editorconfig
@@ -13,3 +6,13 @@ __pycache__
13
6
  !.pre-commit-config.yaml
14
7
  !.pre-commit-hooks.yaml
15
8
  !.gitkeep
9
+
10
+ *.egg-info
11
+ __pycache__
12
+ /dist/
13
+ /build/
14
+ /coverage.*
15
+ *.orig
16
+
17
+ # This is a library, not an application — consumers manage their own lock file
18
+ uv.lock
@@ -2,6 +2,6 @@
2
2
  # See https://pre-commit.com for more information
3
3
  repos:
4
4
  - repo: https://github.com/jedie/cli-base-utilities
5
- rev: v0.28.0
5
+ rev: v0.30.0
6
6
  hooks:
7
7
  - id: update-readme-history
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dev-shell
3
- Version: 0.10.2
3
+ Version: 0.11.1
4
4
  Summary: Developer shell for easy startup...
5
5
  Project-URL: Documentation, https://github.com/jedie/dev-shell
6
6
  Project-URL: Source, https://github.com/jedie/dev-shell
@@ -57,14 +57,14 @@ The output looks like:
57
57
 
58
58
  [comment]: <> (✂✂✂ auto generated main help start ✂✂✂)
59
59
  ```
60
+ Cmd2 Commands
61
+ ─────────────
62
+ alias help history macro quit set shortcuts
63
+
60
64
  dev-shell commands
61
65
  ──────────────────
62
66
  coverage install publish test version
63
67
  fix_code_style list_venv_packages pyupgrade update
64
-
65
- Uncategorized Commands
66
- ──────────────────────
67
- alias help history macro quit set shortcuts
68
68
  ```
69
69
  [comment]: <> (✂✂✂ auto generated main help end ✂✂✂)
70
70
 
@@ -88,19 +88,32 @@ See also:
88
88
 
89
89
  [comment]: <> (✂✂✂ auto generated history start ✂✂✂)
90
90
 
91
+ * [v0.11.1](https://github.com/jedie/dev-shell/compare/v0.11.0...v0.11.1)
92
+ * 2026-06-11 - fix _print_info() if Path instance pass as arguments
93
+ * [v0.11.0](https://github.com/jedie/dev-shell/compare/v0.10.2...v0.11.0)
94
+ * 2026-06-11 - Remove uv.lock from this repo: It's a library not a project
95
+ * 2026-06-11 - nox: reuse venv
96
+ * 2026-06-11 - NEW: CategorizedCommandSet replacement for @cmd2.with_default_category()
97
+ * 2026-06-11 - fix linting
98
+ * 2026-06-11 - Update requirements
99
+ * 2026-05-29 - Bump uv from 0.11.6 to 0.11.15
100
+ * 2026-04-10 - Bump uv from 0.10.4 to 0.11.6
101
+ * 2026-04-08 - Bump cryptography from 46.0.6 to 46.0.7
102
+ * 2026-03-30 - Bump pygments from 2.19.2 to 2.20.0
103
+ * 2026-03-29 - Bump cryptography from 46.0.5 to 46.0.6
91
104
  * [v0.10.2](https://github.com/jedie/dev-shell/compare/v0.10.1...v0.10.2)
92
105
  * 2026-02-19 - apply manageprojects updates
93
106
  * 2026-02-19 - Bugfix colorful helpers if a Path instance should be printed.
94
107
  * [v0.10.1](https://github.com/jedie/dev-shell/compare/v0.10.0...v0.10.1)
95
108
  * 2026-02-10 - Bugfix text color styles
109
+
110
+ <details><summary>Expand older history entries ...</summary>
111
+
96
112
  * [v0.10.0](https://github.com/jedie/dev-shell/compare/v0.9.1...v0.10.0)
97
113
  * 2026-02-10 - Cleanup
98
114
  * 2026-02-09 - Update project
99
115
  * [v0.9.1](https://github.com/jedie/dev-shell/compare/v0.9.0...v0.9.1)
100
116
  * 2025-03-11 - Fix usage as package in external projects
101
-
102
- <details><summary>Expand older history entries ...</summary>
103
-
104
117
  * [v0.9.0](https://github.com/jedie/dev-shell/compare/v0.8.0...v0.9.0)
105
118
  * 2025-03-11 - fix publish
106
119
  * 2025-03-11 - Replace `poetry` with `uv`
@@ -40,14 +40,14 @@ The output looks like:
40
40
 
41
41
  [comment]: <> (✂✂✂ auto generated main help start ✂✂✂)
42
42
  ```
43
+ Cmd2 Commands
44
+ ─────────────
45
+ alias help history macro quit set shortcuts
46
+
43
47
  dev-shell commands
44
48
  ──────────────────
45
49
  coverage install publish test version
46
50
  fix_code_style list_venv_packages pyupgrade update
47
-
48
- Uncategorized Commands
49
- ──────────────────────
50
- alias help history macro quit set shortcuts
51
51
  ```
52
52
  [comment]: <> (✂✂✂ auto generated main help end ✂✂✂)
53
53
 
@@ -71,19 +71,32 @@ See also:
71
71
 
72
72
  [comment]: <> (✂✂✂ auto generated history start ✂✂✂)
73
73
 
74
+ * [v0.11.1](https://github.com/jedie/dev-shell/compare/v0.11.0...v0.11.1)
75
+ * 2026-06-11 - fix _print_info() if Path instance pass as arguments
76
+ * [v0.11.0](https://github.com/jedie/dev-shell/compare/v0.10.2...v0.11.0)
77
+ * 2026-06-11 - Remove uv.lock from this repo: It's a library not a project
78
+ * 2026-06-11 - nox: reuse venv
79
+ * 2026-06-11 - NEW: CategorizedCommandSet replacement for @cmd2.with_default_category()
80
+ * 2026-06-11 - fix linting
81
+ * 2026-06-11 - Update requirements
82
+ * 2026-05-29 - Bump uv from 0.11.6 to 0.11.15
83
+ * 2026-04-10 - Bump uv from 0.10.4 to 0.11.6
84
+ * 2026-04-08 - Bump cryptography from 46.0.6 to 46.0.7
85
+ * 2026-03-30 - Bump pygments from 2.19.2 to 2.20.0
86
+ * 2026-03-29 - Bump cryptography from 46.0.5 to 46.0.6
74
87
  * [v0.10.2](https://github.com/jedie/dev-shell/compare/v0.10.1...v0.10.2)
75
88
  * 2026-02-19 - apply manageprojects updates
76
89
  * 2026-02-19 - Bugfix colorful helpers if a Path instance should be printed.
77
90
  * [v0.10.1](https://github.com/jedie/dev-shell/compare/v0.10.0...v0.10.1)
78
91
  * 2026-02-10 - Bugfix text color styles
92
+
93
+ <details><summary>Expand older history entries ...</summary>
94
+
79
95
  * [v0.10.0](https://github.com/jedie/dev-shell/compare/v0.9.1...v0.10.0)
80
96
  * 2026-02-10 - Cleanup
81
97
  * 2026-02-09 - Update project
82
98
  * [v0.9.1](https://github.com/jedie/dev-shell/compare/v0.9.0...v0.9.1)
83
99
  * 2025-03-11 - Fix usage as package in external projects
84
-
85
- <details><summary>Expand older history entries ...</summary>
86
-
87
100
  * [v0.9.0](https://github.com/jedie/dev-shell/compare/v0.8.0...v0.9.0)
88
101
  * 2025-03-11 - fix publish
89
102
  * 2025-03-11 - Replace `poetry` with `uv`
@@ -4,5 +4,5 @@ Developer shell for easy startup...
4
4
  """
5
5
 
6
6
  # See https://packaging.python.org/en/latest/specifications/version-specifiers/
7
- __version__ = '0.10.2'
7
+ __version__ = '0.11.1'
8
8
  __author__ = 'Jens Diemer <dev-shell@jensdiemer.de>'
@@ -21,7 +21,7 @@ class DevShellBaseApp(cmd2.Cmd):
21
21
  delattr(cmd2.Cmd, 'do_run_pyscript')
22
22
 
23
23
  def __init__(self, *args, config: DevShellConfig, **kwargs):
24
- kwargs.update(dict(persistent_history_file='.history', allow_cli_args=False))
24
+ kwargs.update({'persistent_history_file': '.history', 'allow_cli_args': False})
25
25
  super().__init__(*args, **kwargs)
26
26
 
27
27
  self.config = config
@@ -70,9 +70,12 @@ def main(argv):
70
70
  if not uv_bin:
71
71
  print_uv_error_and_exit()
72
72
 
73
- if not Path(VIRTUAL_ENV).is_dir():
74
- verbose_check_call(uv_bin, 'venv', VIRTUAL_ENV)
73
+ first_run = not Path(VIRTUAL_ENV).is_dir()
75
74
 
75
+ # Always sync: creates venv if missing, regenerates uv.lock, installs deps:
76
+ verbose_check_call(uv_bin, 'sync')
77
+
78
+ if first_run:
76
79
  # Activate git pre-commit hooks:
77
80
  verbose_check_call(uv_bin, 'run', '--active', '-m', 'pre_commit', 'install')
78
81
 
@@ -0,0 +1,43 @@
1
+ import inspect
2
+
3
+ import cmd2
4
+ from cmd2 import CommandSet
5
+
6
+ from dev_shell.config import DevShellConfig
7
+
8
+
9
+ class CategorizedCommandSet(CommandSet):
10
+ """
11
+ A cmd2 CommandSet that automatically groups all do_* methods under a help category.
12
+
13
+ Set the class attribute `category` in a subclass to assign all its commands to that
14
+ category in the help output. The categorization happens once at class definition time
15
+ via __init_subclass__, so there is no runtime overhead per instance.
16
+
17
+ Example::
18
+
19
+ class MyCommands(CategorizedCommandSet):
20
+ category = 'My Commands'
21
+
22
+ def do_hello(self, statement):
23
+ ...
24
+ """
25
+
26
+ category = None
27
+
28
+ def __init_subclass__(cls, **kwargs):
29
+ super().__init_subclass__(**kwargs)
30
+ if category := getattr(cls, 'category', None):
31
+ cmd2.utils.categorize(
32
+ [v for k, v in inspect.getmembers(cls, predicate=inspect.isfunction) if k.startswith('do_')],
33
+ category,
34
+ )
35
+
36
+
37
+ class DevShellBaseCommandSet(CategorizedCommandSet):
38
+ category = 'dev-shell commands'
39
+
40
+ def __init__(self, config: DevShellConfig):
41
+ super().__init__()
42
+
43
+ self.config = config
@@ -23,7 +23,6 @@ except ModuleNotFoundError:
23
23
  publish_package = None
24
24
 
25
25
 
26
- @cmd2.with_default_category('dev-shell commands')
27
26
  class DevShellCommandSet(DevShellBaseCommandSet):
28
27
  """
29
28
  This command set may be used in external project, too.
@@ -27,16 +27,16 @@ def get_devshell_app_kwargs():
27
27
  config = DevShellConfig(package_module=dev_shell)
28
28
 
29
29
  # initialize all CommandSet() with context:
30
- kwargs = dict(
31
- config=config
32
- )
30
+ kwargs = {
31
+ 'config': config,
32
+ }
33
33
 
34
- app_kwargs = dict(
35
- config=config,
36
- command_sets=[
34
+ app_kwargs = {
35
+ 'config': config,
36
+ 'command_sets': [
37
37
  DevShellCommandSet(**kwargs),
38
- ]
39
- )
38
+ ],
39
+ }
40
40
  return app_kwargs
41
41
 
42
42
 
@@ -4,7 +4,7 @@ from pathlib import Path
4
4
 
5
5
  from bx_py_utils.test_utils.deny_requests import deny_any_real_request
6
6
  from cli_base.cli_tools.verbosity import MAX_LOG_LEVEL, setup_logging
7
- from rich import print # noqa
7
+ from rich import print
8
8
  from typeguard import install_import_hook
9
9
 
10
10
 
@@ -17,7 +17,7 @@ def pre_configure_tests() -> None:
17
17
 
18
18
  # Hacky way to display more "assert"-Context in failing tests:
19
19
  _MIN_MAX_DIFF = unittest.util._MAX_LENGTH - unittest.util._MIN_DIFF_LEN
20
- unittest.util._MAX_LENGTH = int(os.environ.get('UNITTEST_MAX_LENGTH', 2000))
20
+ unittest.util._MAX_LENGTH = int(os.environ.get('UNITTEST_MAX_LENGTH', '2000'))
21
21
  unittest.util._MIN_DIFF_LEN = unittest.util._MAX_LENGTH - _MIN_MAX_DIFF
22
22
 
23
23
  # Deny any request via docket/urllib3 because tests they should mock all requests:
@@ -7,13 +7,21 @@ from manageprojects.tests.base import BaseTestCase
7
7
  from dev_shell.constants import DEV_SHELL_PKG_PATH
8
8
 
9
9
 
10
+ def remove_until_usage(text: str) -> str:
11
+ lines = text.splitlines()
12
+ for idx, line in enumerate(lines):
13
+ if '-m dev_shell help' in line:
14
+ return '\n'.join(lines[idx + 1 :])
15
+ raise ValueError('No usage line found')
16
+
17
+
10
18
  def assert_cli_help_in_readme(text_block: str, marker: str):
11
19
  README_PATH = DEV_SHELL_PKG_PATH.parent / 'README.md'
12
20
  assert_is_file(README_PATH)
13
21
 
14
- text_block = '\n'.join(text_block.splitlines()[2:])
15
-
22
+ text_block = remove_until_usage(text_block)
16
23
  text_block = f'```\n{text_block.strip()}\n```'
24
+
17
25
  assert_readme_block(
18
26
  readme_path=README_PATH,
19
27
  text_block=text_block,
@@ -3,6 +3,7 @@ import shlex
3
3
  import shutil
4
4
  import subprocess
5
5
  import sys
6
+ from collections.abc import Iterable
6
7
  from pathlib import Path
7
8
 
8
9
  from bx_py_utils.path import assert_is_dir
@@ -60,13 +61,31 @@ def make_relative_path(path, relative_to):
60
61
  return path
61
62
 
62
63
 
64
+ def shlex_join_plus(args: Iterable) -> str:
65
+ """
66
+ Like shlex.join(), but also accepts Path objects.
67
+
68
+ >>> shlex_join_plus(['echo', Path('/tmp/my dir')])
69
+ "echo '/tmp/my dir'"
70
+ """
71
+
72
+ def path_to_str(parts):
73
+ for part in parts:
74
+ if isinstance(part, Path):
75
+ yield str(part)
76
+ else:
77
+ yield part
78
+
79
+ return shlex.join(path_to_str(args))
80
+
81
+
63
82
  def _print_info(popenargs, *, cwd, kwargs):
64
83
  print()
65
84
  print('_' * 100)
66
85
 
67
86
  if len(popenargs) > 1:
68
87
  command, *args = popenargs
69
- args = shlex.join(args)
88
+ args = shlex_join_plus(args)
70
89
  else:
71
90
  command = popenargs[0]
72
91
  args = ''
@@ -70,9 +70,12 @@ def main(argv):
70
70
  if not uv_bin:
71
71
  print_uv_error_and_exit()
72
72
 
73
- if not Path(VIRTUAL_ENV).is_dir():
74
- verbose_check_call(uv_bin, 'venv', VIRTUAL_ENV)
73
+ first_run = not Path(VIRTUAL_ENV).is_dir()
75
74
 
75
+ # Always sync: creates venv if missing, regenerates uv.lock, installs deps:
76
+ verbose_check_call(uv_bin, 'sync')
77
+
78
+ if first_run:
76
79
  # Activate git pre-commit hooks:
77
80
  verbose_check_call(uv_bin, 'run', '--active', '-m', 'pre_commit', 'install')
78
81
 
@@ -12,6 +12,7 @@ PYTHON_VERSIONS = ('3.14', '3.13', '3.12')
12
12
  @nox.session(
13
13
  python=PYTHON_VERSIONS,
14
14
  venv_backend='uv',
15
+ reuse_venv=True,
15
16
  download_python='auto',
16
17
  )
17
18
  def tests(session: Session):
@@ -67,6 +67,7 @@ version_module_name = "dev_shell" # Used by "update-readme-history" git hook
67
67
  line-length = 120
68
68
  exclude = [
69
69
  ".*/",
70
+ "dev_shell/bootstrap-source.py",
70
71
  ]
71
72
 
72
73
  [tool.ruff.lint]
@@ -1,10 +0,0 @@
1
- from cmd2 import CommandSet
2
-
3
- from dev_shell.config import DevShellConfig
4
-
5
-
6
- class DevShellBaseCommandSet(CommandSet):
7
- def __init__(self, config: DevShellConfig):
8
- super().__init__()
9
-
10
- self.config = config