Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions python/prophet/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,25 @@ def cleanup(self) -> None:

if hasattr(self, "stan_fit") and self.stan_fit is not None:
fit_result: cmdstanpy.CmdStanMLE | cmdstanpy.CmdStanMCMC = self.stan_fit
to_remove = (
fit_result.runset.csv_files +
fit_result.runset.diagnostic_files +
fit_result.runset.stdout_files +
fit_result.runset.profile_files
)
to_remove = []

if hasattr(fit_result, "runset"): # 1.x
to_remove = (
fit_result.runset.csv_files # type: ignore
+ fit_result.runset.diagnostic_files # type: ignore
+ fit_result.runset.stdout_files # type: ignore
+ fit_result.runset.profile_files # type: ignore
)
else: # 2.0
for attr in fit_result._FILE_ATTRS: # type: ignore
val = getattr(fit_result, attr)
if val is None:
continue
if isinstance(val, list):
to_remove.extend(val)
else:
to_remove.append(val)

for fpath in to_remove:
if pathlib.Path(fpath).is_file():
pathlib.Path(fpath).unlink()
Expand Down
4 changes: 2 additions & 2 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
requires = [
"setuptools>=64",
"wheel",
"cmdstanpy>=1.3.2,<2",
"cmdstanpy>=1.3.2",
]
build-backend = "setuptools.build_meta"

Expand All @@ -13,7 +13,7 @@ description = "Automatic Forecasting Procedure"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"cmdstanpy>=1.3.2,<2",
"cmdstanpy>=1.3.2",
"numpy>=1.21.6",
"matplotlib>=3.5.3",
"pandas>=1.3.5",
Expand Down
Loading