Skip to content

Commit b171f32

Browse files
committed
add pack descriptions
1 parent 20f924b commit b171f32

File tree

4 files changed

+20
-6381
lines changed

4 files changed

+20
-6381
lines changed

docs/source/available-packs.rst

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,42 @@ This page lists the dependencies required by each ``diffpy.cmi`` pack.
77
====
88
core
99
====
10+
11+
The ``core`` pack provides the essential building blocks for creating and running regression workflows in ``diffpy.cmi``.
12+
1013
- ``packaging``
1114
- ``PyYAML``
1215
- ``diffpy.utils``
1316
- ``diffpy.srfit``
1417
- ``diffpy.structure``
1518

19+
===
20+
pdf
21+
===
22+
23+
The ``pdf`` pack is designed to handle pair distribution function (PDF) modeling and analysis.
24+
25+
- ``diffpy.srreal``
26+
- ``pyobjcryst``
1627

1728
====
1829
docs
1930
====
31+
32+
The ``docs`` pack contains the dependencies required to build the documentation for ``diffpy.cmi``.
33+
2034
- ``sphinx``
2135
- ``sphinx_rtd_theme``
2236
- ``sphinx-copybutton``
2337
- ``doctr``
2438
- ``m2r``
2539

26-
27-
===
28-
pdf
29-
===
30-
- ``diffpy.srreal``
31-
- ``pyobjcryst``
32-
33-
3440
========
3541
plotting
3642
========
43+
44+
The ``plotting`` pack provides tools for plotting and visualizing data.
45+
3746
- ``ipywidgets``
3847
- ``matplotlib``
3948
- ``ipympl``
@@ -44,6 +53,9 @@ plotting
4453
=====
4554
tests
4655
=====
56+
57+
The ``tests`` pack contains the dependencies required for testing ``diffpy.cmi``.
58+
4759
- ``flake8``
4860
- ``pytest``
4961
- ``codecov``

docs/source/conf.py

Lines changed: 0 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,11 @@
1313
# All configuration values have a default; values that are commented out
1414
# serve to show the default.
1515

16-
import re
1716
import sys
1817
import time
1918
from importlib.metadata import version
2019
from pathlib import Path
2120

22-
import yaml
23-
2421
# Attempt to import the version dynamically from GitHub tag.
2522
try:
2623
fullversion = version("diffpy.cmi")
@@ -325,135 +322,3 @@
325322

326323
# Example configuration for intersphinx: refer to the Python standard library.
327324
# intersphinx_mapping = {'http://docs.python.org/': None}
328-
329-
330-
def generate_available_packs_rst():
331-
"""Generate or update docs/source/available-packs.rst with pack
332-
dependencies."""
333-
root = Path(__file__).parent.parent.parent
334-
packs_dir = root / "requirements" / "packs"
335-
source_dir = root / "docs" / "source"
336-
cmi_rst = source_dir / "available-packs.rst"
337-
338-
header = """Packs
339-
-----
340-
341-
This page lists the dependencies required by each ``diffpy.cmi`` pack.
342-
343-
"""
344-
pack_files = sorted(packs_dir.glob("*.txt"))
345-
if cmi_rst.exists():
346-
content = cmi_rst.read_text()
347-
existing_packs = set(
348-
re.findall(
349-
r"^=+\n([A-Za-z0-9_\-]+)\n=+", content, flags=re.MULTILINE
350-
)
351-
)
352-
else:
353-
cmi_rst.write_text(header)
354-
content = header
355-
existing_packs = set()
356-
new_sections = []
357-
for pack_file in pack_files:
358-
pack_name = pack_file.stem
359-
if pack_name in existing_packs:
360-
continue
361-
dependencies = [
362-
line.strip()
363-
for line in pack_file.read_text().splitlines()
364-
if line.strip()
365-
]
366-
if dependencies:
367-
deps_list = "\n".join(f"- ``{dep}``" for dep in dependencies)
368-
else:
369-
deps_list = "_No dependencies listed._"
370-
underline = "=" * len(pack_name)
371-
section = f"""\n{underline}
372-
{pack_name}
373-
{underline}
374-
{deps_list}
375-
376-
"""
377-
new_sections.append(section)
378-
if new_sections:
379-
with open(cmi_rst, "a") as f:
380-
f.writelines(new_sections)
381-
print(f"Appended {len(new_sections)} new pack(s) to {cmi_rst}")
382-
else:
383-
print("No new packs found. available-packs.rst is up to date.")
384-
385-
386-
generate_available_packs_rst()
387-
388-
389-
def generate_available_profiles_rst():
390-
"""Generate or update docs/source/available-profiles.rst listing all
391-
profiles.
392-
393-
- If available-profiles.rst doesn't exist: create it with all profiles
394-
listed.
395-
- If it exists: append only new profiles (those not already present).
396-
"""
397-
root = Path(__file__).parent.parent.parent
398-
profiles_dir = root / "requirements" / "profiles"
399-
source_dir = root / "docs" / "source"
400-
rst_file = source_dir / "available-profiles.rst"
401-
402-
header = """Profiles
403-
--------
404-
405-
This page lists the packs and extra dependencies
406-
required by each ``diffpy.cmi`` profile.
407-
408-
"""
409-
source_dir.mkdir(parents=True, exist_ok=True)
410-
if rst_file.exists():
411-
content = rst_file.read_text()
412-
existing_profiles = set(
413-
re.findall(
414-
r"^=+\n([A-Za-z0-9_\-]+)\n=+", content, flags=re.MULTILINE
415-
)
416-
)
417-
else:
418-
rst_file.write_text(header)
419-
content = header
420-
existing_profiles = set()
421-
profile_files = sorted(profiles_dir.glob("*.yml"))
422-
new_sections = []
423-
for profile_file in profile_files:
424-
profile_name = profile_file.stem
425-
if profile_name in existing_profiles:
426-
continue # skip existing profiles
427-
data = yaml.safe_load(profile_file.read_text())
428-
packs = data.get("packs", [])
429-
extras = data.get("extras", [])
430-
packs_str = (
431-
", ".join(f"``{pack}``" for pack in packs)
432-
if packs
433-
else "_No packs listed_"
434-
)
435-
extras_str = (
436-
", ".join(f"``{extra}``" for extra in extras)
437-
if extras
438-
else "_No extras listed_"
439-
)
440-
underline = "=" * len(profile_name)
441-
section = f"""\n{underline}
442-
{profile_name}
443-
{underline}
444-
445-
packs: {packs_str}
446-
447-
extras: {extras_str}
448-
449-
"""
450-
new_sections.append(section)
451-
if new_sections:
452-
with open(rst_file, "a") as f:
453-
f.writelines(new_sections)
454-
print(f"Appended {len(new_sections)} new profile(s) to {rst_file}")
455-
else:
456-
print("No new profiles found. available-profiles.rst is up to date.")
457-
458-
459-
generate_available_profiles_rst()

0 commit comments

Comments
 (0)