fast-dev-cli 0.9.3__tar.gz → 0.9.4__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.9.3 → fast_dev_cli-0.9.4}/PKG-INFO +2 -2
  2. fast_dev_cli-0.9.4/fast_dev_cli/__init__.py +1 -0
  3. {fast_dev_cli-0.9.3 → fast_dev_cli-0.9.4}/fast_dev_cli/cli.py +6 -6
  4. {fast_dev_cli-0.9.3 → fast_dev_cli-0.9.4}/pyproject.toml +2 -2
  5. fast_dev_cli-0.9.4/tests/test_poetry_version_plugin.py +62 -0
  6. fast_dev_cli-0.9.3/fast_dev_cli/__init__.py +0 -1
  7. {fast_dev_cli-0.9.3 → fast_dev_cli-0.9.4}/LICENSE +0 -0
  8. {fast_dev_cli-0.9.3 → fast_dev_cli-0.9.4}/README.md +0 -0
  9. {fast_dev_cli-0.9.3 → fast_dev_cli-0.9.4}/fast_dev_cli/__main__.py +0 -0
  10. {fast_dev_cli-0.9.3 → fast_dev_cli-0.9.4}/fast_dev_cli/py.typed +0 -0
  11. {fast_dev_cli-0.9.3 → fast_dev_cli-0.9.4}/pdm_build.py +0 -0
  12. {fast_dev_cli-0.9.3 → fast_dev_cli-0.9.4}/scripts/check.sh +0 -0
  13. {fast_dev_cli-0.9.3 → fast_dev_cli-0.9.4}/scripts/format.sh +0 -0
  14. {fast_dev_cli-0.9.3 → fast_dev_cli-0.9.4}/scripts/test.sh +0 -0
  15. {fast_dev_cli-0.9.3 → fast_dev_cli-0.9.4}/tests/__init__.py +0 -0
  16. {fast_dev_cli-0.9.3 → fast_dev_cli-0.9.4}/tests/conftest.py +0 -0
  17. {fast_dev_cli-0.9.3 → fast_dev_cli-0.9.4}/tests/test_bump.py +0 -0
  18. {fast_dev_cli-0.9.3 → fast_dev_cli-0.9.4}/tests/test_fast_test.py +0 -0
  19. {fast_dev_cli-0.9.3 → fast_dev_cli-0.9.4}/tests/test_functions.py +0 -0
  20. {fast_dev_cli-0.9.3 → fast_dev_cli-0.9.4}/tests/test_lint.py +0 -0
  21. {fast_dev_cli-0.9.3 → fast_dev_cli-0.9.4}/tests/test_runserver.py +0 -0
  22. {fast_dev_cli-0.9.3 → fast_dev_cli-0.9.4}/tests/test_sync.py +0 -0
  23. {fast_dev_cli-0.9.3 → fast_dev_cli-0.9.4}/tests/test_tag.py +0 -0
  24. {fast_dev_cli-0.9.3 → fast_dev_cli-0.9.4}/tests/test_upgrade.py +0 -0
  25. {fast_dev_cli-0.9.3 → fast_dev_cli-0.9.4}/tests/test_upload.py +0 -0
  26. {fast_dev_cli-0.9.3 → fast_dev_cli-0.9.4}/tests/test_version.py +0 -0
  27. {fast_dev_cli-0.9.3 → fast_dev_cli-0.9.4}/tests/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fast-dev-cli
3
- Version: 0.9.3
3
+ Version: 0.9.4
4
4
  Summary: Python project development tool.
5
5
  Author-Email: Waket Zheng <waketzheng@gmail.com>>
6
6
  Classifier: Development Status :: 4 - Beta
@@ -23,7 +23,7 @@ Requires-Python: <4,>=3.10
23
23
  Requires-Dist: typer<0.13,>=0.12.3
24
24
  Requires-Dist: tomli<3,>=2.0.1; python_version < "3.11"
25
25
  Requires-Dist: coverage<8,>=7.5.1
26
- Requires-Dist: ruff<0.6,>=0.4.4
26
+ Requires-Dist: ruff<0.7,>=0.4.4
27
27
  Requires-Dist: mypy<2,>=1.10.0
28
28
  Requires-Dist: bumpversion2<2,>=1.4.0
29
29
  Requires-Dist: pytest<9,>=8.2.0
@@ -0,0 +1 @@
1
+ __version__ = "0.9.4"
@@ -35,10 +35,6 @@ else: # pragma: no cover
35
35
  __str__ = str.__str__
36
36
 
37
37
 
38
- def parse_files(args: list[str] | tuple[str, ...]) -> list[str]:
39
- return [i for i in args if not i.startswith("-")]
40
-
41
-
42
38
  TOML_FILE = "pyproject.toml"
43
39
  cli = typer.Typer()
44
40
 
@@ -181,7 +177,7 @@ class BumpUp(DryRun):
181
177
  break
182
178
  else:
183
179
  raise ParseError("Version file not found! Where are you now?")
184
- return init_file.relative_to(cwd).as_posix()
180
+ return os.path.relpath(init_file, cwd)
185
181
 
186
182
  return TOML_FILE
187
183
 
@@ -585,6 +581,10 @@ class LintCode(DryRun):
585
581
  return self.to_cmd(paths, self.check_only)
586
582
 
587
583
 
584
+ def parse_files(args: list[str] | tuple[str, ...]) -> list[str]:
585
+ return [i for i in args if not i.startswith("-")]
586
+
587
+
588
588
  def lint(files=None, dry=False) -> None:
589
589
  if files is None:
590
590
  files = parse_files(sys.argv[1:])
@@ -668,7 +668,7 @@ def test(dry: bool, ignore_script=False) -> None:
668
668
  root = Project.get_work_dir(cwd=cwd, allow_cwd=True)
669
669
  test_script = root / "scripts" / "test.sh"
670
670
  if not _ensure_bool(ignore_script) and _should_run_test_script(test_script):
671
- cmd = f"sh {test_script.relative_to(root)}"
671
+ cmd = f"sh {os.path.relpath(test_script, root)}"
672
672
  if cwd != root:
673
673
  cmd = f"cd {root} && " + cmd
674
674
  else:
@@ -34,12 +34,12 @@ dependencies = [
34
34
  "typer>=0.12.3,<0.13",
35
35
  "tomli>=2.0.1,<3; python_version < '3.11'",
36
36
  "coverage >=7.5.1,<8",
37
- "ruff >=0.4.4,<0.6",
37
+ "ruff >=0.4.4,<0.7",
38
38
  "mypy >=1.10.0,<2",
39
39
  "bumpversion2 >=1.4.0,<2",
40
40
  "pytest >=8.2.0,<9",
41
41
  ]
42
- version = "0.9.3"
42
+ version = "0.9.4"
43
43
 
44
44
  [project.urls]
45
45
  Homepage = "https://github.com/waketzheng/fast-dev-cli"
@@ -0,0 +1,62 @@
1
+ from pathlib import Path
2
+
3
+ import pytest
4
+
5
+ from fast_dev_cli.cli import (
6
+ TOML_FILE,
7
+ BumpUp,
8
+ ParseError,
9
+ run_and_echo,
10
+ )
11
+
12
+ from .utils import chdir
13
+
14
+ CONF = """
15
+
16
+ [tool.poetry-version-plugin]
17
+ source = "init"
18
+ """
19
+
20
+
21
+ def test_version_plugin(tmp_path: Path) -> None:
22
+ package_path = tmp_path / "helloworld"
23
+ toml_file = package_path / TOML_FILE
24
+ init_file = package_path / package_path.name / "__init__.py"
25
+ a, b = 'version = "0.1.0"', 'version = "0"'
26
+ with chdir(tmp_path):
27
+ run_and_echo(f"poetry new {package_path.name}")
28
+ with chdir(package_path):
29
+ text = toml_file.read_text().replace(a, b)
30
+ toml_file.write_text(text + CONF)
31
+ init_file.write_text('__version__ = "0.0.1"\n')
32
+ assert (
33
+ BumpUp(part="patch", commit=False, dry=True).gen()
34
+ == 'bumpversion --parse "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)" --current-version="0.0.1" patch helloworld/__init__.py --allow-dirty'
35
+ )
36
+ run_and_echo("poetry run fast bump patch")
37
+ assert init_file.read_text() == '__version__ = "0.0.2"\n'
38
+ init_file.unlink()
39
+ with pytest.raises(ParseError, match=r"Version file not found!.*"):
40
+ BumpUp(part="patch", commit=False, dry=True).gen()
41
+
42
+
43
+ def test_version_plugin_include_defined(tmp_path: Path) -> None:
44
+ package_path = tmp_path / "hello world"
45
+ toml_file = package_path / TOML_FILE
46
+ package_name = package_path.name.replace(" ", "_")
47
+ init_file = package_path / package_name / "__init__.py"
48
+ a, b = 'version = "0.1.0"', 'version = "0"'
49
+ b += '\npackages = [{include = "%s"}]' % package_name
50
+ with chdir(tmp_path):
51
+ run_and_echo(f"poetry new '{package_path.name}'")
52
+ with chdir(package_path):
53
+ text = toml_file.read_text().replace(a, b)
54
+ toml_file.write_text(text + CONF)
55
+ run_and_echo(f"mv '{package_path.name}' {package_name}")
56
+ init_file.write_text('__version__ = "0.0.1"\n')
57
+ assert (
58
+ BumpUp(part="patch", commit=False, dry=True).gen()
59
+ == f'bumpversion --parse "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)" --current-version="0.0.1" patch {package_name}/__init__.py --allow-dirty'
60
+ )
61
+ run_and_echo("poetry run fast bump patch")
62
+ assert init_file.read_text() == '__version__ = "0.0.2"\n'
@@ -1 +0,0 @@
1
- __version__ = "0.9.3"
File without changes
File without changes
File without changes