Skip to main content

Symbolic and units-aware calculations with LaTeX rendering for Jupyter notebooks, optimized for Quarto PDF documentation.

Project description

keecas

Tests PyPI version Python Version Documentation

Symbolic and units-aware calculations for Jupyter notebooks with beautiful LaTeX output.

What is keecas?

keecas minimizes boilerplate for symbolic calculations using Python dicts as the core container - keys represent left-hand side symbols, values represent right-hand side expressions. Built on SymPy, Pint, and Pipe, it provides automatic unit conversion and LaTeX rendering for Quarto documents.

Quick Example

from keecas import symbols, u, pc, show_eqn

# 1. Define symbols with LaTeX notation
F, A, sigma = symbols(r"F, A, \sigma")

# 2. Cell-local parameters
_p = {
    F: 10 * u.kN,
    A: 50 * u.cm**2,
}

# 3. Cell-local expressions
_e = {
    sigma: "F / A" | pc.parse_expr
}

# 4. Evaluation with pipe operations
_v = {
    k: v | pc.subs(_e | _p) | pc.convert_to([u.MPa]) | pc.N
    for k, v in _e.items()
}

# 5. Display as LaTeX amsmath
show_eqn([_p | _e, _v])

Output:

\begin{align}
    F & = 10{\,}\text{kN} &    \\[8pt]
    A & = 50{\,}\text{cm}^{2} &    \\[8pt]
    \sigma & = \dfrac{F}{A} & = 2.0{\,}\text{MPa}
\end{align}

See hello_world.ipynb for more examples.

Installation

pip install keecas
# or
uv add keecas

Quick Start

Launch JupyterLab with keecas template:

keecas edit                        # Minimal template
keecas edit --template quickstart  # Comprehensive examples
keecas edit analysis.ipynb         # Open specific notebook
keecas edit --temp                 # Temporary session

Configuration

Manage global and local settings via TOML files:

# Initialize configuration
keecas config init --global

# Edit configuration
keecas config edit --global    # Terminal editor
keecas config open --local     # System editor (GUI)

# View configuration
keecas config show             # Merged settings
keecas config path             # File locations

Key Features

  • Dict-based equations: Natural mapping of LHS to RHS
  • Pipe operations: Chain operations like expr | pc.subs(...) | pc.N
  • Unit-aware: Automatic conversion between Pint and SymPy units
  • LaTeX output: Renders as amsmath align blocks
  • Cross-references: Label generation for Quarto documents
  • Multi-language: 10 languages supported (5 fully localized)
  • Configuration: Global/local TOML-based settings

Documentation

Full documentation: https://kompre.github.io/keecas

License

MIT License - see LICENSE

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

keecas-1.2.0.tar.gz (72.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

keecas-1.2.0-py3-none-any.whl (86.1 kB view details)

Uploaded Python 3

File details

Details for the file keecas-1.2.0.tar.gz.

File metadata

  • Download URL: keecas-1.2.0.tar.gz
  • Upload date:
  • Size: 72.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for keecas-1.2.0.tar.gz
Algorithm Hash digest
SHA256 b32f02f76ec04472088cf6082df3b8802d70bb885c07817c6f5d9a036f95ee9d
MD5 2bdfe6ca3d0afbfe9a55915a759cfd13
BLAKE2b-256 0f82e50c9d86a6b94566c1209a47c045b374ba82d6c679e01bdef19729d79be5

See more details on using hashes here.

Provenance

The following attestation bundles were made for keecas-1.2.0.tar.gz:

Publisher: release.yml on kompre/keecas

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file keecas-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: keecas-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 86.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for keecas-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 139638f9c8ea52a4a8de8b3f88df2151f818315bf650584cc65143e55fd84f1a
MD5 0352f000e7246048a3d342c0d5f0c156
BLAKE2b-256 fc3691c7de9b51453295a919c3f8eb84e22f4994e5b6caa43d3f153d6e85cb9e

See more details on using hashes here.

Provenance

The following attestation bundles were made for keecas-1.2.0-py3-none-any.whl:

Publisher: release.yml on kompre/keecas

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page