python-toolbox-przemek 0.7.0__tar.gz → 0.8.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.7.0
3
+ Version: 0.8.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
@@ -22,6 +22,7 @@ Provides-Extra: tests
22
22
  Requires-Dist: coverage==7.8.2; extra == "tests"
23
23
  Requires-Dist: pytest-xdist==3.8.0; extra == "tests"
24
24
  Requires-Dist: pytest-datadir==1.8.0; extra == "tests"
25
+ Requires-Dist: pytest-regtest==2.3.7; extra == "tests"
25
26
 
26
27
  # Python Toolbox Przemek
27
28
  I want to provide basic tools for my day-to-day work.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "python-toolbox-przemek"
3
- version = "0.7.0"
3
+ version = "0.8.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"}
@@ -26,11 +26,13 @@ notebook = [ "nbstripout==0.8.1", "jupytext==1.17.0", "ipykernel==6.29.5" ]
26
26
  tests = [
27
27
  "coverage==7.8.2", # Generates tests coverage report.
28
28
  "pytest-xdist==3.8.0", # Runs pytest on many cores.
29
- "pytest-datadir==1.8.0" # pytest plugin for test data directories and files - https://pypi.org/project/pytest-datadir/
29
+ "pytest-datadir==1.8.0", # pytest plugin for test data directories and files - https://pypi.org/project/pytest-datadir/
30
+ "pytest-regtest==2.3.7"# Package for regression tests.
30
31
  ]
31
32
 
32
33
  [project.scripts]
33
34
  generate_dap_config = "python_toolbox_przemek.dap_cli:generate_dap_config"
35
+ generate_env = "python_toolbox_przemek.env_cli:generate_env"
34
36
 
35
37
  [tool.setuptools.packages.find]
36
38
  where = ["src"]
@@ -1,59 +1,77 @@
1
1
  import click
2
2
  from pathlib import Path
3
3
 
4
- LUA = '''-- I use dap-python as I don't want to manually set `adapters.python`.
4
+ LUA = f'''-- I use dap-python as I don't want to manually set `adapters.python`.
5
5
  local dap_python = require('dap-python')
6
6
 
7
7
  dap_python.setup(os.getenv('PYTHON_INTERPRETER_PATH'))
8
8
 
9
- require('dap').configurations.python = {
10
- {
9
+ require('dap').configurations.python = {{
10
+ {{
11
11
  type = 'python',
12
12
  request = 'launch',
13
13
  name = "Run current file",
14
- program = '${file}',
14
+ program = '${{file}}',
15
15
  justMyCode = false,
16
- },
17
- {
16
+ env = {{
17
+ PYTHONSTARTUP = os.getenv("PYTHONSTARTUP") or ""
18
+ }},
19
+ }},
20
+ {{
18
21
  type = 'python',
19
22
  request = 'launch',
20
23
  name = 'pytest run current file',
21
24
  module = 'pytest',
22
- args = {'${file}', '--log-cli-level=DEBUG'},
25
+ args = {{'${{file}}', '--log-cli-level=DEBUG'}},
23
26
  justMyCode = false,
24
- },
25
- {
27
+ env = {{
28
+ PYTHONSTARTUP = os.getenv("PYTHONSTARTUP") or ""
29
+ }},
30
+ }},
31
+ {{
26
32
  type = 'python',
27
33
  request = 'launch',
28
34
  name = 'pytest run current file on many cores',
29
35
  module = 'pytest',
30
- args = {'-n', 'auto', '${file}', '--log-cli-level=DEBUG'},
36
+ args = {{'-n', 'auto', '${{file}}', '--log-cli-level=DEBUG'}},
31
37
  justMyCode = false,
32
- },
33
- {
38
+ env = {{
39
+ PYTHONSTARTUP = os.getenv("PYTHONSTARTUP") or ""
40
+ }},
41
+ }},
42
+ {{
34
43
  type = 'python',
35
44
  request = 'launch',
36
45
  name = 'pytest run all unit tests',
37
46
  module = 'pytest',
38
- args = {'tests/test_unit/', '--log-cli-level=DEBUG'},
47
+ args = {{'tests/test_unit/', '--log-cli-level=DEBUG'}},
39
48
  justMyCode = false,
40
- },
41
- {
49
+ env = {{
50
+ PYTHONSTARTUP = os.getenv("PYTHONSTARTUP") or ""
51
+ }},
52
+ }},
53
+ {{
42
54
  type = 'python',
43
55
  request = 'launch',
44
56
  name = 'pytest run godm unit tests',
45
57
  module = 'pytest',
46
- args = {'tests/test_unit/test_godm/', '--log-cli-level=DEBUG'},
58
+ args = {{'tests/test_unit/test_godm/', '--log-cli-level=DEBUG'}},
47
59
  justMyCode = false,
48
- },
49
- {
60
+ env = {{
61
+ PYTHONSTARTUP = os.getenv("PYTHONSTARTUP") or ""
62
+ }},
63
+ }},
64
+ {{
50
65
  type = 'python',
51
66
  request = 'launch',
52
67
  name = 'Run current file with arguments',
53
- program = '${file}',
54
- args = {'--arg1', 'value1', '--arg2', 'value2'},
55
- },
56
- }
68
+ program = '${{file}}',
69
+ args = {{'--arg1', 'value1', '--arg2', 'value2'}},
70
+ env = {{
71
+ PYTHONSTARTUP = os.getenv("PYTHONSTARTUP") or ""
72
+ }},
73
+ }},
74
+ }}
57
75
  '''
58
76
 
59
77
 
@@ -0,0 +1,32 @@
1
+ import click
2
+ from pathlib import Path
3
+ import sys
4
+ import python_toolbox_przemek
5
+
6
+ @click.command()
7
+ @click.option('--output', '-o', default='.env', type=click.Path(), help='Output file path')
8
+ @click.option('--force', '-f', is_flag=True, help='Overwrite existing file if present')
9
+ def generate_env(output, force):
10
+ """Generate a .env file for Neovim DAP."""
11
+ out = Path(output)
12
+ if out.exists() and not force:
13
+ click.echo(f"{out} already exists. Use --force to overwrite.")
14
+ raise click.Abort()
15
+
16
+ pandas_config = Path(python_toolbox_przemek.__file__).parent / "pandas_config.py"
17
+
18
+ # Try to find venv python
19
+ # sys.executable is the venv python if running from a venv
20
+ interpreter = sys.executable
21
+
22
+ content = [
23
+ f'PYTHONSTARTUP="{pandas_config.absolute()}"',
24
+ f'PYTHON_INTERPRETER_PATH="{interpreter}"',
25
+ 'PYTHONPATH=""',
26
+ ]
27
+
28
+ out.write_text("\n".join(content) + "\n")
29
+ click.echo(f"Wrote env config to: {out}")
30
+
31
+ if __name__ == '__main__':
32
+ generate_env()
@@ -0,0 +1,8 @@
1
+ import contextlib
2
+
3
+ with contextlib.suppress(ImportError):
4
+ import pandas as pd
5
+
6
+ pd.set_option("display.max_rows", 999999)
7
+ pd.set_option("display.max_columns", 999999)
8
+ pd.set_option("display.max_colwidth", 999999)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-toolbox-przemek
3
- Version: 0.7.0
3
+ Version: 0.8.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
@@ -22,6 +22,7 @@ Provides-Extra: tests
22
22
  Requires-Dist: coverage==7.8.2; extra == "tests"
23
23
  Requires-Dist: pytest-xdist==3.8.0; extra == "tests"
24
24
  Requires-Dist: pytest-datadir==1.8.0; extra == "tests"
25
+ Requires-Dist: pytest-regtest==2.3.7; extra == "tests"
25
26
 
26
27
  # Python Toolbox Przemek
27
28
  I want to provide basic tools for my day-to-day work.
@@ -2,6 +2,8 @@ README.md
2
2
  pyproject.toml
3
3
  src/python_toolbox_przemek/__init__.py
4
4
  src/python_toolbox_przemek/dap_cli.py
5
+ src/python_toolbox_przemek/env_cli.py
6
+ src/python_toolbox_przemek/pandas_config.py
5
7
  src/python_toolbox_przemek.egg-info/PKG-INFO
6
8
  src/python_toolbox_przemek.egg-info/SOURCES.txt
7
9
  src/python_toolbox_przemek.egg-info/dependency_links.txt
@@ -1,2 +1,3 @@
1
1
  [console_scripts]
2
2
  generate_dap_config = python_toolbox_przemek.dap_cli:generate_dap_config
3
+ generate_env = python_toolbox_przemek.env_cli:generate_env
@@ -18,3 +18,4 @@ ipykernel==6.29.5
18
18
  coverage==7.8.2
19
19
  pytest-xdist==3.8.0
20
20
  pytest-datadir==1.8.0
21
+ pytest-regtest==2.3.7