fast-dev-cli 0.9.1__tar.gz → 0.9.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 (26) hide show
  1. {fast_dev_cli-0.9.1 → fast_dev_cli-0.9.3}/PKG-INFO +2 -1
  2. fast_dev_cli-0.9.3/fast_dev_cli/__init__.py +1 -0
  3. {fast_dev_cli-0.9.1 → fast_dev_cli-0.9.3}/fast_dev_cli/cli.py +34 -2
  4. {fast_dev_cli-0.9.1 → fast_dev_cli-0.9.3}/pyproject.toml +2 -1
  5. {fast_dev_cli-0.9.1 → fast_dev_cli-0.9.3}/tests/test_lint.py +32 -0
  6. fast_dev_cli-0.9.1/fast_dev_cli/__init__.py +0 -1
  7. {fast_dev_cli-0.9.1 → fast_dev_cli-0.9.3}/LICENSE +0 -0
  8. {fast_dev_cli-0.9.1 → fast_dev_cli-0.9.3}/README.md +0 -0
  9. {fast_dev_cli-0.9.1 → fast_dev_cli-0.9.3}/fast_dev_cli/__main__.py +0 -0
  10. {fast_dev_cli-0.9.1 → fast_dev_cli-0.9.3}/fast_dev_cli/py.typed +0 -0
  11. {fast_dev_cli-0.9.1 → fast_dev_cli-0.9.3}/pdm_build.py +0 -0
  12. {fast_dev_cli-0.9.1 → fast_dev_cli-0.9.3}/scripts/check.sh +0 -0
  13. {fast_dev_cli-0.9.1 → fast_dev_cli-0.9.3}/scripts/format.sh +0 -0
  14. {fast_dev_cli-0.9.1 → fast_dev_cli-0.9.3}/scripts/test.sh +0 -0
  15. {fast_dev_cli-0.9.1 → fast_dev_cli-0.9.3}/tests/__init__.py +0 -0
  16. {fast_dev_cli-0.9.1 → fast_dev_cli-0.9.3}/tests/conftest.py +0 -0
  17. {fast_dev_cli-0.9.1 → fast_dev_cli-0.9.3}/tests/test_bump.py +0 -0
  18. {fast_dev_cli-0.9.1 → fast_dev_cli-0.9.3}/tests/test_fast_test.py +0 -0
  19. {fast_dev_cli-0.9.1 → fast_dev_cli-0.9.3}/tests/test_functions.py +0 -0
  20. {fast_dev_cli-0.9.1 → fast_dev_cli-0.9.3}/tests/test_runserver.py +0 -0
  21. {fast_dev_cli-0.9.1 → fast_dev_cli-0.9.3}/tests/test_sync.py +0 -0
  22. {fast_dev_cli-0.9.1 → fast_dev_cli-0.9.3}/tests/test_tag.py +0 -0
  23. {fast_dev_cli-0.9.1 → fast_dev_cli-0.9.3}/tests/test_upgrade.py +0 -0
  24. {fast_dev_cli-0.9.1 → fast_dev_cli-0.9.3}/tests/test_upload.py +0 -0
  25. {fast_dev_cli-0.9.1 → fast_dev_cli-0.9.3}/tests/test_version.py +0 -0
  26. {fast_dev_cli-0.9.1 → fast_dev_cli-0.9.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.9.1
3
+ Version: 0.9.3
4
4
  Summary: Python project development tool.
5
5
  Author-Email: Waket Zheng <waketzheng@gmail.com>>
6
6
  Classifier: Development Status :: 4 - Beta
@@ -21,6 +21,7 @@ Classifier: License :: OSI Approved :: MIT License
21
21
  Project-URL: Homepage, https://github.com/waketzheng/fast-dev-cli
22
22
  Requires-Python: <4,>=3.10
23
23
  Requires-Dist: typer<0.13,>=0.12.3
24
+ Requires-Dist: tomli<3,>=2.0.1; python_version < "3.11"
24
25
  Requires-Dist: coverage<8,>=7.5.1
25
26
  Requires-Dist: ruff<0.6,>=0.4.4
26
27
  Requires-Dist: mypy<2,>=1.10.0
@@ -0,0 +1 @@
1
+ __version__ = "0.9.3"
@@ -23,9 +23,12 @@ except ImportError: # pragma: no cover
23
23
  if sys.version_info >= (3, 11):
24
24
  from enum import StrEnum
25
25
  from typing import Annotated, Self
26
+
27
+ import tomllib
26
28
  else: # pragma: no cover
27
29
  from enum import Enum
28
30
 
31
+ import tomli as tomllib
29
32
  from typing_extensions import Annotated, Self
30
33
 
31
34
  class StrEnum(str, Enum):
@@ -92,7 +95,9 @@ def get_current_version(
92
95
  cmd = ["poetry", "version", "-s"]
93
96
  if verbose:
94
97
  echo(f"--> {' '.join(cmd)}")
95
- return capture_cmd_output(cmd).strip().splitlines()[-1]
98
+ if out := capture_cmd_output(cmd).strip():
99
+ out = out.splitlines()[-1].strip().split()[-1]
100
+ return out
96
101
 
97
102
 
98
103
  def _ensure_bool(value: bool | OptionInfo) -> bool:
@@ -147,12 +152,37 @@ class BumpUp(DryRun):
147
152
 
148
153
  @staticmethod
149
154
  def parse_filename() -> str:
155
+ toml_text = Project.load_toml_text()
150
156
  if not Project.manage_by_poetry():
151
157
  # version = { source = "file", path = "fast_dev_cli/cli.py" }
152
- for line in Project.load_toml_text().splitlines():
158
+ for line in toml_text.splitlines():
153
159
  if not line.startswith("version = "):
154
160
  continue
155
161
  return line.split('path = "', 1)[-1].split('"')[0]
162
+ context = tomllib.loads(toml_text)
163
+ try:
164
+ version_value = context["tool"]["poetry"]["version"]
165
+ except KeyError:
166
+ return TOML_FILE
167
+ if version_value == "0":
168
+ try:
169
+ package_item = context["tool"]["poetry"]["packages"]
170
+ except KeyError:
171
+ packages = []
172
+ else:
173
+ packages = [j for i in package_item if (j := i.get("include"))]
174
+ # In case of managed by `poetry-version-plugin`
175
+ cwd = Path.cwd()
176
+ pattern = re.compile(r"__version__\s*=\s*['\"]")
177
+ ds = [cwd / i for i in packages] + [cwd / cwd.name.replace("-", "_"), cwd]
178
+ for d in ds:
179
+ if (init_file := d / "__init__.py").exists():
180
+ if pattern.search(init_file.read_text()):
181
+ break
182
+ else:
183
+ raise ParseError("Version file not found! Where are you now?")
184
+ return init_file.relative_to(cwd).as_posix()
185
+
156
186
  return TOML_FILE
157
187
 
158
188
  def get_part(self, s: str) -> str:
@@ -531,6 +561,8 @@ class LintCode(DryRun):
531
561
  if load_bool("SKIP_MYPY"):
532
562
  # Sometimes mypy is too slow
533
563
  tools = tools[:-1]
564
+ elif load_bool("IGNORE_MISSING_IMPORTS"):
565
+ tools[-1] += " --ignore-missing-imports"
534
566
  lint_them = " && ".join("{0}{%d} {1}" % i for i in range(2, len(tools) + 2))
535
567
  prefix = ""
536
568
  should_run_by_tool = False
@@ -32,13 +32,14 @@ classifiers = [
32
32
  ]
33
33
  dependencies = [
34
34
  "typer>=0.12.3,<0.13",
35
+ "tomli>=2.0.1,<3; python_version < '3.11'",
35
36
  "coverage >=7.5.1,<8",
36
37
  "ruff >=0.4.4,<0.6",
37
38
  "mypy >=1.10.0,<2",
38
39
  "bumpversion2 >=1.4.0,<2",
39
40
  "pytest >=8.2.0,<9",
40
41
  ]
41
- version = "0.9.1"
42
+ version = "0.9.3"
42
43
 
43
44
  [project.urls]
44
45
  Homepage = "https://github.com/waketzheng/fast-dev-cli"
@@ -25,6 +25,21 @@ def mock_skip_mypy(monkeypatch):
25
25
  monkeypatch.setenv("SKIP_MYPY", "1")
26
26
 
27
27
 
28
+ @pytest.fixture
29
+ def mock_skip_mypy_0(monkeypatch):
30
+ monkeypatch.setenv("SKIP_MYPY", "0")
31
+
32
+
33
+ @pytest.fixture
34
+ def mock_ignore_missing_imports(monkeypatch):
35
+ monkeypatch.setenv("IGNORE_MISSING_IMPORTS", "1")
36
+
37
+
38
+ @pytest.fixture
39
+ def mock_ignore_missing_imports_0(monkeypatch):
40
+ monkeypatch.setenv("IGNORE_MISSING_IMPORTS", "0")
41
+
42
+
28
43
  SEP = " && "
29
44
  LINT_CMD = "ruff format . && ruff check --extend-select=I --fix . && mypy ."
30
45
  CHECK_CMD = "ruff format --check . && ruff check --extend-select=I . && mypy ."
@@ -112,6 +127,23 @@ def test_skip_mypy(mock_skip_mypy, mocker):
112
127
  assert LintCode(".").gen() == SEP.join(i for i in cmds if not i.startswith("mypy"))
113
128
 
114
129
 
130
+ def test_skip_mypy_0(mock_skip_mypy_0, mocker):
131
+ mocker.patch("fast_dev_cli.cli.is_venv", return_value=True)
132
+ assert LintCode(".").gen() == LINT_CMD
133
+
134
+
135
+ def test_ignore_missing_imports(mock_ignore_missing_imports, mocker):
136
+ mocker.patch("fast_dev_cli.cli.is_venv", return_value=True)
137
+ assert LintCode(".").gen() == LINT_CMD.replace(
138
+ "mypy ", "mypy --ignore-missing-imports "
139
+ )
140
+
141
+
142
+ def test_ignore_missing_imports_0(mock_ignore_missing_imports_0, mocker):
143
+ mocker.patch("fast_dev_cli.cli.is_venv", return_value=True)
144
+ assert LintCode(".").gen() == LINT_CMD
145
+
146
+
115
147
  def test_not_in_root(mocker):
116
148
  mocker.patch("fast_dev_cli.cli.is_venv", return_value=True)
117
149
  root = Path(__file__).parent.parent
@@ -1 +0,0 @@
1
- __version__ = "0.9.1"
File without changes
File without changes
File without changes