-
Notifications
You must be signed in to change notification settings - Fork 0
Tweaks for management and docs #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
ggalloni
wants to merge
7
commits into
main
Choose a base branch
from
tweaks
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
01ff887
Add codestyle check
ggalloni f59adad
Add pre-commits
ggalloni 193ed66
handles RTD and codecov settings
ggalloni 9ba4a6d
add dev dependencies and ruff/cov rules
ggalloni 24ea6aa
commit lock for deterministic installation
ggalloni e9c5f48
add docs
ggalloni 2718f3a
avoid pre-commit for now
ggalloni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name: Code Style | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| pull_request: | ||
| branches: [ main ] | ||
|
|
||
| jobs: | ||
| ruff: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v5 | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: '3.11' | ||
|
|
||
| - name: Install uv and set the Python version | ||
| uses: astral-sh/setup-uv@v6 | ||
| with: | ||
| python-version: '3.11' | ||
| enable-cache: true | ||
|
|
||
| - name: Install dev dependencies | ||
| run: | | ||
| EXTRAS="--extra dev" | ||
| uv sync --locked ${EXTRAS} | ||
|
|
||
| - name: Check code style with ruff | ||
| run: | | ||
| set -o errexit | ||
| uv run ruff check --fix . --config ./pyproject.toml | ||
| uv run ruff format . --config ./pyproject.toml | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,22 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # repos: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # - repo: https://github.com/asottile/pyupgrade | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # rev: v3.21.2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # hooks: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # - id: pyupgrade | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # args: [--py310-plus] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # files: '\.py$' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # - repo: https://github.com/astral-sh/uv-pre-commit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # rev: 0.9.14 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # hooks: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # - id: uv-lock | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # - repo: https://github.com/astral-sh/ruff-pre-commit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # # Ruff version. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # rev: v0.14.7 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # hooks: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # # Run the linter. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # - id: ruff | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # types_or: [ python, pyi, jupyter ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # args: [ --fix ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # # Run the formatter. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # - id: ruff-format | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # types_or: [ python, pyi, jupyter ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+22
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # repos: | |
| # - repo: https://github.com/asottile/pyupgrade | |
| # rev: v3.21.2 | |
| # hooks: | |
| # - id: pyupgrade | |
| # args: [--py310-plus] | |
| # files: '\.py$' | |
| # - repo: https://github.com/astral-sh/uv-pre-commit | |
| # rev: 0.9.14 | |
| # hooks: | |
| # - id: uv-lock | |
| # - repo: https://github.com/astral-sh/ruff-pre-commit | |
| # # Ruff version. | |
| # rev: v0.14.7 | |
| # hooks: | |
| # # Run the linter. | |
| # - id: ruff | |
| # types_or: [ python, pyi, jupyter ] | |
| # args: [ --fix ] | |
| # # Run the formatter. | |
| # - id: ruff-format | |
| # types_or: [ python, pyi, jupyter ] | |
| repos: | |
| - repo: https://github.com/asottile/pyupgrade | |
| rev: v3.21.2 | |
| hooks: | |
| - id: pyupgrade | |
| args: [--py310-plus] | |
| files: '\.py$' | |
| - repo: https://github.com/astral-sh/uv-pre-commit | |
| rev: 0.9.14 | |
| hooks: | |
| - id: uv-lock | |
| - repo: https://github.com/astral-sh/ruff-pre-commit | |
| # Ruff version. | |
| rev: v0.14.7 | |
| hooks: | |
| # Run the linter. | |
| - id: ruff | |
| types_or: [ python, pyi, jupyter ] | |
| args: [ --fix ] | |
| # Run the formatter. | |
| - id: ruff-format | |
| types_or: [ python, pyi, jupyter ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # .readthedocs.yaml | ||
| # Read the Docs configuration file | ||
| # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details | ||
|
|
||
| version: 2 | ||
|
|
||
| # Set the OS, Python version and other tools you might need | ||
| build: | ||
| os: ubuntu-22.04 | ||
| tools: | ||
| python: "3.11" | ||
|
|
||
| # Build documentation in the docs/ directory with Sphinx | ||
| sphinx: | ||
| configuration: docs/conf.py | ||
| fail_on_warning: false | ||
|
|
||
| # Install Python dependencies using uv when available, pip as fallback | ||
| python: | ||
| install: | ||
| - method: pip | ||
| path: . | ||
| extra_requirements: | ||
| - dev | ||
|
|
||
| # Build pull request previews | ||
| # This enables documentation builds for pull requests | ||
| formats: | ||
| - htmlzip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| coverage: | ||
| status: | ||
| project: | ||
| default: | ||
| target: auto | ||
| threshold: 5% | ||
| base: auto | ||
|
|
||
| comment: # this is a top-level key | ||
| layout: "condensed_header, reach, diff, flags, condensed_files, condensed_footer" | ||
| behavior: default | ||
| require_changes: false | ||
| require_base: true | ||
| require_head: false | ||
| hide_project_coverage: false | ||
| after_n_builds: 1 | ||
| show_carryforward_flags: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # 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 = . | ||
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,162 @@ | ||
| # qp-planck Documentation | ||
|
|
||
| This directory contains the Sphinx documentation source for **qp-planck**. | ||
|
|
||
| ## Building Locally | ||
|
|
||
| 1. Install dependencies (from project root): | ||
| ```bash | ||
| # Using uv (recommended) | ||
| uv sync --all-extras | ||
|
|
||
| # Or using pip | ||
| pip install -e ".[dev]" | ||
| ``` | ||
|
|
||
| 2. Build HTML documentation: | ||
| ```bash | ||
| cd docs | ||
| uv run sphinx-build -b html . _build/html | ||
| # Or: make html | ||
| ``` | ||
|
|
||
| 3. View the documentation: | ||
| ```bash | ||
| open _build/html/index.html | ||
| ``` | ||
| (Or use your browser to navigate to `_build/html/index.html`) | ||
|
|
||
| ## Building on Read the Docs | ||
|
|
||
| The documentation is automatically built on Read the Docs when changes are | ||
| pushed to the repository. Configuration is in `../.readthedocs.yaml`. | ||
|
|
||
| ## Documentation Structure | ||
|
|
||
| ``` | ||
| docs/ | ||
| ├── index.rst # Main landing page | ||
| ├── installation.rst # Installation guide | ||
| ├── quickstart.rst # Quick start tutorial | ||
| ├── physics_background.rst # Theory and formalism | ||
| ├── configuration.rst # Python API configuration | ||
| ├── yaml_config.rst # YAML configuration guide | ||
| ├── examples.rst # Example workflows | ||
| ├── contributing.rst # Contribution guidelines | ||
| ├── changelog.rst # Version history | ||
| ├── references.rst # Bibliography and links | ||
| ├── api/ # API reference | ||
| │ ├── utilities.rst | ||
| │ ├── hmap2mat.rst | ||
| │ ├── mat2fits.rst | ||
| │ └── pipeline.rst | ||
| ├── conf.py # Sphinx configuration | ||
| └── Makefile # Build automation (Unix) | ||
| ``` | ||
|
|
||
| ## Writing Documentation | ||
|
|
||
| ### RST Syntax | ||
|
|
||
| We use reStructuredText (.rst) format. Key syntax: | ||
|
|
||
| **Headers:** | ||
| ```rst | ||
| Title | ||
| ===== | ||
|
|
||
| Section | ||
| ------- | ||
|
|
||
| Subsection | ||
| ^^^^^^^^^^ | ||
| ``` | ||
|
|
||
| **Code blocks:** | ||
| ```rst | ||
| .. code-block:: python | ||
|
|
||
| from qp_planck import load_RIMO | ||
| RIMO = load_RIMO("path/to/file.fits") | ||
| ``` | ||
|
|
||
| **Cross-references:** | ||
| ```rst | ||
| See :doc:`installation` for setup instructions. | ||
| See :func:`qp_planck.load_RIMO` for API details. | ||
| ``` | ||
|
|
||
| **Math:** | ||
| ```rst | ||
| .. math:: | ||
|
|
||
| C_\ell^{\text{obs}} = C_\ell^{\text{sky}} \cdot W_\ell | ||
| ``` | ||
|
|
||
| ### Adding New Pages | ||
|
|
||
| 1. Create `new_page.rst` in `docs/` | ||
| 2. Add to table of contents in `index.rst`: | ||
| ```rst | ||
| .. toctree:: | ||
| :maxdepth: 2 | ||
|
|
||
| new_page | ||
| ``` | ||
| 3. Build and verify | ||
|
|
||
| ### Docstrings | ||
|
|
||
| API documentation is automatically generated from docstrings in the source code. | ||
| Use Google-style docstrings: | ||
|
|
||
| ```python | ||
| def my_function(param: str) -> int: | ||
| """Brief one-line description. | ||
|
|
||
| Longer description with details. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| param : str | ||
| Description of parameter. | ||
|
|
||
| Returns | ||
| ------- | ||
| int | ||
| Description of return value. | ||
|
|
||
| Examples | ||
| -------- | ||
| >>> my_function("test") | ||
| 42 | ||
| """ | ||
| pass | ||
| ``` | ||
|
|
||
| ## Cleaning Build Artifacts | ||
|
|
||
| ```bash | ||
| make clean | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| **Import errors during build:** | ||
| - Ensure all dependencies are installed: `uv sync --all-extras` | ||
| - Check that the package is installed in development mode | ||
|
|
||
| **Missing modules in API docs:** | ||
| - Run `make clean` then `make html` to rebuild from scratch | ||
| - Check that modules are listed in `conf.py` extensions | ||
|
|
||
| **Math not rendering:** | ||
| - Ensure MathJax is configured in `conf.py` | ||
| - Use proper LaTeX syntax in math blocks | ||
|
|
||
| ## Resources | ||
|
|
||
| - [Sphinx documentation](https://www.sphinx-doc.org/) | ||
| - [RST primer](https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html) | ||
| - [Read the Docs](https://docs.readthedocs.io/) | ||
| - [Sphinx RTD theme](https://sphinx-rtd-theme.readthedocs.io/) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 31 in the codestyle workflow uses
--lockedflag withuv sync, but there's nouv.lockfile visible in this PR. If the lock file doesn't exist, this will fail. Either ensure the lock file is committed to the repository, or remove the--lockedflag to allow uv to create a lock file during CI runs.