fast-dev-cli 0.15.0__tar.gz → 0.15.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 (27) hide show
  1. {fast_dev_cli-0.15.0 → fast_dev_cli-0.15.1}/PKG-INFO +2 -2
  2. fast_dev_cli-0.15.1/fast_dev_cli/__init__.py +1 -0
  3. {fast_dev_cli-0.15.0 → fast_dev_cli-0.15.1}/fast_dev_cli/cli.py +23 -13
  4. {fast_dev_cli-0.15.0 → fast_dev_cli-0.15.1}/pyproject.toml +2 -2
  5. {fast_dev_cli-0.15.0 → fast_dev_cli-0.15.1}/tests/conftest.py +8 -3
  6. {fast_dev_cli-0.15.0 → fast_dev_cli-0.15.1}/tests/test_bump.py +63 -0
  7. fast_dev_cli-0.15.0/fast_dev_cli/__init__.py +0 -1
  8. {fast_dev_cli-0.15.0 → fast_dev_cli-0.15.1}/LICENSE +0 -0
  9. {fast_dev_cli-0.15.0 → fast_dev_cli-0.15.1}/README.md +0 -0
  10. {fast_dev_cli-0.15.0 → fast_dev_cli-0.15.1}/fast_dev_cli/__main__.py +0 -0
  11. {fast_dev_cli-0.15.0 → fast_dev_cli-0.15.1}/fast_dev_cli/py.typed +0 -0
  12. {fast_dev_cli-0.15.0 → fast_dev_cli-0.15.1}/pdm_build.py +0 -0
  13. {fast_dev_cli-0.15.0 → fast_dev_cli-0.15.1}/scripts/check.py +0 -0
  14. {fast_dev_cli-0.15.0 → fast_dev_cli-0.15.1}/scripts/format.py +0 -0
  15. {fast_dev_cli-0.15.0 → fast_dev_cli-0.15.1}/scripts/test.py +0 -0
  16. {fast_dev_cli-0.15.0 → fast_dev_cli-0.15.1}/tests/__init__.py +0 -0
  17. {fast_dev_cli-0.15.0 → fast_dev_cli-0.15.1}/tests/test_fast_test.py +0 -0
  18. {fast_dev_cli-0.15.0 → fast_dev_cli-0.15.1}/tests/test_functions.py +0 -0
  19. {fast_dev_cli-0.15.0 → fast_dev_cli-0.15.1}/tests/test_lint.py +0 -0
  20. {fast_dev_cli-0.15.0 → fast_dev_cli-0.15.1}/tests/test_poetry_version_plugin.py +0 -0
  21. {fast_dev_cli-0.15.0 → fast_dev_cli-0.15.1}/tests/test_runserver.py +0 -0
  22. {fast_dev_cli-0.15.0 → fast_dev_cli-0.15.1}/tests/test_sync.py +0 -0
  23. {fast_dev_cli-0.15.0 → fast_dev_cli-0.15.1}/tests/test_tag.py +0 -0
  24. {fast_dev_cli-0.15.0 → fast_dev_cli-0.15.1}/tests/test_upgrade.py +0 -0
  25. {fast_dev_cli-0.15.0 → fast_dev_cli-0.15.1}/tests/test_upload.py +0 -0
  26. {fast_dev_cli-0.15.0 → fast_dev_cli-0.15.1}/tests/test_version.py +0 -0
  27. {fast_dev_cli-0.15.0 → fast_dev_cli-0.15.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.15.0
3
+ Version: 0.15.1
4
4
  Summary: Python project development tool.
5
5
  Author-Email: Waket Zheng <waketzheng@gmail.com>>
6
6
  Classifier: Development Status :: 4 - Beta
@@ -23,12 +23,12 @@ Project-URL: Homepage, https://github.com/waketzheng/fast-dev-cli
23
23
  Requires-Python: >=3.9
24
24
  Requires-Dist: typer<1,>=0.12.3
25
25
  Requires-Dist: emoji<3,>=2.12.1
26
+ Requires-Dist: packaging>=20.5
26
27
  Requires-Dist: tomli<3,>=2.0.1; python_version < "3.11"
27
28
  Requires-Dist: coverage<8,>=7.5.1
28
29
  Requires-Dist: mypy<2,>=1.15.0
29
30
  Requires-Dist: bumpversion2<2,>=1.4.3
30
31
  Requires-Dist: pytest<9,>=8.2.0
31
- Requires-Dist: packaging>=20.5
32
32
  Provides-Extra: include-optional-dependencies
33
33
  Requires-Dist: all; extra == "include-optional-dependencies"
34
34
  Description-Content-Type: text/markdown
@@ -0,0 +1 @@
1
+ __version__ = "0.15.1"
@@ -1,5 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import contextlib
3
4
  import importlib.metadata as importlib_metadata
4
5
  import os
5
6
  import re
@@ -11,7 +12,7 @@ from pathlib import Path
11
12
  from typing import (
12
13
  Any,
13
14
  Literal,
14
- # Optional is required by typers
15
+ # Optional is required by Option generated by typer
15
16
  Optional,
16
17
  cast,
17
18
  get_args,
@@ -127,10 +128,10 @@ def read_version_from_file(
127
128
  invalid = ("0", "0.0.0")
128
129
  for line in toml_text.splitlines():
129
130
  if pattern.match(line):
130
- version = _parse_version(line, pattern)
131
- if version.startswith("{") or version in invalid:
131
+ lib_version = _parse_version(line, pattern)
132
+ if lib_version.startswith("{") or lib_version in invalid:
132
133
  break
133
- return version
134
+ return lib_version
134
135
  if work_dir is None:
135
136
  work_dir = Project.get_work_dir()
136
137
  package_dir = work_dir / package_name
@@ -276,6 +277,16 @@ class BumpUp(DryRun):
276
277
  version_value = context["tool"]["poetry"]["version"]
277
278
  except KeyError:
278
279
  if not Project.manage_by_poetry():
280
+ for tool in ("pdm", "hatch"):
281
+ with contextlib.suppress(KeyError):
282
+ version_path = context["tool"][tool]["version"]["path"]
283
+ if (
284
+ Path(version_path).exists()
285
+ or Project.get_work_dir()
286
+ .joinpath(version_path)
287
+ .exists()
288
+ ):
289
+ return version_path
279
290
  # version = { source = "file", path = "fast_dev_cli/__init__.py" }
280
291
  v_key = "version = "
281
292
  p_key = 'path = "'
@@ -923,23 +934,22 @@ class Sync(DryRun):
923
934
  raise EnvError("There project is not managed by uv/pdm/poetry!")
924
935
  return f"python -m pip install -r {self.filename}"
925
936
  prefix = "" if is_venv() else f"{tool} run "
926
- ensurepip = " {1}python -m ensurepip && {1}python -m pip install -U pip &&"
927
- if tool == "uv":
928
- export_cmd = "uv export --no-hashes --all-extras --frozen"
929
- if check_call(prefix + "python -m pip --version"):
930
- ensurepip = ""
931
- elif tool in ("poetry", "pdm"):
937
+ ensure_pip = " {1}python -m ensurepip && {1}python -m pip install -U pip &&"
938
+ export_cmd = "uv export --no-hashes --all-extras --frozen"
939
+ if tool in ("poetry", "pdm"):
932
940
  export_cmd = f"{tool} export --without-hashes --with=dev"
933
941
  if tool == "poetry":
934
- ensurepip = ""
942
+ ensure_pip = ""
935
943
  if not UpgradeDependencies.should_with_dev():
936
944
  export_cmd = export_cmd.replace(" --with=dev", "")
937
945
  if extras and isinstance(extras, (str, list)):
938
946
  export_cmd += f" --{extras=}".replace("'", '"')
939
947
  elif check_call(prefix + "python -m pip --version"):
940
- ensurepip = ""
948
+ ensure_pip = ""
949
+ elif check_call(prefix + "python -m pip --version"):
950
+ ensure_pip = ""
941
951
  install_cmd = (
942
- f"{{2}} -o {{0}} &&{ensurepip} {{1}}python -m pip install -r {{0}}"
952
+ f"{{2}} -o {{0}} &&{ensure_pip} {{1}}python -m pip install -r {{0}}"
943
953
  )
944
954
  if should_remove and not save:
945
955
  install_cmd += " && rm -f {0}"
@@ -34,14 +34,14 @@ classifiers = [
34
34
  dependencies = [
35
35
  "typer>=0.12.3,<1",
36
36
  "emoji >=2.12.1,<3",
37
+ "packaging>=20.5",
37
38
  "tomli>=2.0.1,<3; python_version < '3.11'",
38
39
  "coverage >=7.5.1,<8",
39
40
  "mypy >=1.15.0,<2",
40
41
  "bumpversion2 >=1.4.3,<2",
41
42
  "pytest >=8.2.0,<9",
42
- "packaging>=20.5",
43
43
  ]
44
- version = "0.15.0"
44
+ version = "0.15.1"
45
45
 
46
46
  [project.urls]
47
47
  Homepage = "https://github.com/waketzheng/fast-dev-cli"
@@ -51,7 +51,12 @@ build-backend = "poetry.core.masonry.api"
51
51
 
52
52
 
53
53
  @pytest.fixture
54
- def tmp_poetry_project(tmp_path: Path):
54
+ def tmp_work_dir(tmp_path):
55
55
  with chdir(tmp_path):
56
- tmp_path.joinpath(TOML_FILE).write_text(TOML_CONTENT)
57
- yield
56
+ yield tmp_path
57
+
58
+
59
+ @pytest.fixture
60
+ def tmp_poetry_project(tmp_work_dir: Path):
61
+ Path(TOML_FILE).write_text(TOML_CONTENT)
62
+ yield tmp_work_dir
@@ -230,3 +230,66 @@ version = "0"
230
230
  from_dir.mkdir()
231
231
  shutil.move(another_dir, from_dir)
232
232
  assert BumpUp.parse_filename() == "py/hello/__init__.py"
233
+
234
+
235
+ PDM_DYNAMIC_VERSION = """
236
+ [tool.pdm.version]
237
+ source = "file"
238
+ path = "app/__init__.py"
239
+ """
240
+
241
+
242
+ def test_pdm_project(tmp_work_dir):
243
+ capture_cmd_output("pdm new my-project --non-interactive")
244
+ with chdir("my-project"):
245
+ toml_file = Path("pyproject.toml")
246
+ content = toml_file.read_text().replace(
247
+ 'version = "0.1.0"', 'dynamic = ["version"]'
248
+ )
249
+ toml_file.write_text(content)
250
+ with toml_file.open("a+") as f:
251
+ f.write(PDM_DYNAMIC_VERSION)
252
+ app = Path("app")
253
+ app.mkdir()
254
+ init_file = app.joinpath("__init__.py")
255
+ init_file.write_text('__version__ = "0.2.0"')
256
+ out = capture_cmd_output("fast bump patch")
257
+ assert str(init_file) in out
258
+ assert "0.2.1" in init_file.read_text()
259
+
260
+
261
+ def test_hatch_project(tmp_work_dir):
262
+ project_name = "httpx"
263
+ Path(project_name).mkdir()
264
+ with chdir(project_name):
265
+ toml_file = Path("pyproject.toml")
266
+ toml_file.write_text("""
267
+ [build-system]
268
+ requires = ["hatchling", "hatch-fancy-pypi-readme"]
269
+ build-backend = "hatchling.build"
270
+
271
+ [project]
272
+ name = "httpx"
273
+ description = "The next generation HTTP client."
274
+ license = "BSD-3-Clause"
275
+ requires-python = ">=3.8"
276
+ authors = [
277
+ { name = "Tom Christie", email = "tom@tomchristie.com" },
278
+ ]
279
+ dependencies = [
280
+ "certifi",
281
+ "httpcore==1.*",
282
+ "anyio",
283
+ "idna",
284
+ ]
285
+ dynamic = ["readme", "version"]
286
+
287
+ [tool.hatch.version]
288
+ path = "httpx/__version__.py"
289
+ """)
290
+ Path(project_name).mkdir()
291
+ Path("httpx/__version__.py").write_text("""
292
+ __title__ = "httpx"
293
+ __description__ = "A next generation HTTP client, for Python 3."
294
+ __version__ = "0.28.1"
295
+ """)
@@ -1 +0,0 @@
1
- __version__ = "0.15.0"
File without changes
File without changes