From 30a8fa6eea7c9c5900b71d6e6ffb8356d1a1012d Mon Sep 17 00:00:00 2001 From: Brigitta Sipocz Date: Fri, 6 Mar 2020 13:32:12 -0800 Subject: [PATCH 1/6] Debug custom installing --- setup.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 622a1835..dc04faa9 100644 --- a/setup.py +++ b/setup.py @@ -5,8 +5,8 @@ NAME = "astroML" AUTHOR = "Jake VanderPlas" AUTHOR_EMAIL = "vanderplas@astro.washington.edu" -MAINTAINER = "Jake VanderPlas" -MAINTAINER_EMAIL = "vanderplas@astro.washington.edu" +MAINTAINER = "Brigitta Sipocz" +MAINTAINER_EMAIL = "brigitta.sipocz@gmail.com" URL = 'http://astroML.github.com' DOWNLOAD_URL = 'https://github.com/astroML/astroML' LICENSE = 'BSD' @@ -20,7 +20,20 @@ 'matplotlib>=3.0', 'astropy>=3.0'] -setup(name=NAME, + +from setuptools import setup +from setuptools.command.install import install + + +class CustomInstallCommand(install): + """Customized setuptools install command - prints a friendly greeting.""" + def run(self): + install.run(self) + print("Hello, developer, how are you? :)") + + +setup(cmdclass={'install': CustomInstallCommand,}, + name=NAME, version=VERSION, description=DESCRIPTION, long_description=LONG_DESCRIPTION, From e9637d6e635f5275f8cccf392715998afe91e62c Mon Sep 17 00:00:00 2001 From: Brigitta Sipocz Date: Fri, 6 Mar 2020 16:25:45 -0800 Subject: [PATCH 2/6] Adding custom egg_info and develop, too --- setup.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index dc04faa9..9189876c 100644 --- a/setup.py +++ b/setup.py @@ -23,16 +23,34 @@ from setuptools import setup from setuptools.command.install import install +from setuptools.command.develop import develop +from setuptools.command.egg_info import egg_info + + +class CustomDevelopCommand(develop): + """Customized setuptools install command - prints a friendly greeting.""" + def run(self): + develop.run(self) + print("Hello, developer, how are your develop? :)") + + +class CustomEggInfoCommand(egg_info): + """Customized setuptools install command - prints a friendly greeting.""" + def run(self): + egg_info.run(self) + print("Hello, developer, how are your egg_info? :)") class CustomInstallCommand(install): """Customized setuptools install command - prints a friendly greeting.""" def run(self): install.run(self) - print("Hello, developer, how are you? :)") + print("Hello, developer, how are your install? :)") -setup(cmdclass={'install': CustomInstallCommand,}, +setup(cmdclass={'install': CustomInstallCommand, + 'develop': CustomDevelopCommand, + 'egg_info': CustomEggInfoCommand}, name=NAME, version=VERSION, description=DESCRIPTION, From 87ec0b83daaf687a6e8659e251d165342ac529d6 Mon Sep 17 00:00:00 2001 From: Brigitta Sipocz Date: Fri, 6 Mar 2020 16:34:15 -0800 Subject: [PATCH 3/6] Adding custom egg_info and develop, too--amend --- setup.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 9189876c..efffd003 100644 --- a/setup.py +++ b/setup.py @@ -28,23 +28,26 @@ class CustomDevelopCommand(develop): - """Customized setuptools install command - prints a friendly greeting.""" + """Customized setuptools develop command to trigger theano compilation.""" def run(self): develop.run(self) + from astroML.linear_model import LinearRegressionwithErrors print("Hello, developer, how are your develop? :)") class CustomEggInfoCommand(egg_info): - """Customized setuptools install command - prints a friendly greeting.""" + """Customized setuptools egg_info command to trigger theano compilation.""" def run(self): egg_info.run(self) + from astroML.linear_model import LinearRegressionwithErrors print("Hello, developer, how are your egg_info? :)") class CustomInstallCommand(install): - """Customized setuptools install command - prints a friendly greeting.""" + """Customized setuptools install command to trigger theano compilation.""" def run(self): install.run(self) + from astroML.linear_model import LinearRegressionwithErrors print("Hello, developer, how are your install? :)") From 6f3731a27f95a4d97a2973b7d2b76a35789e7f5a Mon Sep 17 00:00:00 2001 From: Brigitta Sipocz Date: Mon, 9 Mar 2020 15:07:46 -0700 Subject: [PATCH 4/6] Add trigger_theano for custom custom setuptools command --- setup.py | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/setup.py b/setup.py index efffd003..af7a7796 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,8 @@ from setuptools import setup +from setuptools.command.install import install +from setuptools.command.develop import develop +from setuptools.command.egg_info import egg_info + DESCRIPTION = "tools for machine learning and data mining in Astronomy" LONG_DESCRIPTION = open('README.rst').read() @@ -21,34 +25,41 @@ 'astropy>=3.0'] -from setuptools import setup -from setuptools.command.install import install -from setuptools.command.develop import develop -from setuptools.command.egg_info import egg_info +def trigger_theano(): + try: + import pymc3 as pm + print("Run small regression example to trigger theano builds, if pymc3 is available.") + import numpy as np + from astroML.linear_model import LinearRegressionwithErrors + lr = LinearRegressionwithErrors() + x = np.arange(10) + y = np.arange(10) * 2 + 1 + x_err = np.ones(10) * 0.1 + y_err = np.ones(10) * 0.1 + lr.fit(x, y, y_err, x_err) + except (ImportError, RuntimeError): + pass class CustomDevelopCommand(develop): """Customized setuptools develop command to trigger theano compilation.""" def run(self): develop.run(self) - from astroML.linear_model import LinearRegressionwithErrors - print("Hello, developer, how are your develop? :)") + trigger_theano() class CustomEggInfoCommand(egg_info): """Customized setuptools egg_info command to trigger theano compilation.""" def run(self): egg_info.run(self) - from astroML.linear_model import LinearRegressionwithErrors - print("Hello, developer, how are your egg_info? :)") + trigger_theano() class CustomInstallCommand(install): """Customized setuptools install command to trigger theano compilation.""" def run(self): install.run(self) - from astroML.linear_model import LinearRegressionwithErrors - print("Hello, developer, how are your install? :)") + trigger_theano() setup(cmdclass={'install': CustomInstallCommand, From 0eff9bbe25f3bfcc457a66b2e9a8b9ffd788c6d6 Mon Sep 17 00:00:00 2001 From: Brigitta Sipocz Date: Mon, 9 Mar 2020 15:57:08 -0700 Subject: [PATCH 5/6] DEBUG, remove me [skip ci] --- setup.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/setup.py b/setup.py index af7a7796..c39e85d5 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,5 @@ from setuptools import setup from setuptools.command.install import install -from setuptools.command.develop import develop from setuptools.command.egg_info import egg_info @@ -34,20 +33,13 @@ def trigger_theano(): lr = LinearRegressionwithErrors() x = np.arange(10) y = np.arange(10) * 2 + 1 - x_err = np.ones(10) * 0.1 - y_err = np.ones(10) * 0.1 + x_err = np.ones(10) * 0.01 + y_err = np.ones(10) * 0.01 lr.fit(x, y, y_err, x_err) except (ImportError, RuntimeError): pass -class CustomDevelopCommand(develop): - """Customized setuptools develop command to trigger theano compilation.""" - def run(self): - develop.run(self) - trigger_theano() - - class CustomEggInfoCommand(egg_info): """Customized setuptools egg_info command to trigger theano compilation.""" def run(self): @@ -59,11 +51,10 @@ class CustomInstallCommand(install): """Customized setuptools install command to trigger theano compilation.""" def run(self): install.run(self) - trigger_theano() +# trigger_theano() setup(cmdclass={'install': CustomInstallCommand, - 'develop': CustomDevelopCommand, 'egg_info': CustomEggInfoCommand}, name=NAME, version=VERSION, From 07fa9d2fadc83dd6a09fefd6e344309ddda82488 Mon Sep 17 00:00:00 2001 From: Brigitta Sipocz Date: Mon, 9 Mar 2020 16:07:45 -0700 Subject: [PATCH 6/6] DEBUG, remove me [skip ci] --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index c39e85d5..269d500f 100644 --- a/setup.py +++ b/setup.py @@ -44,14 +44,14 @@ class CustomEggInfoCommand(egg_info): """Customized setuptools egg_info command to trigger theano compilation.""" def run(self): egg_info.run(self) - trigger_theano() +# trigger_theano() class CustomInstallCommand(install): """Customized setuptools install command to trigger theano compilation.""" def run(self): install.run(self) -# trigger_theano() + trigger_theano() setup(cmdclass={'install': CustomInstallCommand,