fast-dev-cli 0.11.1__tar.gz → 0.11.3__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 (29) hide show
  1. {fast_dev_cli-0.11.1 → fast_dev_cli-0.11.3}/PKG-INFO +10 -10
  2. {fast_dev_cli-0.11.1 → fast_dev_cli-0.11.3}/README.md +8 -8
  3. fast_dev_cli-0.11.3/fast_dev_cli/__init__.py +1 -0
  4. {fast_dev_cli-0.11.1 → fast_dev_cli-0.11.3}/fast_dev_cli/cli.py +18 -6
  5. {fast_dev_cli-0.11.1 → fast_dev_cli-0.11.3}/pyproject.toml +2 -2
  6. fast_dev_cli-0.11.3/scripts/check.py +29 -0
  7. fast_dev_cli-0.11.3/scripts/format.py +13 -0
  8. {fast_dev_cli-0.11.1 → fast_dev_cli-0.11.3}/tests/test_bump.py +14 -1
  9. fast_dev_cli-0.11.1/fast_dev_cli/__init__.py +0 -1
  10. fast_dev_cli-0.11.1/scripts/check.py +0 -20
  11. fast_dev_cli-0.11.1/scripts/format.py +0 -15
  12. {fast_dev_cli-0.11.1 → fast_dev_cli-0.11.3}/LICENSE +0 -0
  13. {fast_dev_cli-0.11.1 → fast_dev_cli-0.11.3}/fast_dev_cli/__main__.py +0 -0
  14. {fast_dev_cli-0.11.1 → fast_dev_cli-0.11.3}/fast_dev_cli/py.typed +0 -0
  15. {fast_dev_cli-0.11.1 → fast_dev_cli-0.11.3}/pdm_build.py +0 -0
  16. {fast_dev_cli-0.11.1 → fast_dev_cli-0.11.3}/scripts/test.py +0 -0
  17. {fast_dev_cli-0.11.1 → fast_dev_cli-0.11.3}/tests/__init__.py +0 -0
  18. {fast_dev_cli-0.11.1 → fast_dev_cli-0.11.3}/tests/conftest.py +0 -0
  19. {fast_dev_cli-0.11.1 → fast_dev_cli-0.11.3}/tests/test_fast_test.py +0 -0
  20. {fast_dev_cli-0.11.1 → fast_dev_cli-0.11.3}/tests/test_functions.py +0 -0
  21. {fast_dev_cli-0.11.1 → fast_dev_cli-0.11.3}/tests/test_lint.py +0 -0
  22. {fast_dev_cli-0.11.1 → fast_dev_cli-0.11.3}/tests/test_poetry_version_plugin.py +0 -0
  23. {fast_dev_cli-0.11.1 → fast_dev_cli-0.11.3}/tests/test_runserver.py +0 -0
  24. {fast_dev_cli-0.11.1 → fast_dev_cli-0.11.3}/tests/test_sync.py +0 -0
  25. {fast_dev_cli-0.11.1 → fast_dev_cli-0.11.3}/tests/test_tag.py +0 -0
  26. {fast_dev_cli-0.11.1 → fast_dev_cli-0.11.3}/tests/test_upgrade.py +0 -0
  27. {fast_dev_cli-0.11.1 → fast_dev_cli-0.11.3}/tests/test_upload.py +0 -0
  28. {fast_dev_cli-0.11.1 → fast_dev_cli-0.11.3}/tests/test_version.py +0 -0
  29. {fast_dev_cli-0.11.1 → fast_dev_cli-0.11.3}/tests/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fast-dev-cli
3
- Version: 0.11.1
3
+ Version: 0.11.3
4
4
  Summary: Python project development tool.
5
5
  Author-Email: Waket Zheng <waketzheng@gmail.com>>
6
6
  Classifier: Development Status :: 4 - Beta
@@ -26,7 +26,7 @@ Requires-Dist: tomli<3,>=2.0.1; python_version < "3.11"
26
26
  Requires-Dist: coverage<8,>=7.5.1
27
27
  Requires-Dist: ruff<0.8,>=0.4.4
28
28
  Requires-Dist: mypy<2,>=1.10.0
29
- Requires-Dist: bumpversion2<2,>=1.4.2
29
+ Requires-Dist: bumpversion2<2,>=1.4.3
30
30
  Requires-Dist: pytest<9,>=8.2.0
31
31
  Provides-Extra: all
32
32
  Requires-Dist: ipython<9,>=8.24.0; extra == "all"
@@ -41,10 +41,10 @@ Description-Content-Type: text/markdown
41
41
  </p>
42
42
  <p align="center">
43
43
  <a href="https://pypi.org/project/fast-dev-cli" target="_blank">
44
- <img src="https://img.shields.io/pypi/v/fast-dev-cli?color=%2334D058&label=pypi%20package" alt="Package version">
44
+ <img src="https://img.shields.io/pypi/pyversions/fast-dev-cli.svg" alt="Supported Python versions">
45
45
  </a>
46
46
  <a href="https://pypi.org/project/fast-dev-cli" target="_blank">
47
- <img src="https://img.shields.io/pypi/pyversions/fast-dev-cli.svg" alt="Supported Python versions">
47
+ <img src="https://img.shields.io/pypi/v/fast-dev-cli?color=%2334D058&label=pypi%20package" alt="Package version">
48
48
  </a>
49
49
  <a href="https://github.com/waketzheng/fast-dev-cli/actions?query=workflow:ci" target="_blank">
50
50
  <img src="https://github.com/waketzheng/fast-dev-cli/workflows/ci/badge.svg" alt="GithubActionResult">
@@ -52,14 +52,14 @@ Description-Content-Type: text/markdown
52
52
  <a href="https://coveralls.io/github/waketzheng/fast-dev-cli?branch=main" target="_blank">
53
53
  <img src="https://coveralls.io/repos/github/waketzheng/fast-dev-cli/badge.svg?branch=main" alt="Coverage Status">
54
54
  </a>
55
- <a href="https://github.com/astral-sh/ruff" target="_blank">
56
- <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff">
57
- </a>
58
55
  <a href="https://github.com/python/mypy" target="_blank">
59
- <img src="https://img.shields.io/badge/mypy-100%25-green.svg" alt="Mypy Coverage">
56
+ <img src="https://img.shields.io/badge/mypy-100%25-brightgreen.svg" alt="Mypy Coverage">
60
57
  </a>
61
58
  <a href="https://github.com/PyCQA/bandit" target="_blank">
62
- <img src="https://img.shields.io/badge/security-bandit-yellow.svg" alt="security: bandit">
59
+ <img src="https://img.shields.io/badge/security-bandit-orange.svg" alt="security: bandit">
60
+ </a>
61
+ <a href="https://github.com/astral-sh/ruff" target="_blank">
62
+ <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff">
63
63
  </a>
64
64
  </p>
65
65
 
@@ -88,7 +88,7 @@ pip install fast-dev-cli
88
88
 
89
89
  - Lint py code:
90
90
  ```bash
91
- fast lint /path/to/file-or-directory
91
+ fast lint [/path/to/file-or-directory]
92
92
  ```
93
93
  - Check only
94
94
  ```bash
@@ -6,10 +6,10 @@
6
6
  </p>
7
7
  <p align="center">
8
8
  <a href="https://pypi.org/project/fast-dev-cli" target="_blank">
9
- <img src="https://img.shields.io/pypi/v/fast-dev-cli?color=%2334D058&label=pypi%20package" alt="Package version">
9
+ <img src="https://img.shields.io/pypi/pyversions/fast-dev-cli.svg" alt="Supported Python versions">
10
10
  </a>
11
11
  <a href="https://pypi.org/project/fast-dev-cli" target="_blank">
12
- <img src="https://img.shields.io/pypi/pyversions/fast-dev-cli.svg" alt="Supported Python versions">
12
+ <img src="https://img.shields.io/pypi/v/fast-dev-cli?color=%2334D058&label=pypi%20package" alt="Package version">
13
13
  </a>
14
14
  <a href="https://github.com/waketzheng/fast-dev-cli/actions?query=workflow:ci" target="_blank">
15
15
  <img src="https://github.com/waketzheng/fast-dev-cli/workflows/ci/badge.svg" alt="GithubActionResult">
@@ -17,14 +17,14 @@
17
17
  <a href="https://coveralls.io/github/waketzheng/fast-dev-cli?branch=main" target="_blank">
18
18
  <img src="https://coveralls.io/repos/github/waketzheng/fast-dev-cli/badge.svg?branch=main" alt="Coverage Status">
19
19
  </a>
20
- <a href="https://github.com/astral-sh/ruff" target="_blank">
21
- <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff">
22
- </a>
23
20
  <a href="https://github.com/python/mypy" target="_blank">
24
- <img src="https://img.shields.io/badge/mypy-100%25-green.svg" alt="Mypy Coverage">
21
+ <img src="https://img.shields.io/badge/mypy-100%25-brightgreen.svg" alt="Mypy Coverage">
25
22
  </a>
26
23
  <a href="https://github.com/PyCQA/bandit" target="_blank">
27
- <img src="https://img.shields.io/badge/security-bandit-yellow.svg" alt="security: bandit">
24
+ <img src="https://img.shields.io/badge/security-bandit-orange.svg" alt="security: bandit">
25
+ </a>
26
+ <a href="https://github.com/astral-sh/ruff" target="_blank">
27
+ <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff">
28
28
  </a>
29
29
  </p>
30
30
 
@@ -53,7 +53,7 @@ pip install fast-dev-cli
53
53
 
54
54
  - Lint py code:
55
55
  ```bash
56
- fast lint /path/to/file-or-directory
56
+ fast lint [/path/to/file-or-directory]
57
57
  ```
58
58
  - Check only
59
59
  ```bash
@@ -0,0 +1 @@
1
+ __version__ = "0.11.3"
@@ -213,16 +213,28 @@ class BumpUp(DryRun):
213
213
  @staticmethod
214
214
  def parse_filename() -> str:
215
215
  toml_text = Project.load_toml_text()
216
- if not Project.manage_by_poetry():
217
- # version = { source = "file", path = "fast_dev_cli/cli.py" }
218
- for line in toml_text.splitlines():
219
- if not line.startswith("version = "):
220
- continue
221
- return line.split('path = "', 1)[-1].split('"')[0]
222
216
  context = tomllib.loads(toml_text)
217
+ try:
218
+ ver = context["project"]["version"]
219
+ except KeyError:
220
+ pass
221
+ else:
222
+ if isinstance(ver, str) and re.match(r"\d+\.\d+\.\d+", ver):
223
+ return TOML_FILE
223
224
  try:
224
225
  version_value = context["tool"]["poetry"]["version"]
225
226
  except KeyError:
227
+ if not Project.manage_by_poetry():
228
+ # version = { source = "file", path = "fast_dev_cli/__init__.py" }
229
+ v_key = "version = "
230
+ p_key = 'path = "'
231
+ for line in toml_text.splitlines():
232
+ if not line.startswith(v_key):
233
+ continue
234
+ if p_key in (value := line.split(v_key, 1)[-1].split("#")[0]):
235
+ filename = value.split(p_key, 1)[-1].split('"')[0]
236
+ if Project.get_work_dir().joinpath(filename).exists():
237
+ return filename
226
238
  return TOML_FILE
227
239
  if version_value in ("0", "0.0.0"):
228
240
  try:
@@ -37,10 +37,10 @@ dependencies = [
37
37
  "coverage >=7.5.1,<8",
38
38
  "ruff >=0.4.4,<0.8",
39
39
  "mypy >=1.10.0,<2",
40
- "bumpversion2 >=1.4.2,<2",
40
+ "bumpversion2 >=1.4.3,<2",
41
41
  "pytest >=8.2.0,<9",
42
42
  ]
43
- version = "0.11.1"
43
+ version = "0.11.3"
44
44
 
45
45
  [project.urls]
46
46
  Homepage = "https://github.com/waketzheng/fast-dev-cli"
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding:utf-8 -*-
3
+ import os
4
+ import sys
5
+
6
+ TOOL = ("pdm", "poetry", "uv")[0]
7
+ parent = os.path.abspath(os.path.dirname(__file__))
8
+ work_dir = os.path.dirname(parent)
9
+ if os.getcwd() != work_dir:
10
+ os.chdir(work_dir)
11
+
12
+
13
+ def run_and_echo(cmd, tool=TOOL, verbose=True):
14
+ # type: (str, str, bool) -> int
15
+ if tool:
16
+ cmd = tool + " run " + cmd
17
+ if verbose:
18
+ print("--> " + cmd)
19
+ return os.system(cmd)
20
+
21
+
22
+ if run_and_echo("fast check", verbose=False) != 0:
23
+ print("\033[1m Please run './scripts/format.py' to auto-fix style issues \033[0m")
24
+ sys.exit(1)
25
+
26
+ package_name = os.path.basename(work_dir).replace("-", "_").replace(" ", "_")
27
+ if run_and_echo("bandit -r {}".format(package_name)) != 0:
28
+ sys.exit(1)
29
+ print("Done. ✨ 🍰 ✨")
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding:utf-8 -*-
3
+ import os
4
+ import sys
5
+
6
+ parent = os.path.abspath(os.path.dirname(__file__))
7
+ work_dir = os.path.dirname(parent)
8
+ if os.getcwd() != work_dir:
9
+ os.chdir(work_dir)
10
+
11
+ cmd = "pdm run fast lint --skip-mypy"
12
+ if os.system(cmd) != 0:
13
+ sys.exit(1)
@@ -1,3 +1,4 @@
1
+ import os
1
2
  import subprocess
2
3
  from contextlib import redirect_stdout
3
4
  from io import StringIO
@@ -166,5 +167,17 @@ def test_bump_with_emoji(mocker, tmp_path, monkeypatch):
166
167
  subprocess.run(["poetry", "run", "pip", "install", "bumpversion2"])
167
168
  subprocess.run(["fast", "bump", "patch", "--commit"])
168
169
  out = capture_cmd_output(["git", "log"])
169
- new_commit = "⬆️ Bump version: 0.1.0 → 0.1.1"
170
+ new_commit = "⬆️ Bump version: 0.1.0 → 0.1.1"
170
171
  assert new_commit in out
172
+
173
+
174
+ def test_bump_with_uv(tmp_path):
175
+ project_dir = tmp_path / "helloworld"
176
+ project_dir.mkdir()
177
+ with chdir(project_dir):
178
+ subprocess.run(["uv", "init"])
179
+ command = BumpUp(part="patch", commit=False).gen()
180
+ assert "pyproject.toml" in command
181
+ Path(TOML_FILE).write_text("[project]" + os.linesep + 'version = "0.1.0"')
182
+ command = BumpUp(part="patch", commit=True).gen()
183
+ assert TOML_FILE in command
@@ -1 +0,0 @@
1
- __version__ = "0.11.1"
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding:utf-8 -*-
3
- import os
4
- import sys
5
-
6
- parent = os.path.abspath(os.path.dirname(__file__))
7
- work_dir = os.path.dirname(parent)
8
- if os.getcwd() != work_dir:
9
- os.chdir(work_dir)
10
-
11
- if os.system("pdm run fast check") != 0:
12
- print("\033[1m Please run './scripts/format.py' to auto-fix style issues \033[0m")
13
- sys.exit(1)
14
-
15
- package_name = os.path.basename(work_dir).replace("-", "_")
16
- cmd = "pdm run bandit -r {}".format(package_name)
17
- print("-->", cmd)
18
- if os.system(cmd) != 0:
19
- sys.exit(1)
20
- print("Done. ✨ 🍰 ✨")
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding:utf-8 -*-
3
- import os
4
- import shlex
5
- import subprocess
6
- import sys
7
- from pathlib import Path
8
-
9
- work_dir = Path(__file__).parent.resolve().parent
10
- if Path.cwd() != work_dir:
11
- os.chdir(str(work_dir))
12
-
13
- cmd = "pdm run fast lint"
14
- r = subprocess.run(shlex.split(cmd), env=dict(os.environ, SKIP_MYPY="1"))
15
- sys.exit(None if r.returncode == 0 else 1)
File without changes