Skip to content

Commit b974e79

Browse files
committed
skpkg: migrate documentation
1 parent a4582ee commit b974e79

File tree

8 files changed

+235
-167
lines changed

8 files changed

+235
-167
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.. _example_package documentation:
2+
3+
|title|
4+
=======
5+
6+
.. |title| replace:: diffpy.pdfgui.example_package package
7+
8+
.. automodule:: diffpy.pdfgui.example_package
9+
:members:
10+
:undoc-members:
11+
:show-inheritance:
12+
13+
|foo|
14+
-----
15+
16+
.. |foo| replace:: diffpy.pdfgui.example_package.foo module
17+
18+
.. automodule:: diffpy.pdfgui.example_package.foo
19+
:members:
20+
:undoc-members:
21+
:show-inheritance:
22+
23+
|bar|
24+
-----
25+
26+
.. |bar| replace:: diffpy.pdfgui.example_package.bar module
27+
28+
.. automodule:: diffpy.pdfgui.example_package.foo
29+
:members:
30+
:undoc-members:
31+
:show-inheritance:

doc/source/api/diffpy.pdfgui.rst

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
:tocdepth: -1
22

3-
diffpy.pdfgui package
4-
=====================
3+
|title|
4+
=======
5+
6+
.. |title| replace:: diffpy.pdfgui package
57

68
.. automodule:: diffpy.pdfgui
79
:members:
@@ -12,28 +14,17 @@ Subpackages
1214
-----------
1315

1416
.. toctree::
15-
:titlesonly:
16-
17-
diffpy.pdfgui.icons
18-
diffpy.pdfgui.gui
19-
diffpy.pdfgui.applications
20-
diffpy.pdfgui.control
17+
diffpy.pdfgui.example_package
2118

2219
Submodules
2320
----------
2421

25-
diffpy.pdfgui.utils module
26-
^^^^^^^^^^^^^^^^^^^^^^^^^^
27-
28-
.. automodule:: diffpy.pdfgui.utils
29-
:members:
30-
:undoc-members:
31-
:show-inheritance:
22+
|module|
23+
--------
3224

33-
diffpy.pdfgui.tui module
34-
^^^^^^^^^^^^^^^^^^^^^^^^
25+
.. |module| replace:: diffpy.pdfgui.example_submodule module
3526

36-
.. automodule:: diffpy.pdfgui.tui
27+
.. automodule:: diffpy.pdfgui.example_submodule
3728
:members:
3829
:undoc-members:
3930
:show-inheritance:

doc/source/conf.py

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33
#
4-
# diffpy.pdfgui documentation build configuration file, created by
4+
# diffpy.pdfgui documentation build configuration file, created by # noqa: E501
55
# sphinx-quickstart on Thu Jan 30 15:49:41 2014.
66
#
77
# This file is execfile()d with the current directory set to its
@@ -18,15 +18,21 @@
1818
from importlib.metadata import version
1919
from pathlib import Path
2020

21+
# Attempt to import the version dynamically from GitHub tag.
22+
try:
23+
fullversion = version("diffpy.pdfgui")
24+
except Exception:
25+
fullversion = "No version found. The correct version will appear in the released version." # noqa: E501
26+
2127
# If extensions (or modules to document with autodoc) are in another directory,
2228
# add these directories to sys.path here. If the directory is relative to the
23-
# documentation root, use Path().resolve() to make it absolute, like shown here.
29+
# documentation root, use Path().resolve() to make it absolute, like shown here. # noqa: E501
2430
# sys.path.insert(0, str(Path(".").resolve()))
2531
sys.path.insert(0, str(Path("../..").resolve()))
2632
sys.path.insert(0, str(Path("../../src").resolve()))
2733

2834
# abbreviations
29-
ab_authors = "Billinge Group members and community contributors"
35+
ab_authors = "Simon J.L. Billinge group"
3036

3137
# -- General configuration ------------------------------------------------
3238

@@ -43,6 +49,7 @@
4349
"sphinx.ext.viewcode",
4450
"sphinx.ext.intersphinx",
4551
"sphinx_rtd_theme",
52+
"sphinx_copybutton",
4653
"m2r",
4754
]
4855

@@ -68,7 +75,6 @@
6875
# |version| and |release|, also used in various other places throughout the
6976
# built documents.
7077

71-
fullversion = version(project)
7278
# The short X.Y version.
7379
version = "".join(fullversion.split(".post")[:1])
7480
# The full version, including alpha/beta/rc tags.
@@ -88,6 +94,11 @@
8894
# substitute YEAR in the copyright string
8995
copyright = copyright.replace("%Y", year)
9096

97+
# For sphinx_copybutton extension.
98+
# Do not copy "$" for shell commands in code-blocks.
99+
copybutton_prompt_text = r"^\$ "
100+
copybutton_prompt_is_regexp = True
101+
91102
# List of patterns, relative to source directory, that match files and
92103
# directories to ignore when looking for source files.
93104
exclude_patterns = ["build"]
@@ -123,6 +134,14 @@
123134
#
124135
html_theme = "sphinx_rtd_theme"
125136

137+
html_context = {
138+
"display_github": True,
139+
"github_user": "diffpy",
140+
"github_repo": "diffpy.pdfgui",
141+
"github_version": "main",
142+
"conf_py_path": "/doc/source/",
143+
}
144+
126145
# Theme options are theme-specific and customize the look and feel of a theme
127146
# further. For a list of options available for each theme, see the
128147
# documentation.
@@ -158,7 +177,7 @@
158177
# Add any extra paths that contain custom files (such as robots.txt or
159178
# .htaccess) here, relative to this directory. These files are copied
160179
# directly to the root of the documentation.
161-
html_extra_path = ["../manual"]
180+
# html_extra_path = []
162181

163182
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
164183
# using the given strftime format.
@@ -221,7 +240,13 @@
221240
# (source start file, target name, title,
222241
# author, documentclass [howto, manual, or own class]).
223242
latex_documents = [
224-
("index", "diffpy.pdfgui.tex", "diffpy.pdfgui Documentation", ab_authors, "manual"),
243+
(
244+
"index",
245+
"diffpy.pdfgui.tex",
246+
"diffpy.pdfgui Documentation",
247+
ab_authors,
248+
"manual",
249+
),
225250
]
226251

227252
# The name of an image file (relative to this directory) to place at the top of
@@ -249,7 +274,15 @@
249274

250275
# One entry per manual page. List of tuples
251276
# (source start file, name, description, authors, manual section).
252-
man_pages = [("index", "diffpy.pdfgui", "diffpy.pdfgui Documentation", ab_authors, 1)]
277+
man_pages = [
278+
(
279+
"index",
280+
"diffpy.pdfgui",
281+
"diffpy.pdfgui Documentation",
282+
ab_authors,
283+
1,
284+
)
285+
]
253286

254287
# If true, show URL addresses after external links.
255288
# man_show_urls = False

doc/source/getting-started.rst

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
:tocdepth: -1
2+
3+
.. index:: getting-started
4+
5+
.. _getting-started:
6+
7+
================
8+
Getting started
9+
================
10+
11+
Here are some example templates provided to help you get started with writing your documentation. You can use these templates to create your own documentation.
12+
13+
Reuse ``.rst`` files across multiple pages
14+
------------------------------------------
15+
16+
Here is how you can reuse a reusable block of ``.rst`` files across multiple pages:
17+
18+
.. include:: snippets/example-table.rst
19+
20+
.. warning::
21+
22+
Ensure that the ``.rst`` file you are including is not too long. If it is too long, it may be better to split it into multiple files and include them separately.
23+
24+
Refer to a specific section in the documentation
25+
------------------------------------------------
26+
27+
You can use the ``ref`` tag to refer to a specific section in the documentation. For example, you can refer to the section below using the ``:ref:`` tag as shown :ref:`here <attach-image>`.
28+
29+
.. note::
30+
31+
Please check the raw ``.rst`` file of this page to see the exact use of the ``:ref:`` tag.
32+
33+
Embed your code snippets in the documentation
34+
---------------------------------------------
35+
36+
Here is how you can write a block of code in the documentation. You can use the ``code-block`` directive to write a block of code in the documentation. For example, you can write a block of code as shown below:
37+
38+
.. code-block:: bash
39+
40+
# Create a new environment, without build dependencies (pure Python package)
41+
conda create -n <package_name>-env python=3.13 \
42+
--file requirements/test.txt \
43+
--file requirements/conda.txt
44+
45+
# Create a new environment, with build dependencies (non-pure Python package)
46+
conda create -n <package_name>-env python=3.13 \
47+
--file requirements/test.txt \
48+
--file requirements/conda.txt \
49+
--file requirements/build.txt
50+
51+
# Activate the environment
52+
conda activate <package_name>_env
53+
54+
# Install your package locally
55+
# `--no-deps` to NOT install packages again from `requirements.pip.txt`
56+
pip install -e . --no-deps
57+
58+
# Run pytest locally
59+
pytest
60+
61+
# ... run example tutorials
62+
63+
.. _attach-image:
64+
65+
Attach an image to the documentation
66+
------------------------------------
67+
68+
Here is how you attach an image to the documentation. The ``/doc/source/img/scikit-package-logo-text.png`` example image is provided in the template.
69+
70+
.. image:: ./img/scikit-package-logo-text.png
71+
:alt: codecov-in-pr-comment
72+
:width: 400px
73+
:align: center
74+
75+
76+
Other useful directives
77+
-----------------------
78+
79+
Here is how you can do menu selection :menuselection:`Admin --> Settings` and display labels for buttons like :guilabel:`Privacy level`.
183 KB
Loading

doc/source/index.rst

Lines changed: 17 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -4,94 +4,49 @@
44

55
.. |title| replace:: diffpy.pdfgui documentation
66

7-
diffpy.pdfgui - GUI for PDF simulation and structure refinement.
7+
``diffpy.pdfgui`` - Graphical user interface program for structure refinements to atomic pair distribution function.
88

99
| Software version |release|
10-
| Last updated |today|
10+
| Last updated |today|.
1111
12-
For users who do not have the expertise or necessity for command
13-
line analysis, PDFgui is a convenient and easy to use graphical front
14-
end for the PDFfit2 refinement program. It is capable of full-profile
15-
fitting of the atomic pair distribution function (PDF) derived from x-ray
16-
or neutron diffraction data and comes with built in graphical and structure
17-
visualization capabilities.
12+
===============
13+
Getting started
14+
===============
1815

19-
PDFgui is a friendly interface to the PDFfit2 refinement engine, with many
20-
powerful extensions. To get started, please open the :ref:`manual`
21-
(:download:`pdf <pdfgui.pdf>`) from the help menu or follow the :ref:`tutorial`.
16+
Welcome to the ``diffpy.pdfgui`` documentation!
17+
18+
To get started, please visit the :ref:`Getting started <getting-started>` page.
2219

2320
=======
2421
Authors
2522
=======
2623

27-
DiffPy was initiated as part of the Distributed Data Analysis of Neutron
28-
Scattering Experiments (DANSE) project, funded by the National Science
29-
Foundation under grant DMR-0520547. Any opinions, findings, and conclusions or
30-
recommendations expressed in this material are those of the author(s)
31-
and do not necessarily reflect the views of the NSF.
32-
33-
The main contributors to this package were
34-
35-
Chris Farrow,
36-
Jiwu Liu,
37-
Pavol Juhas,
38-
Dmitriy Bryndin
39-
40-
Other current and former contributors of the DiffPy project include
41-
42-
Simon Billinge,
43-
Chris Farrow,
44-
Emil Bozin,
45-
Wenduo Zhou,
46-
Peng Tian
47-
48-
The DiffPy team is part of the Billinge Group at Columbia University in New York,
49-
within the Department of Applied Physics and Applied Mathematics.
50-
51-
For a detailed list of contributors see
24+
``diffpy.pdfgui`` is developed by Simon J.L. Billinge group. The maintainer for this project is Simon J.L. Billinge group. For a detailed list of contributors see
5225
https://github.com/diffpy/diffpy.pdfgui/graphs/contributors.
5326

54-
=========
55-
Reference
56-
=========
57-
58-
If you use this program for a scientific research that leads to publication,
59-
we ask that you acknowledge use of the program by citing the following paper
60-
in your publication:
61-
62-
C L Farrow, P Juhas, J W Liu, D Bryndin, E S Božin,
63-
J Bloch, Th Proffen and S J L Billinge, `PDFfit2 and PDFgui:
64-
computer programs for studying nanostructure in crystals <https://doi.org/10.1088/0953-8984/19/33/335219>`_,
65-
J. Phys.: Condens. Matter 19 (2007) 335219.
66-
6727
============
6828
Installation
6929
============
7030

7131
See the `README <https://github.com/diffpy/diffpy.pdfgui#installation>`_
7232
file included with the distribution.
7333

74-
========
75-
Tutorial
76-
========
77-
78-
The tutorial for the package can be found here:
79-
80-
.. toctree::
34+
================
35+
Acknowledgements
36+
================
8137

82-
tutorial
38+
``diffpy.pdfgui`` is built and maintained with `scikit-package <https://scikit-package.github.io/scikit-package/>`_.
8339

8440
=================
8541
Table of contents
8642
=================
8743
.. toctree::
88-
:titlesonly:
44+
:maxdepth: 2
8945

90-
examples
91-
extras
92-
license
93-
release
46+
getting-started
9447
Package API <api/diffpy.pdfgui>
48+
release
49+
license
9550

9651
=======
9752
Indices

0 commit comments

Comments
 (0)