nabla

Scientific Computing in Python 🐍 with Mojo 🔥 acceleration

https://github.com/nabla-ml/nabla

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.4%) to scientific vocabulary

Keywords

automatic-differentiation deep-learning gpu-programming machine-learning mojo neural-networks python scientific-computing
Last synced: 4 months ago · JSON representation ·

Repository

Scientific Computing in Python 🐍 with Mojo 🔥 acceleration

Basic Info
  • Host: GitHub
  • Owner: nabla-ml
  • License: other
  • Language: Python
  • Default Branch: main
  • Homepage: https://www.nablaml.com
  • Size: 20.8 MB
Statistics
  • Stars: 276
  • Watchers: 8
  • Forks: 9
  • Open Issues: 0
  • Releases: 5
Topics
automatic-differentiation deep-learning gpu-programming machine-learning mojo neural-networks python scientific-computing
Created over 1 year ago · Last pushed 5 months ago
Metadata Files
Readme License Citation

docs/README.md

Documentation Guide

This guide explains how to generate and maintain the Nabla documentation.

Quick Start

```bash

Generate structured API documentation

python docs/scripts/generate_docs.py

Build the documentation

cd docs && bash build.sh

View the documentation

open docs/_build/html/index.html ```

Documentation Scripts

Documentation maintenance scripts are located in docs/scripts/:

  • generate_docs.py - Generate API documentation from code
  • generate_sitemap.py - Create sitemap.xml for SEO
  • check_indexing.py - Verify Google indexing status
  • seo_audit.py - Run SEO analysis on documentation
  • fix_seo_issues.py - Fix common SEO problems
  • final_seo_report.py - Generate comprehensive SEO report

Documentation Structure

The documentation automatically mirrors the Nabla library structure:

docs/api/ ├── core/ # nabla.core.* ├── ops/ # nabla.ops.* ├── transforms/ # nabla.transforms.* ├── nn/ # nabla.nn.* │ ├── layers/ # nabla.nn.layers.* │ ├── losses/ # nabla.nn.losses.* │ └── ... └── utils/ # nabla.utils.*

Excluding Functions/Classes from Documentation

Method 1: Using @nodoc Decorator (Recommended)

```python from nabla.utils.docs import nodoc

Exclude a function

@nodoc def internal_helper(): """This won't appear in docs.""" pass

Exclude a class

@nodoc class InternalUtility: """This class won't appear in docs.""" pass

Exclude methods within a class

class PublicClass: def public_method(self): """This will appear in docs.""" pass

@nodoc
def _internal_method(self):
    """This won't appear in docs."""
    pass

```

Method 2: Using __all__ Lists

Define what should be documented in each module:

```python

In your module

all = ['PublicClass', 'public_function'] # Only these will be documented

class PublicClass: """This will be documented.""" pass

class InternalClass: """This won't be documented (not in all).""" pass ```

Method 3: Naming Convention

Functions/classes starting with _ are automatically excluded:

```python def public_function(): """This will be documented.""" pass

def privatefunction(): """This won't be documented (starts with _).""" pass ```

Available Commands

Generate Documentation Structure

bash python scripts/generate_structured_docs.py Creates the complete API documentation structure that mirrors your library organization.

Build Documentation

bash cd docs make html # Build HTML documentation make clean # Clean build artifacts make clean && make html # Clean rebuild

Fix Documentation Warnings

bash python scripts/fix_doc_warnings.py Automatically fixes common documentation warnings and formatting issues.

Development Server

```bash cd docs/_build/html python -m http.server 8000

Open http://localhost:8000 in your browser

```

Configuration

Sphinx Settings

Key settings in docs/conf.py: - autodoc: Automatically generates docs from docstrings - autosummary: Creates module summaries - napoleon: Supports Google/NumPy style docstrings - nodoc integration: Respects @nodoc decorator

Custom Skip Function

The documentation system automatically excludes: - Items marked with @nodoc - Private items (starting with _) - Items not in __all__ lists - Common internal attributes

Best Practices

1. Use Clear Docstrings

```python def my_function(x, y): """ Brief description of what the function does.

Args:
    x: Description of parameter x
    y: Description of parameter y

Returns:
    Description of return value

Example:
    >>> result = my_function(1, 2)
    >>> print(result)
    3
"""
return x + y

```

2. Organize with @nodoc

```python

Public API

def createarray(shape): """Create a new array with given shape.""" return _internalcreate_array(shape)

Internal implementation

@nodoc def internalcreate_array(shape): """Internal array creation logic.""" # Implementation details pass ```

3. Use __all__ for Module Organization

```python

At the top of your module

all = [ 'PublicClass', 'public_function', 'CONSTANT' ]

Only items in all will be documented

```

Troubleshooting

Common Issues

ImportError during build: - Check that all imports work correctly - Ensure circular imports are resolved - Verify @nodoc imports are correct

Missing documentation: - Check if item is in __all__ list - Verify item doesn't start with _ - Ensure @nodoc decorator isn't applied

Docstring formatting warnings: - Use consistent indentation (4 spaces) - Follow Google/NumPy docstring format - Run python scripts/fix_doc_warnings.py

Build Errors

```bash

Clean rebuild to fix caching issues

cd docs && make clean && make html

Check specific errors

cd docs && sphinx-build -b html . _build/html ```

Files Overview

| File | Purpose | |------|---------| | scripts/generate_structured_docs.py | Creates API documentation structure | | scripts/fix_doc_warnings.py | Fixes common documentation warnings | | docs/conf.py | Sphinx configuration | | nabla/utils/docs.py | Contains @nodoc decorator | | docs/Makefile | Build commands |

Example Workflow

  1. Mark internal code: python @nodoc def internal_function(): pass

  2. Generate documentation: bash python scripts/generate_structured_docs.py

  3. Build and view: bash cd docs && make html && open _build/html/index.html

  4. Fix any warnings: bash python scripts/fix_doc_warnings.py

That's it! Your documentation will automatically stay in sync with your code structure and respect your public/private API boundaries.

SEO & Discoverability

The documentation includes comprehensive SEO optimization:

Automatic SEO Features

  • ✅ Page-specific meta tags and descriptions
  • ✅ Open Graph tags for social sharing
  • ✅ Twitter Cards support
  • ✅ Automatic sitemap generation
  • ✅ Robots.txt configuration
  • ✅ Mobile-responsive design
  • ✅ Clean URL structure

SEO Best Practices for API Docs

```python def your_function(param): """ Brief, descriptive summary for search engines.

Detailed explanation with keywords like 'GPU-accelerated',
'NumPy-compatible', 'machine learning', etc.

Args:
    param: Clear parameter description

Returns:
    Clear return value description

Example:
    >>> import nabla as nb
    >>> result = your_function(value)
"""

```

Module-Level SEO

Add SEO-friendly module docstrings:

```python

At the top of each module

""" Core array operations for GPU-accelerated computation.

This module provides NumPy-compatible array operations optimized for machine learning and scientific computing workloads. """ ```

Performance & Analytics

Build Performance

```bash

Monitor build time

time make html

Check for SEO issues

python scripts/fixdocwarnings.py ```

SEO Analysis

```bash

View current SEO configuration

cat docs/conf.py | grep -A 10 "html_meta"

Check sitemap generation

ls docs/_build/html/sitemap.xml ```

Owner

  • Name: Nabla
  • Login: nabla-ml
  • Kind: organization

Our mission is to bring acc. AutoDiff to the Mojo programming language. Inspired by the best of PyTorch, JAX & NumPy.

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Fehrenbach"
  given-names: "Tillmann"
  orcid: "https://orcid.org/0009-0001-4831-9729"
title: "Nabla"
version: 25.3.0
doi: "10.5281/zenodo.12810766"
date-released: 2025-05-13
url: "https://github.com/nabla-ml/nabla"
license: Apache-2.0
keywords:
  - "differentiable programming"
  - "automatic differentiation"
  - "scientific computing"
  - "Mojo"
  - "machine learning"
  - "AI"
repository-code: "https://github.com/nabla-ml/nabla"
abstract: "Nabla brings JIT-accelerated **Automatic Differentiation (AD)** to the Mojo programming language, a vital technique for gradient-based optimization and physics simulations. Currently, Nabla executes all programs lazily, which - in combination with Mojo's unique memory management capabilities - allows for two quite different programming styles within one framework: functional programming with JAX-like transformations (e.g. vmap, grad, jit) as well as PyTorch-like imperative programming."

GitHub Events

Total
  • Issues event: 10
  • Watch event: 32
  • Delete event: 22
  • Issue comment event: 11
  • Push event: 232
  • Fork event: 1
  • Create event: 23
Last Year
  • Issues event: 10
  • Watch event: 32
  • Delete event: 22
  • Issue comment event: 11
  • Push event: 232
  • Fork event: 1
  • Create event: 23

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 422 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 32
  • Total maintainers: 1
pypi.org: nabla-ml

Dynamic neural networks and function transformations in Python + Mojo

  • Versions: 32
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 422 Last month
Rankings
Dependent packages count: 9.1%
Average: 30.1%
Dependent repos count: 51.1%
Maintainers (1)
Last synced: 4 months ago