Skip to content

Commit

Permalink
try some variation on the setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
edwinnglabs committed Dec 26, 2023
1 parent b0d1a38 commit 2d863ea
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 11 deletions.
28 changes: 27 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,33 @@ extend-exclude = '''

[build-system]
requires = [
"setuptools>=42",
"setuptools>=64",
"wheel",
"cmdstanpy>=1.0.4",
]
build-backend = "setuptools.build_meta"

[project]
name = "orbit"
dynamic = ["version"]
description = "Orbit is a package for Bayesian time series modeling and inference."
readme = "README.md"
requires-python = ">=3.7"
dependencies = [
"cmdstanpy>=1.0.4",
"numpy>=1.15.4",
"matplotlib>=2.0.0",
"pandas>=1.0.4",
"tqdm>=4.36.1",
"importlib_resources",
]
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",
]
5 changes: 0 additions & 5 deletions setup.cfg

This file was deleted.

36 changes: 31 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
import tempfile
from shutil import copy, copytree, rmtree

from setuptools import setup, find_packages
from setuptools import setup, find_packages, Extension
from setuptools.command.build_py import build_py
from setuptools.command.develop import develop
from setuptools.command.test import test as test_command
from setuptools.command.build_ext import build_ext
from setuptools.command.editable_wheel import editable_wheel
from wheel.bdist_wheel import bdist_wheel

# from setuptools.command.install import install as install_command

Expand Down Expand Up @@ -147,9 +148,8 @@ def run(self):
target_dir = os.path.join(self.build_lib, MODEL_TARGET_DIR)
self.mkpath(target_dir)

print("Not a dry run, target_dir:")
print(target_dir)
print(self.build_lib)
print("Not a dry run, run with build, target_dir:")
print("building with target_dir: {}".format(target_dir))

build_stan_model(target_dir)

Expand All @@ -173,6 +173,31 @@ def run(self):

# develop.run(self)

class EditableWheel(editable_wheel):
"""Custom develop command to pre-compile Stan models in-place."""

def run(self):
if not self.dry_run:
target_dir = os.path.join(self.project_dir, MODEL_TARGET_DIR)
self.mkpath(target_dir)

print("Not a dry run, run with editable, target_dir:")
print("building with target_dir: {}".format(target_dir))

build_stan_model(target_dir)

editable_wheel.run(self)


class BDistWheelABINone(bdist_wheel):
def finalize_options(self):
bdist_wheel.finalize_options(self)
self.root_is_pure = False

def get_tag(self):
_, _, plat = bdist_wheel.get_tag(self)
return "py3", "none", plat


setup(
author="Edwin Ng, Zhishi Wang, Steve Yang, Yifeng Wu, Jing Pan",
Expand All @@ -196,6 +221,7 @@ def run(self):
packages=find_packages(),
url="https://orbit-ml.readthedocs.io/en/stable/",
# version=VERSION, # being maintained by source module
ext_modules=[Extension("orbit.stan_compiled", [])],
zip_safe=False,
classifiers=[
"Development Status :: 3 - Alpha",
Expand Down

0 comments on commit 2d863ea

Please sign in to comment.