fast-dev-cli 0.19.3__tar.gz → 0.19.5__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.
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/PKG-INFO +7 -11
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/README.md +6 -10
- fast_dev_cli-0.19.5/fast_dev_cli/__init__.py +1 -0
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/fast_dev_cli/cli.py +52 -11
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/pyproject.toml +1 -1
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/tests/conftest.py +2 -5
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/tests/test_lint.py +41 -1
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/tests/test_upgrade.py +20 -16
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/tests/utils.py +18 -13
- fast_dev_cli-0.19.3/fast_dev_cli/__init__.py +0 -1
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/LICENSE +0 -0
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/fast_dev_cli/__main__.py +0 -0
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/fast_dev_cli/py.typed +0 -0
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/pdm_build.py +0 -0
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/scripts/check.py +0 -0
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/scripts/deps.py +0 -0
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/scripts/format.py +0 -0
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/scripts/test.py +0 -0
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/tests/__init__.py +0 -0
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/tests/assets/uv-tx.lock +0 -0
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/tests/assets/uv.lock +0 -0
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/tests/test_bump.py +0 -0
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/tests/test_deps.py +0 -0
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/tests/test_exec.py +0 -0
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/tests/test_fast_test.py +0 -0
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/tests/test_functions.py +0 -0
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/tests/test_help.py +0 -0
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/tests/test_poetry_version_plugin.py +0 -0
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/tests/test_pypi.py +0 -0
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/tests/test_runserver.py +0 -0
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/tests/test_sync.py +0 -0
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/tests/test_tag.py +0 -0
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/tests/test_upload.py +0 -0
- {fast_dev_cli-0.19.3 → fast_dev_cli-0.19.5}/tests/test_version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: fast-dev-cli
|
|
3
|
-
Version: 0.19.
|
|
3
|
+
Version: 0.19.5
|
|
4
4
|
Summary: Python project development tool.
|
|
5
5
|
Author-Email: Waket Zheng <waketzheng@gmail.com>>
|
|
6
6
|
Classifier: Development Status :: 4 - Beta
|
|
@@ -74,7 +74,7 @@ Description-Content-Type: text/markdown
|
|
|
74
74
|
|
|
75
75
|
## Requirements
|
|
76
76
|
|
|
77
|
-
Python 3.
|
|
77
|
+
Python 3.10+
|
|
78
78
|
|
|
79
79
|
## Features
|
|
80
80
|
|
|
@@ -88,7 +88,7 @@ Python 3.9+
|
|
|
88
88
|
```bash
|
|
89
89
|
pip install fast-dev-cli
|
|
90
90
|
```
|
|
91
|
-
*Will install: fast-dev-cli emoji typer
|
|
91
|
+
*Will install: fast-dev-cli emoji typer-slim mypy bumpversion2 pytest coverage*
|
|
92
92
|
|
|
93
93
|
</div>
|
|
94
94
|
|
|
@@ -113,21 +113,17 @@ fast bump <part> --commit # bump version and run `git commit`
|
|
|
113
113
|
```bash
|
|
114
114
|
fast test
|
|
115
115
|
```
|
|
116
|
-
-
|
|
116
|
+
- Install dependencies, support pip/pdm/uv/poetry
|
|
117
117
|
```bash
|
|
118
|
-
fast
|
|
119
|
-
```
|
|
120
|
-
- Upgrade main/dev dependencies to latest version (only for poetry project)
|
|
121
|
-
```bash
|
|
122
|
-
fast upgrade
|
|
118
|
+
fast deps
|
|
123
119
|
```
|
|
124
120
|
- Start a fastapi server in development mode
|
|
125
121
|
```bash
|
|
126
122
|
fast dev
|
|
127
123
|
```
|
|
128
|
-
-
|
|
124
|
+
- Change register of uv.lock to be pypi.org
|
|
129
125
|
```bash
|
|
130
|
-
fast
|
|
126
|
+
fast pypi
|
|
131
127
|
```
|
|
132
128
|
*Note: all command support the `--dry` option*
|
|
133
129
|
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
|
|
40
40
|
## Requirements
|
|
41
41
|
|
|
42
|
-
Python 3.
|
|
42
|
+
Python 3.10+
|
|
43
43
|
|
|
44
44
|
## Features
|
|
45
45
|
|
|
@@ -53,7 +53,7 @@ Python 3.9+
|
|
|
53
53
|
```bash
|
|
54
54
|
pip install fast-dev-cli
|
|
55
55
|
```
|
|
56
|
-
*Will install: fast-dev-cli emoji typer
|
|
56
|
+
*Will install: fast-dev-cli emoji typer-slim mypy bumpversion2 pytest coverage*
|
|
57
57
|
|
|
58
58
|
</div>
|
|
59
59
|
|
|
@@ -78,21 +78,17 @@ fast bump <part> --commit # bump version and run `git commit`
|
|
|
78
78
|
```bash
|
|
79
79
|
fast test
|
|
80
80
|
```
|
|
81
|
-
-
|
|
81
|
+
- Install dependencies, support pip/pdm/uv/poetry
|
|
82
82
|
```bash
|
|
83
|
-
fast
|
|
84
|
-
```
|
|
85
|
-
- Upgrade main/dev dependencies to latest version (only for poetry project)
|
|
86
|
-
```bash
|
|
87
|
-
fast upgrade
|
|
83
|
+
fast deps
|
|
88
84
|
```
|
|
89
85
|
- Start a fastapi server in development mode
|
|
90
86
|
```bash
|
|
91
87
|
fast dev
|
|
92
88
|
```
|
|
93
|
-
-
|
|
89
|
+
- Change register of uv.lock to be pypi.org
|
|
94
90
|
```bash
|
|
95
|
-
fast
|
|
91
|
+
fast pypi
|
|
96
92
|
```
|
|
97
93
|
*Note: all command support the `--dry` option*
|
|
98
94
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.19.5"
|
|
@@ -180,7 +180,7 @@ class Shell:
|
|
|
180
180
|
return (r.stdout or r.stderr or "").strip()
|
|
181
181
|
|
|
182
182
|
def finish(
|
|
183
|
-
self, env: dict[str, str] | None = None, _exit: bool = False, dry=False
|
|
183
|
+
self, env: dict[str, str] | None = None, _exit: bool = False, dry: bool = False
|
|
184
184
|
) -> subprocess.CompletedProcess[str]:
|
|
185
185
|
self.run(verbose=True, dry=True)
|
|
186
186
|
if _ensure_bool(dry):
|
|
@@ -395,7 +395,7 @@ class BumpUp(DryRun):
|
|
|
395
395
|
@staticmethod
|
|
396
396
|
def parse_dynamic_version(
|
|
397
397
|
toml_text: str,
|
|
398
|
-
context: dict,
|
|
398
|
+
context: dict[str, Any],
|
|
399
399
|
work_dir: Path | None = None,
|
|
400
400
|
) -> str | None:
|
|
401
401
|
if work_dir is None:
|
|
@@ -457,7 +457,7 @@ class BumpUp(DryRun):
|
|
|
457
457
|
return TOML_FILE
|
|
458
458
|
|
|
459
459
|
@staticmethod
|
|
460
|
-
def parse_plugin_version(context: dict, package_name: str | None) -> str:
|
|
460
|
+
def parse_plugin_version(context: dict[str, Any], package_name: str | None) -> str:
|
|
461
461
|
try:
|
|
462
462
|
package_item = context["tool"]["poetry"]["packages"]
|
|
463
463
|
except KeyError:
|
|
@@ -761,7 +761,7 @@ class Project:
|
|
|
761
761
|
|
|
762
762
|
@classmethod
|
|
763
763
|
def get_sync_command(
|
|
764
|
-
cls, prod: bool = True, doc: dict | None = None, only_me: bool = False
|
|
764
|
+
cls, prod: bool = True, doc: dict[str, Any] | None = None, only_me: bool = False
|
|
765
765
|
) -> str:
|
|
766
766
|
pdm_i = "pdm install --frozen" + " --prod" * prod
|
|
767
767
|
if cls.is_pdm_project():
|
|
@@ -1058,6 +1058,9 @@ class LintCode(DryRun):
|
|
|
1058
1058
|
dmypy: bool = False,
|
|
1059
1059
|
tool: str = ToolOption.default,
|
|
1060
1060
|
prefix: bool = False,
|
|
1061
|
+
up: bool = False,
|
|
1062
|
+
sim: bool = True,
|
|
1063
|
+
strict: bool = False,
|
|
1061
1064
|
) -> None:
|
|
1062
1065
|
self.args = args
|
|
1063
1066
|
self.check_only = check_only
|
|
@@ -1066,6 +1069,9 @@ class LintCode(DryRun):
|
|
|
1066
1069
|
self._use_dmypy = dmypy
|
|
1067
1070
|
self._tool = tool
|
|
1068
1071
|
self._prefix = prefix
|
|
1072
|
+
self._up = up
|
|
1073
|
+
self._sim = sim
|
|
1074
|
+
self._strict = strict
|
|
1069
1075
|
super().__init__(_exit, dry)
|
|
1070
1076
|
|
|
1071
1077
|
@staticmethod
|
|
@@ -1108,6 +1114,9 @@ class LintCode(DryRun):
|
|
|
1108
1114
|
use_dmypy: bool = False,
|
|
1109
1115
|
tool: str = ToolOption.default,
|
|
1110
1116
|
with_prefix: bool = False,
|
|
1117
|
+
ruff_check_up: bool = False,
|
|
1118
|
+
ruff_check_sim: bool = True,
|
|
1119
|
+
mypy_strict: bool = False,
|
|
1111
1120
|
) -> str:
|
|
1112
1121
|
if paths != "." and all(i.endswith(".html") for i in paths.split()):
|
|
1113
1122
|
return f"prettier -w {paths}"
|
|
@@ -1117,11 +1126,18 @@ class LintCode(DryRun):
|
|
|
1117
1126
|
tools[0] += " --check"
|
|
1118
1127
|
if check_only or load_bool("NO_FIX"):
|
|
1119
1128
|
tools[1] = tools[1].replace(" --fix", "")
|
|
1129
|
+
if ruff_check_up or load_bool("FASTDEVCLI_UP"):
|
|
1130
|
+
tools[1] = tools[1].replace(",SIM", ",SIM,UP")
|
|
1131
|
+
if not ruff_check_sim or load_bool("FASTDEVCLI_NO_SIM"):
|
|
1132
|
+
tools[1] = tools[1].replace(",SIM", "")
|
|
1120
1133
|
if skip_mypy or load_bool("SKIP_MYPY") or load_bool("FASTDEVCLI_NO_MYPY"):
|
|
1121
1134
|
# Sometimes mypy is too slow
|
|
1122
1135
|
tools = tools[:-1]
|
|
1123
|
-
|
|
1124
|
-
|
|
1136
|
+
else:
|
|
1137
|
+
if load_bool("IGNORE_MISSING_IMPORTS"):
|
|
1138
|
+
tools[-1] += " --ignore-missing-imports"
|
|
1139
|
+
if mypy_strict or load_bool("FASTDEVCLI_STRICT"):
|
|
1140
|
+
tools[-1] += " --strict"
|
|
1125
1141
|
lint_them = " && ".join(
|
|
1126
1142
|
"{0}{" + str(i) + "} {1}" for i in range(2, len(tools) + 2)
|
|
1127
1143
|
)
|
|
@@ -1227,6 +1243,9 @@ class LintCode(DryRun):
|
|
|
1227
1243
|
self._use_dmypy,
|
|
1228
1244
|
tool=self._tool,
|
|
1229
1245
|
with_prefix=self._prefix,
|
|
1246
|
+
ruff_check_up=self._up,
|
|
1247
|
+
ruff_check_sim=self._sim,
|
|
1248
|
+
mypy_strict=self._strict,
|
|
1230
1249
|
)
|
|
1231
1250
|
|
|
1232
1251
|
|
|
@@ -1242,6 +1261,9 @@ def lint(
|
|
|
1242
1261
|
dmypy: bool = False,
|
|
1243
1262
|
tool: str = ToolOption.default,
|
|
1244
1263
|
prefix: bool = False,
|
|
1264
|
+
up: bool = False,
|
|
1265
|
+
sim: bool = True,
|
|
1266
|
+
strict: bool = False,
|
|
1245
1267
|
) -> None:
|
|
1246
1268
|
if files is None:
|
|
1247
1269
|
files = parse_files(sys.argv[1:])
|
|
@@ -1255,6 +1277,9 @@ def lint(
|
|
|
1255
1277
|
dmypy=dmypy,
|
|
1256
1278
|
tool=tool,
|
|
1257
1279
|
prefix=prefix,
|
|
1280
|
+
up=up,
|
|
1281
|
+
sim=sim,
|
|
1282
|
+
strict=strict,
|
|
1258
1283
|
).run()
|
|
1259
1284
|
|
|
1260
1285
|
|
|
@@ -1265,6 +1290,9 @@ def check(
|
|
|
1265
1290
|
skip_mypy: bool = False,
|
|
1266
1291
|
dmypy: bool = False,
|
|
1267
1292
|
tool: str = ToolOption.default,
|
|
1293
|
+
up: bool = False,
|
|
1294
|
+
sim: bool = True,
|
|
1295
|
+
strict: bool = False,
|
|
1268
1296
|
) -> None:
|
|
1269
1297
|
LintCode(
|
|
1270
1298
|
files,
|
|
@@ -1275,6 +1303,9 @@ def check(
|
|
|
1275
1303
|
skip_mypy=skip_mypy,
|
|
1276
1304
|
dmypy=dmypy,
|
|
1277
1305
|
tool=tool,
|
|
1306
|
+
up=up,
|
|
1307
|
+
sim=sim,
|
|
1308
|
+
strict=strict,
|
|
1278
1309
|
).run()
|
|
1279
1310
|
|
|
1280
1311
|
|
|
@@ -1294,6 +1325,9 @@ def make_style(
|
|
|
1294
1325
|
),
|
|
1295
1326
|
tool: str = ToolOption,
|
|
1296
1327
|
dry: bool = DryOption,
|
|
1328
|
+
up: bool = Option(False, help="Whether ruff check with --extend-select=UP"),
|
|
1329
|
+
sim: bool = Option(True, help="Whether ruff check with --extend-select=SIM"),
|
|
1330
|
+
strict: bool = Option(False, help="Whether run mypy with --strict"),
|
|
1297
1331
|
) -> None:
|
|
1298
1332
|
"""Run: ruff check/format to reformat code and then mypy to check"""
|
|
1299
1333
|
if getattr(files, "default", files) is None:
|
|
@@ -1305,11 +1339,12 @@ def make_style(
|
|
|
1305
1339
|
bandit = _ensure_bool(bandit)
|
|
1306
1340
|
prefix = _ensure_bool(prefix)
|
|
1307
1341
|
tool = _ensure_str(tool)
|
|
1342
|
+
up = _ensure_bool(up)
|
|
1343
|
+
sim = _ensure_bool(sim)
|
|
1344
|
+
strict = _ensure_bool(strict)
|
|
1308
1345
|
kwargs = {"dry": dry, "skip_mypy": skip, "dmypy": dmypy, "bandit": bandit}
|
|
1309
|
-
if _ensure_bool(check_only)
|
|
1310
|
-
|
|
1311
|
-
else:
|
|
1312
|
-
lint(files, prefix=prefix, tool=tool, **kwargs)
|
|
1346
|
+
run = check if _ensure_bool(check_only) else functools.partial(lint, prefix=prefix)
|
|
1347
|
+
run(files, tool=tool, up=up, sim=sim, strict=strict, **kwargs)
|
|
1313
1348
|
|
|
1314
1349
|
|
|
1315
1350
|
@cli.command(name="check")
|
|
@@ -1317,9 +1352,15 @@ def only_check(
|
|
|
1317
1352
|
bandit: bool = Option(False, "--bandit", help="Run `bandit -r <package_dir>`"),
|
|
1318
1353
|
skip_mypy: bool = Option(False, "--skip-mypy"),
|
|
1319
1354
|
dry: bool = DryOption,
|
|
1355
|
+
up: bool = Option(False, help="Whether ruff check with --extend-select=UP"),
|
|
1356
|
+
sim: bool = Option(True, help="Whether ruff check with --extend-select=SIM"),
|
|
1357
|
+
strict: bool = Option(False, help="Whether run mypy with --strict"),
|
|
1320
1358
|
) -> None:
|
|
1321
1359
|
"""Check code style without reformat"""
|
|
1322
|
-
|
|
1360
|
+
bandit = _ensure_bool(bandit)
|
|
1361
|
+
up = _ensure_bool(up)
|
|
1362
|
+
sim = _ensure_bool(sim)
|
|
1363
|
+
check(dry=dry, bandit=bandit, skip_mypy=_ensure_bool(skip_mypy), up=up, sim=sim)
|
|
1323
1364
|
|
|
1324
1365
|
|
|
1325
1366
|
class Sync(DryRun):
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
2
|
|
|
3
3
|
import pytest
|
|
4
|
-
from asynctor.
|
|
4
|
+
from asynctor.testing import chdir_tmp_fixture
|
|
5
5
|
|
|
6
6
|
from fast_dev_cli.cli import TOML_FILE, run_and_echo
|
|
7
7
|
|
|
@@ -49,10 +49,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
49
49
|
"""
|
|
50
50
|
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
def tmp_work_dir(tmp_path):
|
|
54
|
-
with chdir(tmp_path):
|
|
55
|
-
yield tmp_path
|
|
52
|
+
tmp_work_dir = chdir_tmp_fixture()
|
|
56
53
|
|
|
57
54
|
|
|
58
55
|
@pytest.fixture
|
|
@@ -74,6 +74,43 @@ def test_check(mock_no_dmypy, monkeypatch, mocker):
|
|
|
74
74
|
assert command4 == command
|
|
75
75
|
|
|
76
76
|
|
|
77
|
+
def test_check_up_sim(monkeypatch):
|
|
78
|
+
_test_up_sim(monkeypatch)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def test_lint_up_sim(monkeypatch):
|
|
82
|
+
_test_up_sim(monkeypatch, "lint")
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def _test_up_sim(monkeypatch, command="check"):
|
|
86
|
+
out = capture_cmd_output(f"fast {command} --up --dry")
|
|
87
|
+
assert "--extend-select=I,B,SIM,UP " in out
|
|
88
|
+
out = capture_cmd_output(f"fast {command} --no-sim --up --dry")
|
|
89
|
+
assert "--extend-select=I,B,UP " in out
|
|
90
|
+
out = capture_cmd_output(f"fast {command} --no-sim --dry")
|
|
91
|
+
assert "--extend-select=I,B " in out
|
|
92
|
+
out = capture_cmd_output(f"fast {command} --dry")
|
|
93
|
+
assert "--extend-select=I,B,SIM " in out
|
|
94
|
+
monkeypatch.setenv("FASTDEVCLI_NO_SIM", "1")
|
|
95
|
+
out = capture_cmd_output(f"fast {command} --dry")
|
|
96
|
+
assert "--extend-select=I,B " in out
|
|
97
|
+
monkeypatch.setenv("FASTDEVCLI_NO_SIM", "0")
|
|
98
|
+
out = capture_cmd_output(f"fast {command} --dry")
|
|
99
|
+
assert "--extend-select=I,B,SIM " in out
|
|
100
|
+
monkeypatch.setenv("FASTDEVCLI_UP", "1")
|
|
101
|
+
out = capture_cmd_output(f"fast {command} --dry")
|
|
102
|
+
assert "--extend-select=I,B,SIM,UP " in out
|
|
103
|
+
monkeypatch.setenv("FASTDEVCLI_NO_SIM", "1")
|
|
104
|
+
out = capture_cmd_output(f"fast {command} --dry")
|
|
105
|
+
assert "--extend-select=I,B,UP " in out
|
|
106
|
+
monkeypatch.setenv("FASTDEVCLI_UP", "0")
|
|
107
|
+
out = capture_cmd_output(f"fast {command} --dry")
|
|
108
|
+
assert "--extend-select=I,B " in out
|
|
109
|
+
monkeypatch.setenv("FASTDEVCLI_NO_SIM", "0")
|
|
110
|
+
out = capture_cmd_output(f"fast {command} --dry")
|
|
111
|
+
assert "--extend-select=I,B,SIM " in out
|
|
112
|
+
|
|
113
|
+
|
|
77
114
|
def test_check_bandit(tmp_path):
|
|
78
115
|
package_path = tmp_path / "foo"
|
|
79
116
|
with chdir(tmp_path):
|
|
@@ -125,7 +162,7 @@ def _fast_check():
|
|
|
125
162
|
assert cmd in command
|
|
126
163
|
|
|
127
164
|
|
|
128
|
-
def test_lint_cmd(mock_no_dmypy):
|
|
165
|
+
def test_lint_cmd(mock_no_dmypy, monkeypatch):
|
|
129
166
|
run = "pdm run "
|
|
130
167
|
lint_cmd = f"{run}python fast_dev_cli/cli.py lint"
|
|
131
168
|
command = capture_cmd_output(f"{lint_cmd} . --dry")
|
|
@@ -141,6 +178,9 @@ def test_lint_cmd(mock_no_dmypy):
|
|
|
141
178
|
== capture_cmd_output(f"{lint_cmd}")
|
|
142
179
|
== capture_cmd_output(f"{run}fast lint")
|
|
143
180
|
)
|
|
181
|
+
assert "mypy --strict" in capture_cmd_output("fast lint --strict --dry")
|
|
182
|
+
monkeypatch.setenv("FASTDEVCLI_STRICT", "1")
|
|
183
|
+
assert "mypy --strict" in capture_cmd_output("fast lint --dry")
|
|
144
184
|
|
|
145
185
|
|
|
146
186
|
def test_lint_html():
|
|
@@ -85,24 +85,28 @@ uvicorn = {version = "^0.23.2", platform = "linux", optional = true}
|
|
|
85
85
|
def test_dev_flag(tmp_path: Path):
|
|
86
86
|
assert UpgradeDependencies.should_with_dev() is False
|
|
87
87
|
with prepare_poetry_project(tmp_path) as poetry:
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
_test_dev_flag(poetry)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _test_dev_flag(poetry):
|
|
92
|
+
is_newer_poetry = Project.get_poetry_version(poetry) >= "2.2.0"
|
|
93
|
+
assert not UpgradeDependencies.should_with_dev()
|
|
94
|
+
run_and_echo(f"{poetry} add pytest")
|
|
95
|
+
assert not UpgradeDependencies.should_with_dev()
|
|
96
|
+
run_and_echo(f"{poetry} add --group=dev typer")
|
|
97
|
+
if is_newer_poetry:
|
|
91
98
|
assert not UpgradeDependencies.should_with_dev()
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
99
|
+
else:
|
|
100
|
+
toml_file = Path(TOML_FILE)
|
|
101
|
+
assert UpgradeDependencies.should_with_dev()
|
|
102
|
+
text = toml_file.read_text()
|
|
103
|
+
DevFlag = UpgradeDependencies.DevFlag
|
|
104
|
+
if DevFlag.new in text:
|
|
105
|
+
new_text = text.replace(DevFlag.new, DevFlag.old)
|
|
95
106
|
else:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
DevFlag = UpgradeDependencies.DevFlag
|
|
100
|
-
if DevFlag.new in text:
|
|
101
|
-
new_text = text.replace(DevFlag.new, DevFlag.old)
|
|
102
|
-
else:
|
|
103
|
-
new_text = text.replace(DevFlag.old, DevFlag.new)
|
|
104
|
-
toml_file.write_text(new_text)
|
|
105
|
-
assert UpgradeDependencies.should_with_dev()
|
|
107
|
+
new_text = text.replace(DevFlag.old, DevFlag.new)
|
|
108
|
+
toml_file.write_text(new_text)
|
|
109
|
+
assert UpgradeDependencies.should_with_dev()
|
|
106
110
|
|
|
107
111
|
|
|
108
112
|
def test_parse_item():
|
|
@@ -47,23 +47,28 @@ def temp_file(name: str, text=""):
|
|
|
47
47
|
path.write_text(text)
|
|
48
48
|
else:
|
|
49
49
|
path.touch()
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
try:
|
|
51
|
+
yield
|
|
52
|
+
finally:
|
|
53
|
+
if path.exists():
|
|
54
|
+
path.unlink()
|
|
53
55
|
|
|
54
56
|
|
|
55
57
|
@contextmanager
|
|
56
|
-
def prepare_poetry_project(
|
|
58
|
+
def prepare_poetry_project(work_dir: Path) -> Generator[str]:
|
|
57
59
|
py = "{}.{}".format(*sys.version_info)
|
|
58
60
|
poetry = "poetry"
|
|
59
61
|
if shutil.which(poetry) is None:
|
|
60
62
|
poetry = "uvx " + poetry
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
project = "foo"
|
|
64
|
+
with chdir(work_dir), _new_poetry_project(py, poetry, project):
|
|
65
|
+
yield poetry
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
@contextmanager
|
|
69
|
+
def _new_poetry_project(py: str, poetry: str, project: str) -> Generator[None]:
|
|
70
|
+
Shell.run_by_subprocess(f"{poetry} new {project} --python=^{py}")
|
|
71
|
+
with chdir(project):
|
|
72
|
+
Shell.run_by_subprocess(f"{poetry} config --local virtualenvs.in-project true")
|
|
73
|
+
Shell.run_by_subprocess(f"{poetry} env use {py}")
|
|
74
|
+
yield
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.19.3"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|