Skip to content

Commit 7410460

Browse files
committed
skpkg: user facing files and requirements
1 parent b84b8d8 commit 7410460

File tree

8 files changed

+171
-5
lines changed

8 files changed

+171
-5
lines changed

.readthedocs.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
3+
build:
4+
os: "ubuntu-22.04"
5+
tools:
6+
python: "latest"
7+
8+
python:
9+
install:
10+
- requirements: requirements/docs.txt
11+
12+
sphinx:
13+
configuration: doc/source/conf.py

README.rst

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,35 @@
3737

3838
Calculators for PDF, bond valence sum, and other quantities based on atom pair interaction.
3939

40-
* LONGER DESCRIPTION HERE
40+
The diffpy.srreal package provides calculators for atomic pair distribution
41+
function (PDF), bond valence sums (BVS), atom overlaps for a hard-sphere
42+
model, bond distances and directions up to specified maximum distance. The
43+
atomic structure models are represented with internal classes as non-periodic,
44+
periodic or structures with space group symmetries. The package provides
45+
implicit adapters from diffpy.structure classes or from Crystal or Molecule
46+
objects from pyobjcryst. Adapters can be easily defined for any other
47+
structure representations in Python allowing their direct use with the
48+
calculators. Calculators support two evaluation models - BASIC, which
49+
performs a full pair-summation every time, and OPTIMIZED, which updates only
50+
pair contributions that have changed since the last evaluation. Calculations
51+
can be split among parallel jobs using Python multiprocessing package or any
52+
other library that provides parallel map function. PDF calculations can
53+
be done in two modes - either as a real-space summation of peak profiles
54+
(PDFCalculator) or as a reciprocal-space Debye summation and Fourier
55+
transform of the total scattering structure function (DebyePDFCalculator).
56+
57+
The diffpy.srreal package is a Python binding to the C++ library libdiffpy
58+
(https://github.com/diffpy/libdiffpy). Calculators are created as
59+
objects of a given calculator type and so multiple instances of the same
60+
calculator type can exist with different configurations. Calculators are
61+
composed of other objects that perform lower-level tasks, such as calculating
62+
peak profile or looking up atom scattering factors. These objects can be
63+
re-assigned at runtime allowing to easily customize the calculation procedure.
64+
New classes can be defined using object inheritance either in Python or in C++
65+
and used with the existing calculators; as an example, this allows to
66+
calculate PDF with a user-defined profile function. A new calculator class
67+
can be also defined for any quantity that is obtained by iteration over atom
68+
pairs, by defining only the function that processes atom-pair contributions.
4169

4270
For more information about the diffpy.srreal library, please consult our `online documentation <https://diffpy.github.io/diffpy.srreal>`_.
4371

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
:tocdepth: -1
2+
3+
diffpy.srreal.devutils package
4+
==============================
5+
6+
.. automodule:: diffpy.srreal.devutils
7+
:members:
8+
:undoc-members:
9+
:show-inheritance:
10+
11+
Submodules
12+
----------
13+
14+
diffpy.srreal.devutils.tunePeakPrecision module
15+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16+
17+
.. automodule:: diffpy.srreal.devutils.tunePeakPrecision
18+
:members:
19+
:undoc-members:
20+
:show-inheritance:

doc/source/conf.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
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.srreal")
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
2329
# documentation root, use Path().resolve() to make it absolute, like shown here.
@@ -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.srreal",
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.

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`.

doc/source/index.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

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

7-
diffpy.srreal - Calculators for PDF, bond valence sum, and other quantities based on atom pair interaction.
7+
``diffpy.srreal`` - Calculators for PDF, bond valence sum, and other quantities based on atom pair interaction.
88

9-
| Software version |release|.
9+
| Software version |release|
1010
| Last updated |today|.
1111
1212
The diffpy.srreal package provides calculators for atomic pair distribution
@@ -66,6 +66,12 @@ Installation
6666
See the `README <https://github.com/diffpy/diffpy.srreal#installation>`_
6767
file included with the distribution.
6868

69+
================
70+
Acknowledgements
71+
================
72+
73+
``diffpy.srreal`` is built and maintained with `scikit-package <https://scikit-package.github.io/scikit-package/>`_.
74+
6975
=================
7076
Table of contents
7177
=================

doc/source/license.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Copyright (c) 2008-2012, The Trustees of Columbia University in the City of New
2222

2323
Copyright (c) 2014-2019, Brookhaven Science Associates, Brookhaven National Laboratory
2424

25-
Copyright (c) 2024, The Trustees of Columbia University in the City of New York.
25+
Copyright (c) 2025, The Trustees of Columbia University in the City of New York.
2626
All rights reserved.
2727

2828
The "DiffPy-CMI" is distributed subject to the following license conditions:

requirements/docs.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
sphinx
22
sphinx_rtd_theme
3+
sphinx-copybutton
34
doctr
45
m2r

0 commit comments

Comments
 (0)