fast-dev-cli 0.18.6__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.
Files changed (34) hide show
  1. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/PKG-INFO +2 -3
  2. fast_dev_cli-0.19.1/fast_dev_cli/__init__.py +1 -0
  3. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/fast_dev_cli/cli.py +53 -17
  4. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/pyproject.toml +3 -4
  5. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/tests/conftest.py +1 -3
  6. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/tests/test_deps.py +28 -0
  7. fast_dev_cli-0.18.6/fast_dev_cli/__init__.py +0 -1
  8. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/LICENSE +0 -0
  9. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/README.md +0 -0
  10. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/fast_dev_cli/__main__.py +0 -0
  11. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/fast_dev_cli/py.typed +0 -0
  12. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/pdm_build.py +0 -0
  13. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/scripts/check.py +0 -0
  14. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/scripts/deps.py +0 -0
  15. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/scripts/format.py +0 -0
  16. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/scripts/test.py +0 -0
  17. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/tests/__init__.py +0 -0
  18. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/tests/assets/uv-tx.lock +0 -0
  19. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/tests/assets/uv.lock +0 -0
  20. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/tests/test_bump.py +0 -0
  21. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/tests/test_exec.py +0 -0
  22. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/tests/test_fast_test.py +0 -0
  23. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/tests/test_functions.py +0 -0
  24. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/tests/test_help.py +0 -0
  25. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/tests/test_lint.py +0 -0
  26. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/tests/test_poetry_version_plugin.py +0 -0
  27. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/tests/test_pypi.py +0 -0
  28. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/tests/test_runserver.py +0 -0
  29. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/tests/test_sync.py +0 -0
  30. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/tests/test_tag.py +0 -0
  31. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/tests/test_upgrade.py +0 -0
  32. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/tests/test_upload.py +0 -0
  33. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/tests/test_version.py +0 -0
  34. {fast_dev_cli-0.18.6 → fast_dev_cli-0.19.1}/tests/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fast-dev-cli
3
- Version: 0.18.6
3
+ Version: 0.19.1
4
4
  Summary: Python project development tool.
5
5
  Author-Email: Waket Zheng <waketzheng@gmail.com>>
6
6
  Classifier: Development Status :: 4 - Beta
@@ -9,7 +9,6 @@ Classifier: Intended Audience :: Science/Research
9
9
  Classifier: Intended Audience :: System Administrators
10
10
  Classifier: Operating System :: OS Independent
11
11
  Classifier: Programming Language :: Python :: 3 :: Only
12
- Classifier: Programming Language :: Python :: 3.9
13
12
  Classifier: Programming Language :: Python :: 3.10
14
13
  Classifier: Programming Language :: Python :: 3.11
15
14
  Classifier: Programming Language :: Python :: 3.12
@@ -21,7 +20,7 @@ Classifier: Topic :: Software Development
21
20
  Classifier: Typing :: Typed
22
21
  Classifier: License :: OSI Approved :: MIT License
23
22
  Project-URL: Homepage, https://github.com/waketzheng/fast-dev-cli
24
- Requires-Python: >=3.9
23
+ Requires-Python: >=3.10
25
24
  Requires-Dist: typer-slim<1,>=0.12.3
26
25
  Requires-Dist: tomli<3,>=2.0.1; python_version < "3.11"
27
26
  Requires-Dist: emoji>=2.12.1
@@ -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["poetry", "pdm", "uv"]
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 "poetry" in backend:
665
- cls._tool = "poetry"
666
- return cls._tool
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
- uv_lock_exists = Path(work_dir, "uv.lock").exists()
669
- if "pdm" in backend:
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
- elif uv_lock_exists:
677
- cls._tool = "uv"
678
- return cls._tool
679
- for name in get_args(ToolName):
680
- if f"[tool.{name}]" in text:
681
- cls._tool = cast(ToolName, name)
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"
@@ -1282,7 +1318,7 @@ class Sync(DryRun):
1282
1318
  ensure_pip = ""
1283
1319
  if not UpgradeDependencies.should_with_dev():
1284
1320
  export_cmd = export_cmd.replace(" --with=dev", "")
1285
- if extras and isinstance(extras, (str, list)):
1321
+ if extras and isinstance(extras, str | list):
1286
1322
  export_cmd += f" --{extras=}".replace("'", '"')
1287
1323
  elif check_call(prefix + "python -m pip --version"):
1288
1324
  ensure_pip = ""
@@ -12,7 +12,7 @@ authors = [
12
12
  { name = "Waket Zheng", email = "waketzheng@gmail.com>" },
13
13
  ]
14
14
  readme = "README.md"
15
- requires-python = ">=3.9"
15
+ requires-python = ">=3.10"
16
16
  classifiers = [
17
17
  "Development Status :: 4 - Beta",
18
18
  "Intended Audience :: Developers",
@@ -20,7 +20,6 @@ classifiers = [
20
20
  "Intended Audience :: System Administrators",
21
21
  "Operating System :: OS Independent",
22
22
  "Programming Language :: Python :: 3 :: Only",
23
- "Programming Language :: Python :: 3.9",
24
23
  "Programming Language :: Python :: 3.10",
25
24
  "Programming Language :: Python :: 3.11",
26
25
  "Programming Language :: Python :: 3.12",
@@ -42,7 +41,7 @@ dependencies = [
42
41
  "bumpversion2 >=1.4.3",
43
42
  "pytest >=8.2.0",
44
43
  ]
45
- version = "0.18.6"
44
+ version = "0.19.1"
46
45
 
47
46
  [project.urls]
48
47
  Homepage = "https://github.com/waketzheng/fast-dev-cli"
@@ -164,7 +163,7 @@ omit = [
164
163
 
165
164
  [tool.mypy]
166
165
  pretty = true
167
- python_version = "3.9"
166
+ python_version = "3.10"
168
167
  ignore_missing_imports = true
169
168
  check_untyped_defs = true
170
169
  warn_unused_ignores = true
@@ -1,4 +1,3 @@
1
- import sys
2
1
  from pathlib import Path
3
2
 
4
3
  import pytest
@@ -59,6 +58,5 @@ def tmp_work_dir(tmp_path):
59
58
  @pytest.fixture
60
59
  def tmp_poetry_project(tmp_work_dir: Path):
61
60
  Path(TOML_FILE).write_text(TOML_CONTENT)
62
- if sys.version_info >= (3, 10):
63
- run_and_echo("poetry config --local virtualenvs.in-project true")
61
+ run_and_echo("poetry config --local virtualenvs.in-project true")
64
62
  yield tmp_work_dir
@@ -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.18.6"
File without changes
File without changes