Skip to content

Commit

Permalink
Add .readthedocs.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverba137 committed Aug 7, 2023
1 parent 165688e commit 0d46cfa
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 37 deletions.
25 changes: 25 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.10"

# Build documentation in the doc/ directory with Sphinx
sphinx:
configuration: doc/conf.py
fail_on_warning: true

# Optionally build your docs in additional formats such as PDF and ePub
formats: all

# Optionally set the version of Python and requirements required to build your docs
python:
install:
- requirements: doc/rtd_requirements.txt
7 changes: 3 additions & 4 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,9 @@
# some external dependencies are not met at build time and break the
# building process.
autodoc_mock_imports = []
for missing in ('astropy', 'numpy', 'fitsio', 'healpy',
'desitarget.skyhealpixs', 'yaml', 'scipy',
'desimodel', 'desitarget', 'desiutil',
'fiberassign._internal'):
for missing in ('astropy', 'numpy', 'fitsio', 'healpy', 'yaml', 'scipy',
'desimodel', 'desitarget', 'desiutil',
'fiberassign._internal'):
try:
foo = import_module(missing)
except ImportError:
Expand Down
8 changes: 2 additions & 6 deletions doc/rtd_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
Sphinx
pyyaml
numpy
scipy
matplotlib
astropy
fitsio
sphinx-rtd-theme
git+https://github.com/desihub/desiutil.git@main#egg=desiutil
27 changes: 0 additions & 27 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,6 @@
#
# DESI support code.
#
# If this code is being run within the readthedocs environment, then we
# need special steps.
#
# Longer story: desimodel and desitarget are fiberassign build requirements
# but these are not pip installable from a requirements file, due to the way
# that pip handles recursive requirements files and the fact that desiutil is
# required for obtaining even basic package info (egg_info). Since this is
# such a specialized case, we just check if this is running on readthedocs
# and manually pip install things right here.
#
try:
import desiutil
except ImportError:
if os.getenv('READTHEDOCS') == 'True':
import subprocess as sp
dutil = \
'git+https://github.com/desihub/desiutil.git@main#egg=desiutil'
dmodel = \
'git+https://github.com/desihub/desimodel.git@main#egg=desimodel'
dtarget = \
'git+https://github.com/desihub/desitarget.git@main#egg=desitarget'
sp.check_call(['pip', 'install', dutil])
sp.check_call(['pip', 'install', dmodel])
sp.check_call(['pip', 'install', dtarget])
else:
raise

from desiutil.setup import DesiTest, DesiVersion, get_version
#
# Begin setup
Expand Down

0 comments on commit 0d46cfa

Please sign in to comment.