csspin-python 3.2.0__py3-none-any.whl → 4.0.0__py3-none-any.whl
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.
- csspin_python/devpi.py +0 -1
- csspin_python/pytest.py +0 -1
- csspin_python/python.py +78 -60
- csspin_python/uv_provisioner.py +4 -3
- {csspin_python-3.2.0.dist-info → csspin_python-4.0.0.dist-info}/METADATA +4 -4
- {csspin_python-3.2.0.dist-info → csspin_python-4.0.0.dist-info}/RECORD +9 -9
- {csspin_python-3.2.0.dist-info → csspin_python-4.0.0.dist-info}/WHEEL +1 -1
- {csspin_python-3.2.0.dist-info → csspin_python-4.0.0.dist-info}/licenses/LICENSE +0 -0
- {csspin_python-3.2.0.dist-info → csspin_python-4.0.0.dist-info}/top_level.txt +0 -0
csspin_python/devpi.py
CHANGED
csspin_python/pytest.py
CHANGED
csspin_python/python.py
CHANGED
|
@@ -75,7 +75,7 @@ import re
|
|
|
75
75
|
import shutil
|
|
76
76
|
import sys
|
|
77
77
|
from contextlib import contextmanager
|
|
78
|
-
from subprocess import check_output
|
|
78
|
+
from subprocess import CalledProcessError, check_output
|
|
79
79
|
from textwrap import dedent, indent
|
|
80
80
|
from typing import Generator, Iterable, Type, Union
|
|
81
81
|
|
|
@@ -289,20 +289,65 @@ def nuget_install(cfg: ConfigTree) -> None:
|
|
|
289
289
|
)
|
|
290
290
|
|
|
291
291
|
|
|
292
|
-
def
|
|
293
|
-
|
|
294
|
-
|
|
292
|
+
def _check_venv( # pylint: disable=too-many-return-statements
|
|
293
|
+
cfg: ConfigTree,
|
|
294
|
+
) -> bool:
|
|
295
|
+
"""
|
|
296
|
+
Checks whether the venv is actually a venv compatible
|
|
297
|
+
with our configuration and not just some dir.
|
|
298
|
+
"""
|
|
299
|
+
try:
|
|
295
300
|
python_version = (
|
|
296
301
|
check_output([cfg.python.python, "--version"])
|
|
297
302
|
.decode()
|
|
298
303
|
.strip()
|
|
299
304
|
.replace("Python ", "")
|
|
300
305
|
)
|
|
301
|
-
|
|
306
|
+
except CalledProcessError:
|
|
307
|
+
return False
|
|
308
|
+
if not cfg.python.version and not cfg.python.use:
|
|
309
|
+
return False
|
|
310
|
+
if cfg.python.use:
|
|
311
|
+
try:
|
|
312
|
+
use_python_version = (
|
|
313
|
+
check_output([cfg.python.use, "--version"])
|
|
314
|
+
.decode()
|
|
315
|
+
.strip()
|
|
316
|
+
.replace("Python ", "")
|
|
317
|
+
)
|
|
318
|
+
except CalledProcessError:
|
|
319
|
+
return False
|
|
320
|
+
if use_python_version == python_version:
|
|
321
|
+
return True
|
|
322
|
+
else:
|
|
323
|
+
warn(
|
|
324
|
+
"The cfg.python.use version does not match the cfg.python.python "
|
|
325
|
+
"version set in the venv. If you want to update the python version "
|
|
326
|
+
"used in the venv, you have to manually remove it."
|
|
327
|
+
)
|
|
328
|
+
return True
|
|
329
|
+
if python_version.startswith(cfg.python.version):
|
|
330
|
+
return True
|
|
331
|
+
return False
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
def provision(cfg: ConfigTree) -> None:
|
|
335
|
+
"""Provision the python plugin"""
|
|
336
|
+
|
|
337
|
+
info("Checking venv '{python.venv}'")
|
|
338
|
+
|
|
339
|
+
fresh_venv = False
|
|
340
|
+
|
|
341
|
+
if exists("{python.venv}"):
|
|
342
|
+
if not _check_venv(cfg):
|
|
302
343
|
_cleanup_memoed_provisioners(cfg)
|
|
303
344
|
rmtree(cfg.python.provisioner_memo)
|
|
304
345
|
rmtree(cfg.python.aws_auth.memo)
|
|
305
346
|
rmtree(cfg.python.venv)
|
|
347
|
+
fresh_venv = True
|
|
348
|
+
else:
|
|
349
|
+
fresh_venv = True
|
|
350
|
+
|
|
306
351
|
with memoizer(cfg.python.provisioner_memo) as memo:
|
|
307
352
|
if cfg.python.provisioner is None:
|
|
308
353
|
cfg.python.provisioner = SimpleProvisioner(cfg)
|
|
@@ -311,7 +356,7 @@ def provision(cfg: ConfigTree) -> None:
|
|
|
311
356
|
if not shutil.which(cfg.python.interpreter):
|
|
312
357
|
cfg.python.provisioner.provision_python(cfg)
|
|
313
358
|
|
|
314
|
-
venv_provision(cfg)
|
|
359
|
+
venv_provision(cfg, fresh_venv)
|
|
315
360
|
|
|
316
361
|
cfg.python.site_packages = get_site_packages(interpreter=cfg.python.python)
|
|
317
362
|
|
|
@@ -468,24 +513,19 @@ class BashActivate(ActivateScriptPatcher):
|
|
|
468
513
|
replacements = [
|
|
469
514
|
("deactivate", "origdeactivate"),
|
|
470
515
|
]
|
|
471
|
-
old_env_pattern = dedent(
|
|
472
|
-
"""
|
|
516
|
+
old_env_pattern = dedent("""
|
|
473
517
|
if [ -z ${{{name}+x}} ]; then
|
|
474
518
|
export _OLD_SPIN_UNSET{name}=""
|
|
475
519
|
else
|
|
476
520
|
export _OLD_SPIN_VALUE{name}="${name}"
|
|
477
521
|
fi
|
|
478
|
-
"""
|
|
479
|
-
|
|
480
|
-
setpattern = dedent(
|
|
481
|
-
"""
|
|
522
|
+
""")
|
|
523
|
+
setpattern = dedent("""
|
|
482
524
|
{name}="{value}"
|
|
483
525
|
export {name}
|
|
484
|
-
"""
|
|
485
|
-
)
|
|
526
|
+
""")
|
|
486
527
|
resetpattern = indent(
|
|
487
|
-
dedent(
|
|
488
|
-
"""
|
|
528
|
+
dedent("""
|
|
489
529
|
if ! [ -z "${{_OLD_SPIN_VALUE{name}+_}}" ] ; then
|
|
490
530
|
{name}="$_OLD_SPIN_VALUE{name}"
|
|
491
531
|
export {name}
|
|
@@ -495,12 +535,10 @@ class BashActivate(ActivateScriptPatcher):
|
|
|
495
535
|
unset {name}
|
|
496
536
|
unset _OLD_SPIN_UNSET{name}
|
|
497
537
|
fi
|
|
498
|
-
"""
|
|
499
|
-
),
|
|
538
|
+
"""),
|
|
500
539
|
prefix=" ",
|
|
501
540
|
)
|
|
502
|
-
script = dedent(
|
|
503
|
-
"""
|
|
541
|
+
script = dedent("""
|
|
504
542
|
{patchmarker}
|
|
505
543
|
{original}
|
|
506
544
|
deactivate () {{
|
|
@@ -520,8 +558,7 @@ class BashActivate(ActivateScriptPatcher):
|
|
|
520
558
|
# commands. Without forgetting past commands the $PATH changes
|
|
521
559
|
# we made may not be respected
|
|
522
560
|
hash -r 2>/dev/null
|
|
523
|
-
"""
|
|
524
|
-
)
|
|
561
|
+
""")
|
|
525
562
|
|
|
526
563
|
@staticmethod
|
|
527
564
|
def interpolate_environ_value(value: str) -> str:
|
|
@@ -543,24 +580,19 @@ class PowershellActivate(ActivateScriptPatcher):
|
|
|
543
580
|
old_env_pattern = (
|
|
544
581
|
"New-Variable -Scope global -Name _OLD_SPIN_{name} -Value $env:{name}"
|
|
545
582
|
)
|
|
546
|
-
setpattern = dedent(
|
|
547
|
-
"""
|
|
583
|
+
setpattern = dedent("""
|
|
548
584
|
$env:{name} = "{value}"
|
|
549
|
-
"""
|
|
550
|
-
)
|
|
585
|
+
""")
|
|
551
586
|
resetpattern = indent(
|
|
552
|
-
dedent(
|
|
553
|
-
"""
|
|
587
|
+
dedent("""
|
|
554
588
|
if (Test-Path variable:_OLD_SPIN_{name}) {{
|
|
555
589
|
$env:{name} = $variable:_OLD_SPIN_{name}
|
|
556
590
|
Remove-Variable "_OLD_SPIN_{name}" -Scope global
|
|
557
591
|
}}
|
|
558
|
-
"""
|
|
559
|
-
),
|
|
592
|
+
"""),
|
|
560
593
|
prefix=" ",
|
|
561
594
|
)
|
|
562
|
-
script = dedent(
|
|
563
|
-
"""
|
|
595
|
+
script = dedent("""
|
|
564
596
|
{patchmarker}
|
|
565
597
|
{original}
|
|
566
598
|
function global:deactivate([switch] $NonDestructive) {{
|
|
@@ -574,8 +606,7 @@ class PowershellActivate(ActivateScriptPatcher):
|
|
|
574
606
|
deactivate -nondestructive
|
|
575
607
|
{old_value_setters}
|
|
576
608
|
{setters}
|
|
577
|
-
"""
|
|
578
|
-
)
|
|
609
|
+
""")
|
|
579
610
|
|
|
580
611
|
@staticmethod
|
|
581
612
|
def interpolate_environ_value(value: str) -> str:
|
|
@@ -592,8 +623,7 @@ class BatchActivate(ActivateScriptPatcher):
|
|
|
592
623
|
patchmarker = "\nREM Patched by csspin_python.python\n"
|
|
593
624
|
activatescript = Path("{python.scriptdir}") / "activate.bat"
|
|
594
625
|
replacements = []
|
|
595
|
-
old_env_pattern = dedent(
|
|
596
|
-
"""
|
|
626
|
+
old_env_pattern = dedent("""
|
|
597
627
|
if defined _OLD_SPIN_VALUE_{name} goto ENDIFSPIN{name}1
|
|
598
628
|
if defined _OLD_SPIN_UNSET_{name} goto ENDIFSPIN{name}2
|
|
599
629
|
if defined {name} goto ENDIFSPIN{name}3
|
|
@@ -613,19 +643,16 @@ class BatchActivate(ActivateScriptPatcher):
|
|
|
613
643
|
set "_OLD_SPIN_UNSET_{name}= "
|
|
614
644
|
goto ENDIFSPIN{name}5
|
|
615
645
|
:ENDIFSPIN{name}5
|
|
616
|
-
"""
|
|
617
|
-
)
|
|
646
|
+
""")
|
|
618
647
|
setpattern = 'set "{name}={value}"'
|
|
619
648
|
resetpattern = ""
|
|
620
|
-
script = dedent(
|
|
621
|
-
"""
|
|
649
|
+
script = dedent("""
|
|
622
650
|
@echo off
|
|
623
651
|
{patchmarker}
|
|
624
652
|
{original}
|
|
625
653
|
{old_value_setters}
|
|
626
654
|
{setters}
|
|
627
|
-
"""
|
|
628
|
-
)
|
|
655
|
+
""")
|
|
629
656
|
|
|
630
657
|
@staticmethod
|
|
631
658
|
def interpolate_environ_value(value: str) -> str:
|
|
@@ -644,8 +671,7 @@ class BatchDeactivate(ActivateScriptPatcher):
|
|
|
644
671
|
replacements = []
|
|
645
672
|
old_env_pattern = ""
|
|
646
673
|
setpattern = ""
|
|
647
|
-
resetpattern = dedent(
|
|
648
|
-
"""
|
|
674
|
+
resetpattern = dedent("""
|
|
649
675
|
if defined _OLD_SPIN_VALUE_{name} goto ENDIFVSPIN{name}1
|
|
650
676
|
if defined _OLD_SPIN_UNSET_{name} goto ENDIFVSPIN{name}2
|
|
651
677
|
:ENDIFVSPIN{name}1
|
|
@@ -657,16 +683,13 @@ class BatchDeactivate(ActivateScriptPatcher):
|
|
|
657
683
|
set _OLD_SPIN_UNSET_{name}=
|
|
658
684
|
goto ENDIFVSPIN{name}0
|
|
659
685
|
:ENDIFVSPIN{name}0
|
|
660
|
-
"""
|
|
661
|
-
|
|
662
|
-
script = dedent(
|
|
663
|
-
"""
|
|
686
|
+
""")
|
|
687
|
+
script = dedent("""
|
|
664
688
|
@echo off
|
|
665
689
|
{patchmarker}
|
|
666
690
|
{original}
|
|
667
691
|
{resetters}
|
|
668
|
-
"""
|
|
669
|
-
)
|
|
692
|
+
""")
|
|
670
693
|
|
|
671
694
|
|
|
672
695
|
class PythonActivate(ActivateScriptPatcher):
|
|
@@ -676,13 +699,11 @@ class PythonActivate(ActivateScriptPatcher):
|
|
|
676
699
|
old_env_pattern = ""
|
|
677
700
|
setpattern = 'os.environ["{name}"] = fr"{value}"'
|
|
678
701
|
resetpattern = ""
|
|
679
|
-
script = dedent(
|
|
680
|
-
"""
|
|
702
|
+
script = dedent("""
|
|
681
703
|
{patchmarker}
|
|
682
704
|
{original}
|
|
683
705
|
{setters}
|
|
684
|
-
"""
|
|
685
|
-
)
|
|
706
|
+
""")
|
|
686
707
|
|
|
687
708
|
@staticmethod
|
|
688
709
|
def interpolate_environ_value(value: str) -> str:
|
|
@@ -919,15 +940,12 @@ def _req_for_memo(
|
|
|
919
940
|
|
|
920
941
|
|
|
921
942
|
def venv_provision( # pylint: disable=too-many-branches,missing-function-docstring
|
|
922
|
-
cfg: ConfigTree,
|
|
943
|
+
cfg: ConfigTree, fresh_venv: bool = False
|
|
923
944
|
) -> None:
|
|
924
|
-
fresh_env = False
|
|
925
|
-
info("Checking venv '{python.venv}'")
|
|
926
945
|
|
|
927
|
-
if
|
|
946
|
+
if fresh_venv:
|
|
928
947
|
info("Provisioning venv '{python.venv}'")
|
|
929
948
|
cfg.python.provisioner.provision_venv(cfg)
|
|
930
|
-
fresh_env = True
|
|
931
949
|
|
|
932
950
|
# This sets PATH to the venv
|
|
933
951
|
init(cfg)
|
|
@@ -935,7 +953,7 @@ def venv_provision( # pylint: disable=too-many-branches,missing-function-docstr
|
|
|
935
953
|
_configure_pipconf(cfg)
|
|
936
954
|
|
|
937
955
|
# Establish the prerequisites
|
|
938
|
-
if
|
|
956
|
+
if fresh_venv:
|
|
939
957
|
cfg.python.provisioner.prerequisites(cfg)
|
|
940
958
|
|
|
941
959
|
# Plugins can define a 'venv_hook' function, to give them a
|
csspin_python/uv_provisioner.py
CHANGED
|
@@ -181,8 +181,9 @@ def _update_index_url_in_toml(cfg: ConfigTree) -> None:
|
|
|
181
181
|
Update the index-url in the uv.toml in case it changed.
|
|
182
182
|
"""
|
|
183
183
|
if (uv_toml_path := interpolate1(Path(cfg.uv_provisioner.uv_toml_path))).exists():
|
|
184
|
-
with open(uv_toml_path, mode="
|
|
184
|
+
with open(uv_toml_path, mode="rb") as fd:
|
|
185
185
|
toml_content = tomllib.load(fd)
|
|
186
|
-
|
|
187
|
-
|
|
186
|
+
if toml_content.get("index-url") != cfg.python.index_url:
|
|
187
|
+
toml_content["index-url"] = cfg.python.index_url
|
|
188
|
+
with open(uv_toml_path, mode="wb") as fd:
|
|
188
189
|
tomli_w.dump(toml_content, fd)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: csspin-python
|
|
3
|
-
Version:
|
|
3
|
+
Version: 4.0.0
|
|
4
4
|
Summary: Plugin-package for csspin providing Python related plugins
|
|
5
5
|
Author-email: CONTACT Software GmbH <info@contact-software.com>
|
|
6
6
|
Maintainer-email: Waleri Enns <waleri.enns@contact-software.com>, Benjamin Thomas Schwertfeger <benjaminthomas.schwertfeger@contact-software.com>, Fabian Hafer <fabian.hafer@contact-software.com>
|
|
@@ -15,13 +15,13 @@ Classifier: Development Status :: 5 - Production/Stable
|
|
|
15
15
|
Classifier: Intended Audience :: Developers
|
|
16
16
|
Classifier: Operating System :: OS Independent
|
|
17
17
|
Classifier: Programming Language :: Python :: 3
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
23
|
Classifier: Topic :: Software Development
|
|
24
|
-
Requires-Python: >=3.
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
25
|
Description-Content-Type: text/x-rst
|
|
26
26
|
License-File: LICENSE
|
|
27
27
|
Requires-Dist: platformdirs~=4.3.8
|
|
@@ -90,7 +90,7 @@ within the `spinfile.yaml` configuration file of your project.
|
|
|
90
90
|
- csspin_python.pytest
|
|
91
91
|
|
|
92
92
|
python:
|
|
93
|
-
version: 3.
|
|
93
|
+
version: 3.10.19
|
|
94
94
|
requirements:
|
|
95
95
|
- sphinx-click
|
|
96
96
|
- sphinx-rtd-theme
|
|
@@ -2,20 +2,20 @@ csspin_python/behave.py,sha256=iJZeyIqB7V_NzTdLTZldNY9W_GGwCWkXe6WY69wpDqs,4997
|
|
|
2
2
|
csspin_python/behave_schema.yaml,sha256=8qoOCK-uTmwgRRW29urgK0X_kgn0zO0X34v89bvii2w,1241
|
|
3
3
|
csspin_python/debugpy.py,sha256=v0ZZopv5TNoSaFf2kiePsw9OmhBpjfOBFh0u71jTcnQ,962
|
|
4
4
|
csspin_python/debugpy_schema.yaml,sha256=BeH30nSirDYctkdhS9xMXUG5htj3PED_ZjmxPG5WRUc,364
|
|
5
|
-
csspin_python/devpi.py,sha256=
|
|
5
|
+
csspin_python/devpi.py,sha256=o7O06Dw-xt47y-M74TShcl9MUMaW78aFmw6i6ISYwoU,2351
|
|
6
6
|
csspin_python/devpi_schema.yaml,sha256=2gPATWjVcfvCTrGZX2FK6wH8hh9KS0XzZ35JvZeJGEU,487
|
|
7
7
|
csspin_python/playwright.py,sha256=oFfphLqa4AB6K9vasCUFHN0kFXu63n3ocrsqVuRp4-0,5102
|
|
8
8
|
csspin_python/playwright_schema.yaml,sha256=TSeR16YHa7m7bfO59F2eMV-jXcglluTJdEpUeL16saY,1178
|
|
9
|
-
csspin_python/pytest.py,sha256=
|
|
9
|
+
csspin_python/pytest.py,sha256=N9YaU_ouQab0PFPf46HLE7Vg4JeoZW4dzVD7EevqJ1U,4573
|
|
10
10
|
csspin_python/pytest_schema.yaml,sha256=tzXtdF6MvGC9v59EVRJFfLeMMHqPsXcFXy2zJtRECBI,1535
|
|
11
|
-
csspin_python/python.py,sha256=
|
|
11
|
+
csspin_python/python.py,sha256=ogmaOdaXXZHaCYaPa0b2y11Rn6ZgMgzRftUG6-seBWM,36824
|
|
12
12
|
csspin_python/python_schema.yaml,sha256=pgVVjByUYjxQWek7aFmjQzRwmq2ROLvHYgwGPMrT9sM,6351
|
|
13
13
|
csspin_python/radon.py,sha256=uFqm6FEi5oWj-_XVaAm3s9cam0cUmr1_FwRf40K6xWs,1876
|
|
14
14
|
csspin_python/radon_schema.yaml,sha256=rlRzXw5z4XbjOVznRiUxWGP4E9hx1Jm-gGw1iQiYzE0,548
|
|
15
|
-
csspin_python/uv_provisioner.py,sha256=
|
|
15
|
+
csspin_python/uv_provisioner.py,sha256=1e-_Sb39JrqNWyaUNeBX59R5tutXLJ1ZsT7urCN1U0I,6044
|
|
16
16
|
csspin_python/uv_provisioner_schema.yaml,sha256=Y8ZNC2OMnhR8Us3WUXAXK9hMjqGWAKFJB2puX4X5XNQ,727
|
|
17
|
-
csspin_python-
|
|
18
|
-
csspin_python-
|
|
19
|
-
csspin_python-
|
|
20
|
-
csspin_python-
|
|
21
|
-
csspin_python-
|
|
17
|
+
csspin_python-4.0.0.dist-info/licenses/LICENSE,sha256=4MAecetnRTQw5DlHtiikDSzKWO1xVLwzM5_DsPMYlnE,10172
|
|
18
|
+
csspin_python-4.0.0.dist-info/METADATA,sha256=yC8s-jxM6RQjQWi6UsukDCZlGdoV_NOFubcZ0Y-QERM,5035
|
|
19
|
+
csspin_python-4.0.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
20
|
+
csspin_python-4.0.0.dist-info/top_level.txt,sha256=QSeglMEGbFu1z4L6MCQYwo01NgL0KojWvC4rzgMQ8gU,14
|
|
21
|
+
csspin_python-4.0.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|