File tree Expand file tree Collapse file tree
src/usethis/_integrations Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,7 +75,6 @@ def set_config_value(
7575 parent [id_keys [- 1 ]] = value
7676
7777 write_pyproject_toml (pyproject )
78- read_pyproject_toml .cache_clear ()
7978
8079
8180def remove_config_value (id_keys : list [str ], * , missing_ok : bool = False ) -> None :
Original file line number Diff line number Diff line change 1111)
1212
1313
14- @cache
1514def read_pyproject_toml () -> tomlkit .TOMLDocument :
15+ return read_pyproject_toml_from_path (Path .cwd () / "pyproject.toml" )
16+
17+
18+ @cache
19+ def read_pyproject_toml_from_path (path : Path ) -> tomlkit .TOMLDocument :
1620 try :
17- return tomlkit .parse (( Path . cwd () / "pyproject.toml" ) .read_text ())
21+ return tomlkit .parse (path .read_text ())
1822 except FileNotFoundError :
1923 msg = "'pyproject.toml' not found in the current directory."
2024 raise PyProjectTOMLNotFoundError (msg )
@@ -35,5 +39,5 @@ def read_pyproject_dict() -> dict[str, Any]:
3539
3640
3741def write_pyproject_toml (toml_document : tomlkit .TOMLDocument ) -> None :
38- read_pyproject_toml .cache_clear ()
42+ read_pyproject_toml_from_path .cache_clear ()
3943 (Path .cwd () / "pyproject.toml" ).write_text (tomlkit .dumps (toml_document ))
Original file line number Diff line number Diff line change 1+ from usethis ._integrations .pyproject .io import read_pyproject_toml_from_path
12from usethis ._integrations .uv .errors import UVSubprocessFailedError
23from usethis ._subprocess import SubprocessFailedError , call_subprocess
34
@@ -8,6 +9,7 @@ def call_uv_subprocess(args: list[str]) -> str:
89 Raises:
910 UVSubprocessFailedError: If the subprocess fails.
1011 """
12+ read_pyproject_toml_from_path .cache_clear ()
1113 try :
1214 return call_subprocess (["uv" , * args ])
1315 except SubprocessFailedError as err :
You can’t perform that action at this time.
0 commit comments