Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ To install pyUsadel, run the following command:
## Usage
To use pyUsadel, simply import the library in your Python script and you can access the functions and classes provided by pyUsadel to build and run your simulations. Some example simulations are included in under the folder `doc/examples/.`

## Generating documentation
The repository includes a helper script for building API documentation with [pdoc](https://pdoc.dev/). Install the optional documentation dependency and run the generator from the repository root:

```
pip install -r docs/requirements.txt
python docs/generate_docs.py
```

The resulting HTML files are written to `docs/site/`.

## Current limitations
- Only magnetization in the x-y plane is supported.
- No orbital effects.
Expand Down
37 changes: 37 additions & 0 deletions docs/generate_docs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"""
Utility script to build HTML API documentation with pdoc.

The script installs no dependencies on its own; install the optional
``pdoc`` package first (see README instructions) and then run this file
from the repository root::

python docs/generate_docs.py

The generated site ends up in ``docs/site``.
"""
from __future__ import annotations

import subprocess
import sys
from pathlib import Path


def main() -> None:
repo_root = Path(__file__).resolve().parent.parent
output_dir = repo_root / "docs" / "site"
output_dir.mkdir(parents=True, exist_ok=True)

cmd = [
sys.executable,
"-m",
"pdoc",
"pyusadel",
"-o",
str(output_dir),
]
subprocess.check_call(cmd, cwd=repo_root)
print(f"Documentation generated in {output_dir}")


if __name__ == "__main__":
main()
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pdoc>=14.0.0
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@
license="MIT",
python_requires=">=3.9",
install_requires=["numpy>=1.21", "scipy>=1.7"],
extras_require={"extra": ["numba>=0.56"]},
extras_require={
"extra": ["numba>=0.56"],
"docs": ["pdoc>=14.0.0"],
},
)