Skip to content

Commit

Permalink
Add basic documentation outline
Browse files Browse the repository at this point in the history
  • Loading branch information
sjperkins committed Apr 15, 2024
1 parent 709c446 commit 2238d98
Show file tree
Hide file tree
Showing 8 changed files with 176 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2

build:
os: "ubuntu-22.04"
tools:
python: "3.11"

python:
install:
- requirements: docs/requirements.txt
- method: pip
path: .

sphinx:
configuration: docs/source/conf.py
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
4 changes: 4 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
furo==2024.1.29
numpydoc==1.7.0
sphinx==7.1.2
tomli==2.0.1
10 changes: 10 additions & 0 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
API
===

.. autosummary::
:toctree: generated

Reading from FITS files
-----------------------

.. autofunction:: xarrayfits.xds_from_fits
43 changes: 43 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Configuration file for the Sphinx documentation builder.

# -- Project information

from datetime import datetime
import tomli

with open("../../pyproject.toml", "rb") as f:
toml = tomli.load(f)
pyproject = toml["tool"]["poetry"]

project = pyproject["name"]
copyright = f"{datetime.now().year}, South African Radio Astronomy Observatory (SARAO)"
author = "South African Radio Astronomy Observatory (SARAO)"

release = pyproject["version"]
version = pyproject["version"]

# -- General configuration

extensions = [
"sphinx.ext.duration",
"sphinx.ext.doctest",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.intersphinx",
]

intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None),
"sphinx": ("https://www.sphinx-doc.org/en/master/", None),
"xarray": ("https://docs.xarray.dev/en/stable/", None),
}
intersphinx_disabled_domains = ["std"]

templates_path = ["_templates"]

# -- Options for HTML output

html_theme = "furo"

# -- Options for EPUB output
epub_show_urls = "footnote"
21 changes: 21 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Welcome to xarray-fits's documentation!
=======================================

**xarray-fits** is a Python library for
expressing fits files as xarray datasets.

Check out the :doc:`usage` section for further information, including
how to :ref:`installation` the project.

.. note::

This project is under active development.

Contents
--------

.. toctree::
:maxdepth: 3

usage
api
28 changes: 28 additions & 0 deletions docs/source/usage.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Usage
=====

.. _installation:

Installation
------------

To use xarray-fits, first install it using pip:

.. code-block:: console
(.venv) $ pip install xarray-fits
Creating xarray datasets from FITS files
----------------------------------------

To retrieve a list of xarray datasets with
FITS file contents, you can use the
``xarrayfits.xds_from_fits()`` function:

.. autofunction:: xarrayfits.xds_from_fits
:noindex:

For example:

>>> from xarrayfits import xds_from_fits
>>> xds_from_fits("3C147.fits")

0 comments on commit 2238d98

Please sign in to comment.