Skip to content

Commit

Permalink
fix: cache issue with imports
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Sep 27, 2024
1 parent 00da841 commit b5c26f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions ape_vyper/compiler/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def get_imports(
project: Optional[ProjectManager] = None,
) -> dict[str, list[str]]:
pm = project or self.local_project
imports = self._import_resolver.get_imports(pm, contract_filepaths)
imports = self._import_resolver.get_imports(pm, contract_filepaths, use_cache=False)
return {
f"{get_relative_path(p.absolute(), pm.path)}": [imp.source_id for imp in import_ls]
for p, import_ls in imports.items()
Expand Down Expand Up @@ -250,7 +250,7 @@ def compile(

self.compiler_settings = {**self.compiler_settings, **(settings or {})}
contract_types: list[ContractType] = []
import_map = self._import_resolver.get_imports(pm, contract_filepaths)
import_map = self._import_resolver.get_imports(pm, contract_filepaths, use_cache=False)
config = self.get_config(pm)
version_map = self._get_version_map_from_import_map(
contract_filepaths,
Expand Down Expand Up @@ -377,7 +377,7 @@ def get_version_map(
project: Optional[ProjectManager] = None,
) -> dict[Version, set[Path]]:
pm = project or self.local_project
import_map = self._import_resolver.get_imports(pm, contract_filepaths)
import_map = self._import_resolver.get_imports(pm, contract_filepaths, use_cache=False)
import_map.paths = contract_filepaths
return self._get_version_map_from_import_map(contract_filepaths, import_map, project=pm)

Expand Down
3 changes: 2 additions & 1 deletion ape_vyper/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,10 @@ def get_imports(
self,
project: ProjectManager,
contract_filepaths: Iterable[Path],
use_cache: bool = True,
) -> ImportMap:
paths = list(contract_filepaths)
if project.project_id not in self._projects:
if project.project_id not in self._projects or not use_cache:
self._projects[project.project_id] = ImportMap(project, paths)

return self._get_imports(paths, project)
Expand Down

0 comments on commit b5c26f0

Please sign in to comment.