setup.py (prophet-1.1) | : | setup.py (prophet-1.1.1) | ||
---|---|---|---|---|
skipping to change at line 59 | skipping to change at line 59 | |||
rmtree(original_dir) | rmtree(original_dir) | |||
temp_dir.rename(original_dir) | temp_dir.rename(original_dir) | |||
def repackage_cmdstan(): | def repackage_cmdstan(): | |||
return os.environ.get("PROPHET_REPACKAGE_CMDSTAN", "").lower() not in ["fals e", "0"] | return os.environ.get("PROPHET_REPACKAGE_CMDSTAN", "").lower() not in ["fals e", "0"] | |||
def maybe_install_cmdstan_toolchain(): | def maybe_install_cmdstan_toolchain(): | |||
"""Install C++ compilers required to build stan models on Windows machines." "" | """Install C++ compilers required to build stan models on Windows machines." "" | |||
import cmdstanpy | import cmdstanpy | |||
from cmdstanpy.install_cxx_toolchain import main as _install_cxx_toolchain | ||||
try: | try: | |||
cmdstanpy.utils.cxx_toolchain_path() | cmdstanpy.utils.cxx_toolchain_path() | |||
except Exception: | except Exception: | |||
_install_cxx_toolchain({"version": None, "dir": None, "verbose": True}) | try: | |||
from cmdstanpy.install_cxx_toolchain import run_rtools_install | ||||
except ImportError: | ||||
# older versions | ||||
from cmdstanpy.install_cxx_toolchain import main as run_rtools_insta | ||||
ll | ||||
run_rtools_install({"version": None, "dir": None, "verbose": True}) | ||||
cmdstanpy.utils.cxx_toolchain_path() | cmdstanpy.utils.cxx_toolchain_path() | |||
def install_cmdstan_deps(cmdstan_dir: Path): | def install_cmdstan_deps(cmdstan_dir: Path): | |||
import cmdstanpy | import cmdstanpy | |||
from multiprocessing import cpu_count | from multiprocessing import cpu_count | |||
if repackage_cmdstan(): | if repackage_cmdstan(): | |||
if platform.platform().startswith("Win"): | if platform.platform().startswith("Win"): | |||
maybe_install_cmdstan_toolchain() | maybe_install_cmdstan_toolchain() | |||
print("Installing cmdstan to", cmdstan_dir) | print("Installing cmdstan to", cmdstan_dir) | |||
skipping to change at line 119 | skipping to change at line 123 | |||
if f.is_file() and f.name != model_name: | if f.is_file() and f.name != model_name: | |||
os.remove(f) | os.remove(f) | |||
if repackage_cmdstan(): | if repackage_cmdstan(): | |||
prune_cmdstan(cmdstan_dir) | prune_cmdstan(cmdstan_dir) | |||
def get_backends_from_env() -> List[str]: | def get_backends_from_env() -> List[str]: | |||
return os.environ.get("STAN_BACKEND", "CMDSTANPY").split(",") | return os.environ.get("STAN_BACKEND", "CMDSTANPY").split(",") | |||
def build_models(target_dir): | def build_models(target_dir): | |||
print(f"Compiling cmdstanpy model") | print("Compiling cmdstanpy model") | |||
build_cmdstan_model(target_dir) | build_cmdstan_model(target_dir) | |||
if 'PYSTAN' in get_backends_from_env(): | if 'PYSTAN' in get_backends_from_env(): | |||
raise ValueError("PyStan backend is not supported for Prophet >= 1.1") | raise ValueError("PyStan backend is not supported for Prophet >= 1.1") | |||
class BuildPyCommand(build_py): | class BuildPyCommand(build_py): | |||
"""Custom build command to pre-compile Stan models.""" | """Custom build command to pre-compile Stan models.""" | |||
def run(self): | def run(self): | |||
if not self.dry_run: | if not self.dry_run: | |||
skipping to change at line 214 | skipping to change at line 218 | |||
sys.modules.clear() | sys.modules.clear() | |||
sys.modules.update(old_modules) | sys.modules.update(old_modules) | |||
working_set.__init__() | working_set.__init__() | |||
with open("README.md", "r", encoding="utf-8") as f: | with open("README.md", "r", encoding="utf-8") as f: | |||
long_description = f.read() | long_description = f.read() | |||
with open("requirements.txt", "r") as f: | with open("requirements.txt", "r") as f: | |||
install_requires = f.read().splitlines() | install_requires = f.read().splitlines() | |||
about = {} | ||||
here = Path(__file__).parent.resolve() | ||||
with open(here / "prophet" / "__version__.py", "r") as f: | ||||
exec(f.read(), about) | ||||
setup( | setup( | |||
name="prophet", | name=about["__title__"], | |||
version="1.1", | version=about["__version__"], | |||
description="Automatic Forecasting Procedure", | description=about["__description__"], | |||
url="https://facebook.github.io/prophet/", | url=about["__url__"], | |||
project_urls={ | project_urls={ | |||
"Source": "https://github.com/facebook/prophet", | "Source": "https://github.com/facebook/prophet", | |||
}, | }, | |||
author="Sean J. Taylor <sjtz@pm.me>, Ben Letham <bletham@fb.com>", | author=about["__author__"], | |||
author_email="sjtz@pm.me", | author_email=about["__author_email__"], | |||
license="MIT", | license=about["__license__"], | |||
packages=find_packages(), | packages=find_packages(), | |||
install_requires=install_requires, | install_requires=install_requires, | |||
python_requires=">=3.7", | python_requires=">=3.7", | |||
zip_safe=False, | zip_safe=False, | |||
include_package_data=True, | include_package_data=True, | |||
ext_modules=[Extension("prophet.stan_model", [])], | ext_modules=[Extension("prophet.stan_model", [])], | |||
cmdclass={ | cmdclass={ | |||
"build_ext": BuildExtCommand, | "build_ext": BuildExtCommand, | |||
"build_py": BuildPyCommand, | "build_py": BuildPyCommand, | |||
"develop": DevelopCommand, | "develop": DevelopCommand, | |||
End of changes. 6 change blocks. | ||||
11 lines changed or deleted | 21 lines changed or added |