|
6 | 6 | import itertools |
7 | 7 | import shutil |
8 | 8 | import sys |
9 | | -from pathlib import Path |
10 | 9 | from typing import TYPE_CHECKING |
11 | 10 | from typing import Any |
12 | 11 | from typing import Generator |
|
36 | 35 | from _pytask.tree_util import tree_leaves |
37 | 36 |
|
38 | 37 | if TYPE_CHECKING: |
| 38 | + from pathlib import Path |
39 | 39 | from typing import NoReturn |
40 | 40 |
|
41 | 41 |
|
@@ -64,7 +64,12 @@ def pytask_extend_command_line_interface(cli: click.Group) -> None: |
64 | 64 | @hookimpl |
65 | 65 | def pytask_parse_config(config: dict[str, Any]) -> None: |
66 | 66 | """Parse the configuration.""" |
67 | | - config["exclude"] = to_list(config["exclude"]) + _DEFAULT_EXCLUDE |
| 67 | + config["exclude"] = ( |
| 68 | + to_list(config["exclude"]) |
| 69 | + + _DEFAULT_EXCLUDE |
| 70 | + # Adding the cache folder to the exclude list. |
| 71 | + + [config["root"].joinpath(".pytask", "*").as_posix()] |
| 72 | + ) |
68 | 73 |
|
69 | 74 |
|
70 | 75 | @click.command(cls=ColoredCommand) |
@@ -116,10 +121,9 @@ def clean(**raw_config: Any) -> NoReturn: # noqa: C901, PLR0912 |
116 | 121 | session.hook.pytask_collect(session=session) |
117 | 122 |
|
118 | 123 | known_paths = _collect_all_paths_known_to_pytask(session) |
119 | | - exclude = session.config["exclude"] |
120 | 124 | include_directories = session.config["directories"] |
121 | 125 | unknown_paths = _find_all_unknown_paths( |
122 | | - session, known_paths, exclude, include_directories |
| 126 | + session, known_paths, session.config["exclude"], include_directories |
123 | 127 | ) |
124 | 128 | common_ancestor = find_common_ancestor( |
125 | 129 | *unknown_paths, *session.config["paths"] |
@@ -189,10 +193,6 @@ def _collect_all_paths_known_to_pytask(session: Session) -> set[Path]: |
189 | 193 | known_paths.add(session.config["config"]) |
190 | 194 | known_paths.add(session.config["root"]) |
191 | 195 |
|
192 | | - database_url = session.config["database_url"] |
193 | | - if database_url.drivername == "sqlite" and database_url.database: |
194 | | - known_paths.add(Path(database_url.database)) |
195 | | - |
196 | 196 | # Add files tracked by git. |
197 | 197 | if is_git_installed(): |
198 | 198 | git_root = get_root(session.config["root"]) |
|
0 commit comments