fast-dev-cli 0.24.0__tar.gz → 0.24.2__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.24.0 → fast_dev_cli-0.24.2}/PKG-INFO +1 -1
- fast_dev_cli-0.24.2/fast_dev_cli/__init__.py +1 -0
- {fast_dev_cli-0.24.0 → fast_dev_cli-0.24.2}/fast_dev_cli/cli.py +32 -5
- {fast_dev_cli-0.24.0 → fast_dev_cli-0.24.2}/pyproject.toml +1 -1
- fast_dev_cli-0.24.0/fast_dev_cli/__init__.py +0 -1
- {fast_dev_cli-0.24.0 → fast_dev_cli-0.24.2}/LICENSE +0 -0
- {fast_dev_cli-0.24.0 → fast_dev_cli-0.24.2}/README.md +0 -0
- {fast_dev_cli-0.24.0 → fast_dev_cli-0.24.2}/fast_dev_cli/__main__.py +0 -0
- {fast_dev_cli-0.24.0 → fast_dev_cli-0.24.2}/fast_dev_cli/py.typed +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.24.2"
|
|
@@ -111,14 +111,15 @@ def yellow_warn(msg: str) -> None:
|
|
|
111
111
|
secho(msg, fg="yellow")
|
|
112
112
|
|
|
113
113
|
|
|
114
|
-
def load_bool(name: str, default: bool = False) -> bool:
|
|
114
|
+
def load_bool(name: str, default: bool = False, *, verbose: bool = True) -> bool:
|
|
115
115
|
if not (v := os.getenv(name)):
|
|
116
116
|
return default
|
|
117
117
|
if (lower := v.lower()) in ("0", "false", "f", "off", "no", "n"):
|
|
118
118
|
return False
|
|
119
119
|
elif lower in ("1", "true", "t", "on", "yes", "y"):
|
|
120
120
|
return True
|
|
121
|
-
|
|
121
|
+
if verbose:
|
|
122
|
+
secho(f"WARNING: can not convert value({v!r}) of {name} to bool!")
|
|
122
123
|
return default
|
|
123
124
|
|
|
124
125
|
|
|
@@ -1581,19 +1582,39 @@ def upload(
|
|
|
1581
1582
|
|
|
1582
1583
|
|
|
1583
1584
|
def should_use_just() -> bool:
|
|
1584
|
-
if shutil.which("just") is None:
|
|
1585
|
+
if shutil.which("just") is None or load_bool("FASTDEVCLI_IGNORE_JUST_DEV"):
|
|
1585
1586
|
return False
|
|
1586
1587
|
d = Path.cwd()
|
|
1587
1588
|
for _ in range(5):
|
|
1588
1589
|
f = d / "justfile"
|
|
1589
1590
|
if f.exists():
|
|
1590
|
-
|
|
1591
|
-
return any(i.startswith("dev *args:") for i in text.splitlines())
|
|
1591
|
+
return _prefer_just_dev(f)
|
|
1592
1592
|
if d.joinpath("pyproject.toml").exists():
|
|
1593
1593
|
break
|
|
1594
1594
|
return False
|
|
1595
1595
|
|
|
1596
1596
|
|
|
1597
|
+
def _prefer_just_dev(f: Path) -> bool:
|
|
1598
|
+
text = f.read_text(encoding="utf-8")
|
|
1599
|
+
lines = text.splitlines()
|
|
1600
|
+
dev_recipe = "dev *args:"
|
|
1601
|
+
re_import = re.compile(r"import[?]? ")
|
|
1602
|
+
has_import = False
|
|
1603
|
+
for i, line in enumerate(lines):
|
|
1604
|
+
if line.startswith(dev_recipe):
|
|
1605
|
+
# Avoid cycle callback
|
|
1606
|
+
return "fast dev" not in lines[i + 1]
|
|
1607
|
+
elif not has_import and re_import.match(line):
|
|
1608
|
+
has_import = True
|
|
1609
|
+
if has_import:
|
|
1610
|
+
recipes = capture_cmd_output("just --list").splitlines()
|
|
1611
|
+
for recipe in recipes:
|
|
1612
|
+
recipe = recipe.strip()
|
|
1613
|
+
if recipe.startswith(dev_recipe):
|
|
1614
|
+
return "fast dev" not in recipe
|
|
1615
|
+
return False
|
|
1616
|
+
|
|
1617
|
+
|
|
1597
1618
|
def _parse_serve_file(uvicorn, filename: str, cmd: str, args: list) -> str:
|
|
1598
1619
|
if m := re.search(r"(.*):(\d+)$", filename):
|
|
1599
1620
|
h, p = m.group(1), m.group(2)
|
|
@@ -1714,6 +1735,7 @@ class MakeDeps(DryRun):
|
|
|
1714
1735
|
inexact: bool = False,
|
|
1715
1736
|
no_dev: bool = False,
|
|
1716
1737
|
verbose: bool = False,
|
|
1738
|
+
frozen: bool = False,
|
|
1717
1739
|
no_extra: list[str] | None = None,
|
|
1718
1740
|
no_group: list[str] | None = None,
|
|
1719
1741
|
) -> None:
|
|
@@ -1722,6 +1744,7 @@ class MakeDeps(DryRun):
|
|
|
1722
1744
|
self._active = active or load_bool("FASTDEVCLI_DEPS_ACTIVE")
|
|
1723
1745
|
self._inexact = inexact or load_bool("FASTDEVCLI_DEPS_INEXACT")
|
|
1724
1746
|
self._verbose = verbose
|
|
1747
|
+
self._frozen = frozen
|
|
1725
1748
|
self._no_dev = no_dev
|
|
1726
1749
|
self._no_extra = no_extra
|
|
1727
1750
|
self._no_group = no_group
|
|
@@ -1750,6 +1773,8 @@ class MakeDeps(DryRun):
|
|
|
1750
1773
|
cmd += " " + " ".join(f"--no-extra {i}" for i in self._no_extra)
|
|
1751
1774
|
if self._no_group:
|
|
1752
1775
|
cmd += " " + " ".join(f"--no-group {i}" for i in self._no_group)
|
|
1776
|
+
if self._frozen:
|
|
1777
|
+
cmd += " --frozen"
|
|
1753
1778
|
if opts := os.getenv("FASTDEVCLI_DEPS_OPTS"):
|
|
1754
1779
|
cmd += " " + opts.strip()
|
|
1755
1780
|
return cmd
|
|
@@ -1823,6 +1848,7 @@ def make_deps(
|
|
|
1823
1848
|
no_dev: bool = Option(False, "--no-dev"),
|
|
1824
1849
|
no_extra: Annotated[list[str] | None, Option()] = None,
|
|
1825
1850
|
no_group: Annotated[list[str] | None, Option()] = None,
|
|
1851
|
+
frozen: bool = Option(False, "--frozen", "--frozen-lockfile", "--no-lock"),
|
|
1826
1852
|
verbose: bool = Option(False, "--verbose"),
|
|
1827
1853
|
dry: bool = DryOption,
|
|
1828
1854
|
) -> None:
|
|
@@ -1847,6 +1873,7 @@ def make_deps(
|
|
|
1847
1873
|
"inexact": inexact,
|
|
1848
1874
|
"no_dev": no_dev,
|
|
1849
1875
|
"verbose": verbose,
|
|
1876
|
+
"frozen": frozen,
|
|
1850
1877
|
"dry": dry,
|
|
1851
1878
|
}
|
|
1852
1879
|
MakeDeps(tool, prod, no_extra=no_extra, no_group=no_group, **bool_opts).run()
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.24.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|