From 15298553337356311c04259471b07b5bc6b1aece Mon Sep 17 00:00:00 2001 From: Dennis Tai Date: Sun, 24 Mar 2024 17:44:38 -0700 Subject: [PATCH 1/3] Conda exception in setup.py, bump version number if conda, don't precompile models --- orbit/__version__.py | 2 +- orbit/utils/stan.py | 16 ++++------------ setup.py | 14 ++++++++------ 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/orbit/__version__.py b/orbit/__version__.py index f17f00ec..06365df5 100644 --- a/orbit/__version__.py +++ b/orbit/__version__.py @@ -1 +1 @@ -__version__ = "1.1.4.7" +__version__ = "1.1.4.8" diff --git a/orbit/utils/stan.py b/orbit/utils/stan.py index 39a7c912..4f8441c3 100644 --- a/orbit/utils/stan.py +++ b/orbit/utils/stan.py @@ -1,4 +1,3 @@ -from datetime import datetime import json import os import platform @@ -31,12 +30,6 @@ os.environ["Path"] += ";" + os.path.normpath(os.path.expanduser(path_string)) -def get_file_time(path: str): - return datetime.fromtimestamp(os.path.getmtime(path)).replace( - second=0, microsecond=0 - ) - - def get_compiled_stan_model( stan_model_name: str = "", stan_file_path: Optional[str] = None, @@ -78,14 +71,13 @@ def get_compiled_stan_model( ) # Check if exe is older than .stan file. # This behavior is default on CmdStanModel if we don't have to specify the exe_file. - if not os.path.isfile(exe_file) or ( - get_file_time(exe_file) <= get_file_time(stan_file) - ): - force_compile = True + # if not os.path.isfile(exe_file) or ( + # os.path.getmtime(exe_file) <= os.path.getmtime(stan_file) + # ): if not os.path.isfile(exe_file) or force_compile: logger.info(f"Compiling stan model:{stan_file}. ETA 3 - 5 mins.") - sm = CmdStanModel(stan_file=stan_file, force_compile=force_compile) + sm = CmdStanModel(stan_file=stan_file) else: sm = CmdStanModel(stan_file=stan_file, exe_file=exe_file) diff --git a/setup.py b/setup.py index ecfcda8b..95eb0093 100644 --- a/setup.py +++ b/setup.py @@ -2,6 +2,7 @@ import os import platform import shutil +import sys from pathlib import Path from setuptools import find_packages, setup @@ -65,6 +66,7 @@ def install_stan(): Reference from prophet """ from multiprocessing import cpu_count + import cmdstanpy remove_older_cmdstan(CMDSTAN_VERSION) @@ -93,12 +95,12 @@ def build_model(model: str, model_dir: str): def build_stan_models(): - for model in MODELS: - # note: ensure copy target is a directory not a file. - build_model( - model=model, - model_dir=MODEL_SOURCE_DIR, - ) + if "conda" not in sys.prefix.lower(): + for model in MODELS: + build_model( + model=model, + model_dir=MODEL_SOURCE_DIR, + ) class BuildPyCommand(build_py): From 7c255262f515cdf2b182153e9299d9501430d1ca Mon Sep 17 00:00:00 2001 From: edwinnglabs Date: Wed, 27 Mar 2024 22:05:37 -0700 Subject: [PATCH 2/3] update project to release support of python <= 3.8 --- pyproject.toml | 11 ++++------- setup.py | 2 -- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bf140ca1..5c983e40 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.black] line-length = 88 -target-version = ['py38', 'py39'] +target-version = ['py39', 'py310'] include = '\.pyi?$' extend-exclude = ''' # A regex preceded with ^/ will apply only to files and directories @@ -19,11 +19,11 @@ build-backend = "setuptools.build_meta" [project] name = "orbit-ml" authors = [ - {name="Edwin Ng", email="edwinnglabs@gmail.com"}, + {name="Edwin Ng"}, {name="Zhishi Wang"}, {name="Steve Yang"}, {name="Yifeng Wu"}, - {name="Jing Pan"} + {name="Jing Pan"}, ] maintainers = [ {name = "Edwin Ng", email = "edwinnglabs@gmail.com"}, @@ -31,7 +31,7 @@ maintainers = [ dynamic = ["version"] description = "Orbit is a package for Bayesian time series modeling and inference." readme = "README.md" -requires-python = ">=3.7" +requires-python = ">=3.9" dependencies = [ "arviz", "cmdstanpy>=1.2.1", @@ -49,9 +49,6 @@ dependencies = [ license = {text = "Apache License 2.0"} classifiers = [ "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", diff --git a/setup.py b/setup.py index 95eb0093..b6cf80ea 100644 --- a/setup.py +++ b/setup.py @@ -110,7 +110,6 @@ def run(self): print("Running build py command.") if not self.dry_run: print("Not a dry run, run with build") - # build_stan_model(target_dir) # install cmdstan and compilers, in the default directory for simplicity install_stan() @@ -118,7 +117,6 @@ def run(self): # build all stan models build_stan_models() - print("Dry run.") build_py.run(self) From f5e4e9414da4ce8c5d3a3653fb11dbf34752d7bb Mon Sep 17 00:00:00 2001 From: Dennis Tai Date: Wed, 27 Mar 2024 22:24:36 -0700 Subject: [PATCH 3/3] Update requirements --- pyproject.toml | 24 +++++++++++++----------- requirements.txt | 22 +++++++++++----------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5c983e40..16b8f860 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,18 +33,20 @@ description = "Orbit is a package for Bayesian time series modeling and inferenc readme = "README.md" requires-python = ">=3.9" dependencies = [ - "arviz", + "arviz>=0.17.1", "cmdstanpy>=1.2.1", - "importlib_resources", - "matplotlib>=3.3.2", - "numpy>=1.18", - "pandas>=1.0.3", - "pyro-ppl>=1.4.0", - "scipy>=1.4.1", - "seaborn>=0.10.0", - "statsmodels>=0.11.1", - "torch>=1.11.0", - "tqdm>=4.36.1", + "importlib_resources>=6.4.0", + "ipywidgets", + "matplotlib>=3.8.3", + "numpy>=1.26.4", + "pandas>=2.2.1", + "pyro-ppl>=1.9.0", + "scipy>=1.12.0", + "seaborn>=0.13.2", + "setuptools>=42", + "statsmodels>=0.14.1", + "torch>=2.2.1", + "tqdm>=4.66.2", ] license = {text = "Apache License 2.0"} classifiers = [ diff --git a/requirements.txt b/requirements.txt index 395bdf61..c014307e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,14 +1,14 @@ -arviz +arviz>=0.17.1 cmdstanpy>=1.2.1 -importlib_resources +importlib_resources>=6.4.0 ipywidgets -matplotlib>=3.3.2 -numpy>=1.18 -pandas>=1.0.3 -pyro-ppl>=1.4.0 -scipy>=1.4.1 -seaborn>=0.10.0 +matplotlib>=3.8.3 +numpy>=1.26.4 +pandas>=2.2.1 +pyro-ppl>=1.9.0 +scipy>=1.12.0 +seaborn>=0.13.2 setuptools>=42 -statsmodels>=0.11.1 -torch>=1.11.0 -tqdm>=4.36.1 \ No newline at end of file +statsmodels>=0.14.1 +torch>=2.2.1 +tqdm>=4.66.2 \ No newline at end of file