From 36c61e479695cd6d7d1ad1de6f89fe9283cd3c83 Mon Sep 17 00:00:00 2001 From: Colm Talbot <colm.talbot@ligo.org> Date: Mon, 16 May 2022 19:01:42 +0000 Subject: [PATCH] Move extras_require to setup.py --- .gitlab-ci.yml | 13 +++++++++---- MANIFEST.in | 4 ++++ gw_requirements.txt | 5 +++++ mcmc_requirements.txt | 2 ++ optional_requirements.txt | 8 -------- requirements.txt | 4 +--- setup.cfg | 6 ------ setup.py | 18 ++++++++++++++++-- 8 files changed, 37 insertions(+), 23 deletions(-) create mode 100644 gw_requirements.txt create mode 100644 mcmc_requirements.txt diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 564c714f9..3cca69827 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -38,10 +38,6 @@ containers: .test-python: &test-python stage: initial image: python - before_script: - # this is required because pytables doesn't use a wheel on py37 - - apt-get -yqq update - - apt-get -yqq install libhdf5-dev script: - python -m pip install . - python -m pip list installed @@ -109,6 +105,15 @@ precommits-py3.9: # CACHE_DIR: ".pip310" # PYVERSION: "python310" +install: + stage: initial + parallel: + matrix: + - EXTRA: [gw, mcmc, all] + image: containers.ligo.org/lscsoft/bilby/v2-bilby-python39 + script: + - pip install .[$EXTRA] + # ------------------- Test stage ------------------------------------------- .unit-tests: &unit-test diff --git a/MANIFEST.in b/MANIFEST.in index 3f4cc5699..d6ac4a644 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,8 @@ include README.rst include LICENSE.md include requirements.txt +include gw_requirements.txt +include mcmc_requirements.txt +include optional_requirements.txt +include sampler_requirements.txt recursive-include test *.py *.prior diff --git a/gw_requirements.txt b/gw_requirements.txt new file mode 100644 index 000000000..9181f5703 --- /dev/null +++ b/gw_requirements.txt @@ -0,0 +1,5 @@ +astropy>=5 +lalsuite +gwpy +tables +pyfftw diff --git a/mcmc_requirements.txt b/mcmc_requirements.txt new file mode 100644 index 000000000..6f5678c04 --- /dev/null +++ b/mcmc_requirements.txt @@ -0,0 +1,2 @@ +scikit-learn +nflows diff --git a/optional_requirements.txt b/optional_requirements.txt index d6ceb7188..60e3fb4ba 100644 --- a/optional_requirements.txt +++ b/optional_requirements.txt @@ -1,11 +1,3 @@ -astropy celerite -lalsuite george -gwpy -theano plotly -tables -pyfftw -scikit-learn -nflows diff --git a/requirements.txt b/requirements.txt index e23d0a0cb..70e457fca 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,6 +8,4 @@ pandas dill tqdm h5py -tables -astropy -attrs \ No newline at end of file +attrs diff --git a/setup.cfg b/setup.cfg index 707f38591..e6195c567 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,11 +16,5 @@ addopts = name = bilby license_file = LICENSE.md -[options.extras_require] -gw = - astropy - gwpy - lalsuite - [isort] known_third_party = astropy,attr,bilby,deepdish,gwin,gwinc,gwpy,lal,lalsimulation,matplotlib,mock,nflows,numpy,packaging,pandas,past,pycbc,pymc3,pytest,scipy,setuptools,skimage,torch diff --git a/setup.py b/setup.py index d195385b1..f937ab2bc 100644 --- a/setup.py +++ b/setup.py @@ -56,8 +56,12 @@ def get_long_description(): return long_description -def get_requirements(): - with open("requirements.txt", "r") as ff: +def get_requirements(kind=None): + if kind is None: + fname = "requirements.txt" + else: + fname = f"{kind}_requirements.txt" + with open(fname, "r") as ff: requirements = ff.readlines() return requirements @@ -107,6 +111,16 @@ setup( }, python_requires=">=3.8", install_requires=get_requirements(), + extras_require={ + "gw": get_requirements("gw"), + "mcmc": get_requirements("mcmc"), + "all": ( + get_requirements("sampler") + + get_requirements("gw") + + get_requirements("mcmc") + + get_requirements("optional") + ), + }, entry_points={ "console_scripts": [ "bilby_plot=cli_bilby.plot_multiple_posteriors:main", -- GitLab