python-toolbox-przemek 0.4.3__tar.gz → 0.6.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-toolbox-przemek
3
- Version: 0.4.3
3
+ Version: 0.6.0
4
4
  Summary: We want to provide basic tools for our day-to-day work.
5
5
  Author: przemek@sagalo.pro
6
6
  Requires-Python: <4,>=3.11
@@ -8,6 +8,7 @@ Description-Content-Type: text/markdown
8
8
  Requires-Dist: poetry==2.2.0
9
9
  Requires-Dist: pynvim==0.5.2
10
10
  Requires-Dist: debugpy==1.8.14
11
+ Requires-Dist: click==8.1.7
11
12
  Provides-Extra: lint
12
13
  Requires-Dist: black==24.2.0; extra == "lint"
13
14
  Requires-Dist: isort==5.13.2; extra == "lint"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "python-toolbox-przemek"
3
- version = "0.4.3"
3
+ version = "0.6.0"
4
4
  description = "We want to provide basic tools for our day-to-day work."
5
5
  authors = [
6
6
  {name = "przemek@sagalo.pro"}
@@ -12,7 +12,8 @@ requires-python = ">=3.11,<4"
12
12
  dependencies = [
13
13
  "poetry==2.2.0",
14
14
  "pynvim==0.5.2",
15
- "debugpy==1.8.14"
15
+ "debugpy==1.8.14",
16
+ "click==8.1.7"
16
17
  ]
17
18
 
18
19
  [project.optional-dependencies]
@@ -29,7 +30,7 @@ tests = [
29
30
  ]
30
31
 
31
32
  [project.scripts]
32
- ppce = "python_toolbox_przemek.toolbox_venv:create_venv_unix_like"
33
+ generate_dap_config = "python_toolbox_przemek.dap_cli:generate_dap_config"
33
34
 
34
35
  [build-system]
35
36
  requires = ["setuptools >= 79.0.1"]
@@ -0,0 +1,74 @@
1
+ import click
2
+ from pathlib import Path
3
+
4
+ LUA = '''-- I use dap-python as I don't want to manually set `adapters.python`.
5
+ local dap_python = require('dap-python')
6
+
7
+ dap_python.setup(os.getenv('PYTHON_INTERPRETER_PATH'))
8
+
9
+ require('dap').configurations.python = {
10
+ {
11
+ type = 'python',
12
+ request = 'launch',
13
+ name = "Run current file",
14
+ program = '${file}',
15
+ justMyCode = false,
16
+ },
17
+ {
18
+ type = 'python',
19
+ request = 'launch',
20
+ name = 'pytest run current file',
21
+ module = 'pytest',
22
+ args = {'${file}', '--log-cli-level=DEBUG'},
23
+ justMyCode = false,
24
+ },
25
+ {
26
+ type = 'python',
27
+ request = 'launch',
28
+ name = 'pytest run current file on many cores',
29
+ module = 'pytest',
30
+ args = {'-n', 'auto', '${file}', '--log-cli-level=DEBUG'},
31
+ justMyCode = false,
32
+ },
33
+ {
34
+ type = 'python',
35
+ request = 'launch',
36
+ name = 'pytest run all unit tests',
37
+ module = 'pytest',
38
+ args = {'tests/test_unit/', '--log-cli-level=DEBUG'},
39
+ justMyCode = false,
40
+ },
41
+ {
42
+ type = 'python',
43
+ request = 'launch',
44
+ name = 'pytest run godm unit tests',
45
+ module = 'pytest',
46
+ args = {'tests/test_unit/test_godm/', '--log-cli-level=DEBUG'},
47
+ justMyCode = false,
48
+ },
49
+ {
50
+ type = 'python',
51
+ request = 'launch',
52
+ name = 'Run current file with arguments',
53
+ program = '${file}',
54
+ args = {'--arg1', 'value1', '--arg2', 'value2'},
55
+ },
56
+ }
57
+ '''
58
+
59
+
60
+ @click.command()
61
+ @click.option('--output', '-o', default='dap_config.lua', type=click.Path(), help='Output file path')
62
+ @click.option('--force', '-f', is_flag=True, help='Overwrite existing file if present')
63
+ def generate_dap_config(output, force):
64
+ """Generate a dap_config.lua file with recommended Python dap configurations."""
65
+ out = Path(output)
66
+ if out.exists() and not force:
67
+ click.echo(f"{out} already exists. Use --force to overwrite.")
68
+ raise click.Abort()
69
+ out.write_text(LUA)
70
+ click.echo(f"Wrote dap config to: {out}")
71
+
72
+
73
+ if __name__ == '__main__':
74
+ generate_dap_config()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-toolbox-przemek
3
- Version: 0.4.3
3
+ Version: 0.6.0
4
4
  Summary: We want to provide basic tools for our day-to-day work.
5
5
  Author: przemek@sagalo.pro
6
6
  Requires-Python: <4,>=3.11
@@ -8,6 +8,7 @@ Description-Content-Type: text/markdown
8
8
  Requires-Dist: poetry==2.2.0
9
9
  Requires-Dist: pynvim==0.5.2
10
10
  Requires-Dist: debugpy==1.8.14
11
+ Requires-Dist: click==8.1.7
11
12
  Provides-Extra: lint
12
13
  Requires-Dist: black==24.2.0; extra == "lint"
13
14
  Requires-Dist: isort==5.13.2; extra == "lint"
@@ -1,7 +1,7 @@
1
1
  README.md
2
2
  pyproject.toml
3
3
  src/python_toolbox_przemek/__init__.py
4
- src/python_toolbox_przemek/toolbox_venv.py
4
+ src/python_toolbox_przemek/dap_cli.py
5
5
  src/python_toolbox_przemek.egg-info/PKG-INFO
6
6
  src/python_toolbox_przemek.egg-info/SOURCES.txt
7
7
  src/python_toolbox_przemek.egg-info/dependency_links.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ generate_dap_config = python_toolbox_przemek.dap_cli:generate_dap_config
@@ -1,6 +1,7 @@
1
1
  poetry==2.2.0
2
2
  pynvim==0.5.2
3
3
  debugpy==1.8.14
4
+ click==8.1.7
4
5
 
5
6
  [lint]
6
7
  black==24.2.0
@@ -1,24 +0,0 @@
1
- import venv
2
- import os
3
-
4
- def create_venv_unix_like(env_name="venv"):
5
- """
6
- Creates a Python virtual environment with the same behavior as
7
- 'python -m venv <env_name>' on Unix-like systems (Linux/macOS).
8
- It ensures pip is installed and uses symbolic links.
9
- If the environment already exists, it skips creation.
10
- """
11
- env_path = os.path.join(os.getcwd(), env_name)
12
-
13
- if os.path.exists(env_path):
14
- print(f"Environment '{env_name}' already exists at {env_path}. Skipping creation.")
15
- else:
16
- print(f"Creating virtual environment '{env_name}' at {env_path}...")
17
- try:
18
- # with_pip=True: Ensures pip (and setuptools/wheel) are installed.
19
- # symlinks=True: Uses symbolic links for efficiency (default on non-Windows).
20
- builder = venv.EnvBuilder(with_pip=True, symlinks=True)
21
- builder.create(env_path)
22
- print(f"Environment '{env_name}' created successfully.")
23
- except Exception as e:
24
- print(f"Error creating environment: {e}")
@@ -1,2 +0,0 @@
1
- [console_scripts]
2
- ppce = python_toolbox_przemek.toolbox_venv:create_venv_unix_like