fast-dev-cli 0.19.0__tar.gz → 0.19.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.
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/PKG-INFO +1 -1
- fast_dev_cli-0.19.1/fast_dev_cli/__init__.py +1 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/fast_dev_cli/cli.py +52 -16
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/pyproject.toml +1 -1
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/tests/test_deps.py +28 -0
- fast_dev_cli-0.19.0/fast_dev_cli/__init__.py +0 -1
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/LICENSE +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/README.md +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/fast_dev_cli/__main__.py +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/fast_dev_cli/py.typed +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/pdm_build.py +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/scripts/check.py +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/scripts/deps.py +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/scripts/format.py +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/scripts/test.py +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/tests/__init__.py +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/tests/assets/uv-tx.lock +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/tests/assets/uv.lock +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/tests/conftest.py +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/tests/test_bump.py +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/tests/test_exec.py +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/tests/test_fast_test.py +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/tests/test_functions.py +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/tests/test_help.py +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/tests/test_lint.py +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/tests/test_poetry_version_plugin.py +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/tests/test_pypi.py +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/tests/test_runserver.py +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/tests/test_sync.py +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/tests/test_tag.py +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/tests/test_upgrade.py +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/tests/test_upload.py +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/tests/test_version.py +0 -0
- {fast_dev_cli-0.19.0 → fast_dev_cli-0.19.1}/tests/utils.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.19.1"
|
|
@@ -57,7 +57,7 @@ if TYPE_CHECKING:
|
|
|
57
57
|
cli = typer.Typer(no_args_is_help=True)
|
|
58
58
|
DryOption = Option(False, "--dry", help="Only print, not really run shell command")
|
|
59
59
|
TOML_FILE = "pyproject.toml"
|
|
60
|
-
ToolName = Literal["
|
|
60
|
+
ToolName = Literal["uv", "pdm", "poetry"]
|
|
61
61
|
ToolOption = Option(
|
|
62
62
|
"auto", "--tool", help="Explicit declare manage tool (default to auto detect)"
|
|
63
63
|
)
|
|
@@ -658,28 +658,64 @@ class Project:
|
|
|
658
658
|
text = cls.load_toml_text()
|
|
659
659
|
except EnvError:
|
|
660
660
|
return None
|
|
661
|
+
backend = ""
|
|
662
|
+
skip_uv = load_bool("FASTDEVCLI_SKIP_UV")
|
|
661
663
|
with contextlib.suppress(KeyError, tomllib.TOMLDecodeError):
|
|
662
664
|
doc = tomllib.loads(text)
|
|
663
665
|
backend = doc["build-system"]["build-backend"]
|
|
664
|
-
if
|
|
665
|
-
|
|
666
|
-
|
|
666
|
+
if skip_uv:
|
|
667
|
+
for t in ("pdm", "poetry"):
|
|
668
|
+
if t in backend:
|
|
669
|
+
cls._tool = t
|
|
670
|
+
return cls._tool
|
|
671
|
+
work_dir: Path | None = None
|
|
672
|
+
uv_lock_exists: bool | None = None
|
|
673
|
+
if skip_uv:
|
|
674
|
+
for name in ("pdm", "poetry"):
|
|
675
|
+
if f"[tool.{name}]" in text:
|
|
676
|
+
cls._tool = cast(ToolName, name)
|
|
677
|
+
return cls._tool
|
|
667
678
|
work_dir = cls.get_work_dir(allow_cwd=True)
|
|
668
|
-
|
|
669
|
-
|
|
679
|
+
for name in ("pdm", "poetry"):
|
|
680
|
+
if Path(work_dir, f"{name}.lock").exists():
|
|
681
|
+
cls._tool = cast(ToolName, name)
|
|
682
|
+
return cls._tool
|
|
683
|
+
if uv_lock_exists := Path(work_dir, "uv.lock").exists():
|
|
684
|
+
# Use pdm when uv is not available for uv managed project
|
|
670
685
|
cls._tool = "pdm"
|
|
671
|
-
if not Path(work_dir, "pdm.lock").exists() and (
|
|
672
|
-
uv_lock_exists or "[tool.uv]" in text
|
|
673
|
-
):
|
|
674
|
-
cls._tool = "uv"
|
|
675
686
|
return cls._tool
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
687
|
+
return None
|
|
688
|
+
if work_dir is None:
|
|
689
|
+
work_dir = cls.get_work_dir(allow_cwd=True)
|
|
690
|
+
if uv_lock_exists is None:
|
|
691
|
+
uv_lock_exists = Path(work_dir, "uv.lock").exists()
|
|
692
|
+
if uv_lock_exists:
|
|
693
|
+
cls._tool = "uv"
|
|
694
|
+
return cls._tool
|
|
695
|
+
pdm_lock_exists = Path(work_dir, "pdm.lock").exists()
|
|
696
|
+
poetry_lock_exists = Path(work_dir, "poetry.lock").exists()
|
|
697
|
+
match pdm_lock_exists + poetry_lock_exists:
|
|
698
|
+
case 1:
|
|
699
|
+
cls._tool = "pdm" if pdm_lock_exists else "poetry"
|
|
682
700
|
return cls._tool
|
|
701
|
+
case _ as x:
|
|
702
|
+
if backend:
|
|
703
|
+
for t in ("pdm", "poetry"):
|
|
704
|
+
if t in backend:
|
|
705
|
+
cls._tool = cast(ToolName, t)
|
|
706
|
+
return cls._tool
|
|
707
|
+
for name in ("pdm", "poetry"):
|
|
708
|
+
if f"[tool.{name}]" in text:
|
|
709
|
+
cls._tool = cast(ToolName, name)
|
|
710
|
+
return cls._tool
|
|
711
|
+
if x == 2:
|
|
712
|
+
cls._tool = (
|
|
713
|
+
"poetry" if load_bool("FASTDEVCLI_PREFER_POETRY") else "pdm"
|
|
714
|
+
)
|
|
715
|
+
return cls._tool
|
|
716
|
+
if "[tool.uv]" in text or load_bool("FASTDEVCLI_PREFER_uv"):
|
|
717
|
+
cls._tool = "uv"
|
|
718
|
+
return cls._tool
|
|
683
719
|
# Poetry 2.0 default to not include the '[tool.poetry]' section
|
|
684
720
|
if cls.is_poetry_v2(text):
|
|
685
721
|
cls._tool = "poetry"
|
|
@@ -48,3 +48,31 @@ def test_fast_deps():
|
|
|
48
48
|
assert out == "--> uv sync --active --all-extras --all-groups"
|
|
49
49
|
out = capture_cmd_output("fast deps --uv --dry --no-active --no-inexact")
|
|
50
50
|
assert out == "--> uv sync --all-extras --all-groups"
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def test_smart_fast_deps(tmp_work_dir, monkeypatch):
|
|
54
|
+
toml_file = tmp_work_dir.joinpath("pyproject.toml")
|
|
55
|
+
if toml_file.exists():
|
|
56
|
+
toml_file.unlink()
|
|
57
|
+
tmp_work_dir.joinpath("uv.lock").touch()
|
|
58
|
+
out = capture_cmd_output("fast deps --dry")
|
|
59
|
+
assert (
|
|
60
|
+
out
|
|
61
|
+
== "--> python -m ensurepip && python -m pip install --upgrade pip && python -m pip install -e . --group dev"
|
|
62
|
+
)
|
|
63
|
+
toml_file.touch()
|
|
64
|
+
out = capture_cmd_output("fast deps --dry")
|
|
65
|
+
assert out == "--> uv sync --inexact --active --all-extras --all-groups"
|
|
66
|
+
pdm_lock = tmp_work_dir.joinpath("pdm.lock")
|
|
67
|
+
pdm_lock.touch()
|
|
68
|
+
out = capture_cmd_output("fast deps --dry")
|
|
69
|
+
assert out == "--> uv sync --inexact --active --all-extras --all-groups"
|
|
70
|
+
toml_file.write_text("[tool.pdm]\ndistribution=false")
|
|
71
|
+
out = capture_cmd_output("fast deps --dry")
|
|
72
|
+
assert out == "--> uv sync --inexact --active --all-extras --all-groups"
|
|
73
|
+
monkeypatch.setenv("FASTDEVCLI_SKIP_UV", "1")
|
|
74
|
+
out = capture_cmd_output("fast deps --dry")
|
|
75
|
+
assert out == "--> pdm install --frozen -G :all"
|
|
76
|
+
pdm_lock.unlink()
|
|
77
|
+
out = capture_cmd_output("fast deps --dry")
|
|
78
|
+
assert out == "--> pdm install --frozen -G :all"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.19.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|