Skip to content

Commit a260938

Browse files
authored
Merge pull request #138 from Roman-Supernova-PIT/u/rknop/docs
Update code so API docs work better
2 parents e09c620 + 7486020 commit a260938

File tree

8 files changed

+43
-11
lines changed

8 files changed

+43
-11
lines changed

changes/138.docs.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Make API docs look better, add more dependencies to pyproject.toml

docs/api.rst

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,19 @@ phrosty API
77
phrosty.imagesubtraction
88
------------------------
99

10-
.. automodule:: phrosty.imagesubtraction
11-
:members:
10+
.. automodapi:: phrosty.imagesubtraction
1211

1312
phrosty.photometry
1413
------------------
1514

16-
.. automodule:: phrosty.photometry
17-
:members:
15+
.. automodapi:: phrosty.photometry
1816

1917
phrosty.pipeline
2018
----------------
2119

22-
.. automodule:: phrosty.pipeline
23-
:members:
20+
.. automodapi:: phrosty.pipeline
2421

2522
phrosty.utils
2623
-------------
2724

28-
.. automodule:: phrosty.utils
29-
:members:
25+
.. automodapi:: phrosty.utils

docs/conf.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,19 @@
2222
# Make sure the phrosty module can be found so we can document the API
2323

2424
sys.path.insert( 0, str( pathlib.Path( '..' ).resolve() ) )
25-
autodoc_mock_imports = [ 'astropy', 'cupy', 'galsim', 'matplotlib', 'numpy', 'nvtx', 'pandas', 'photutils',
26-
'sfft', 'snpit_utils', 'snappl' ]
25+
# Ideally, we just need this next variable. However,
26+
# while it works with the autmodule directive,
27+
# it does not work with the automodapi directive.
28+
# See https://github.com/astropy/sphinx-automodapi/issues/148
29+
# autodoc_mock_imports = [ 'roman_imsim' ]
30+
#
31+
# So, instead, we do it manually. You will need to add mock to
32+
# the docs list in [project.optional-dependencies] in pyproject.tom.
33+
import mock
34+
things_to_mock = [ 'roman_imsim', 'roman_imsim.utils' ]
35+
for mod in things_to_mock:
36+
sys.modules[ mod ] = mock.MagicMock()
37+
2738

2839

2940
# -- Project information -----------------------------------------------------

phrosty/imagesubtraction.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
__all__ = [ 'gz_and_ext', 'sky_subtract', 'stampmaker' ]
2+
13
# IMPORTS Standard:
24
import os
35
import io

phrosty/photometry.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
__all__ = [ 'ap_phot', 'psfmodel', 'psf_phot' ]
2+
13
# IMPORTS Standard:
24
import numpy as np
35

phrosty/pipeline.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
__all__ = [ 'PipelineImage', 'Pipeline' ]
2+
13
# Imports STANDARD
24
import sys
35
import argparse

phrosty/utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
__all__ = [ 'get_roman_bands', 'read_truth_txt', 'radec_isin', 'get_corners',
2+
'get_transient_radec', 'get_transient_mjd', 'get_transient_zcmb',
3+
'get_transient_peakmjd', 'get_transient_info', 'transient_in_or_out',
4+
'get_mjd_limits', 'get_radec_limits', 'get_mjd', 'pointings_near_mjd',
5+
'get_mjd_info', 'get_exptime', 'make_object_table' ]
6+
17
# IMPORTS Standard:
28
import os
39
import os.path as pa

pyproject.toml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ classifiers = [
1717
"Programming Language :: Python"
1818
]
1919
dependencies = [
20+
"astropy",
21+
"cupy-cuda12x",
22+
"galsim",
23+
"matplotlib",
24+
"numpy",
25+
"nvtx",
26+
"pandas",
27+
"photutils",
28+
"snpit-utils",
29+
"roman-snpit-snappl",
30+
"sfft-romansnpit",
2031
"towncrier",
2132
"setuptools_scm",
2233
"cruft",
@@ -49,7 +60,8 @@ docs = [
4960
"matplotlib",
5061
"sphinx",
5162
"tomli",
52-
"graphviz"
63+
"graphviz",
64+
"mock"
5365
]
5466

5567

0 commit comments

Comments
 (0)