Skip to main content

Structural-engineering calculation library where Jupyter notebooks are the living, reviewable deliverable.

Project description

civix

A structural-engineering design library for Python where Jupyter notebooks are the primary deliverable — living calculation documents suitable for review and submission.

Status: foundation cycle. The cross-cutting infrastructure (errors, logging, notebook display, and the Quarto export pipeline) is in place; structural-domain modules (codes, elements, materials) arrive in later cycles.

Civix has two rendering paths:

  • civix.display — the live view inside a running notebook (self-rendering PASS/FAIL cards, headers, input tables).
  • civix.report — the printed deliverable: scaffold a Quarto project and render a notebook to PDF/HTML/docx.

Plus domain tooling:

  • civix.csi + hosts/csi/ — ETABS → SAFE raft pipeline: read per-building ETABS exports (Excel or live OAPI), place them into one SAFE frame with full 6-DOF reaction handling, emit a validated raft JSON + Plotly overlay, and build/run the SAFE mat model. See docs/csi/etabs2safe-guide.md.
  • civix.site + hosts/grasshopper/ — Rhino/Grasshopper site tools: point-cloud ground-Z extraction (LAS/LAZ) and Revit toposolid break-line creasing. Pure engines are unit-tested here; thin GH components run on the host. See docs/gh-tools-cookbook.md.

Quickstart

uv sync                  # core library only
uv sync --extra notebook # add Jupyter + handcalcs (optional, needed to run notebooks)
make demo                # executes the foundation reporting demo notebook

In a notebook:

from civix.display import setup_notebook, CheckResult, CalculationReport

setup_notebook(project_name="Office Building A", engineer="J. Doe")

report = CalculationReport(title="Beam B-101")
report.add(CheckResult("Bending", unity_ratio=0.73, demand=180.0,
                       capacity=245.6, demand_unit="kNm", capacity_unit="kNm"))
report  # renders a styled PASS/FAIL report

Exporting a PDF

Scaffold a Quarto project, then render a notebook. Export needs the external Quarto CLI plus a LaTeX engine (e.g. TinyTeX).

from civix.report import init_calc_project, render_report

init_calc_project("calcs", include_sample=True)   # writes Quarto templates
render_report("calcs/sample-calcsheet.ipynb")      # -> calcs/sample-calcsheet.pdf

The scaffold also has a CLI:

uv run python -m civix.report calcs --sample

For a complete worked example — an ACI 318M-25 (SI) flexure calc note that pairs handcalcs equation rendering with civix CheckResult/CalculationReport cards — see notebooks/examples/sample-calcsheet.ipynb and render it with uv run --extra notebook quarto render notebooks/examples/sample-calcsheet.ipynb --to pdf.

Conventions

Notebooks are submission-grade calculation documents. Units are never encoded in identifier names — use clean engineering symbols (A_s, M_u, f_c) and annotate the unit on the value (a handcalcs trailing comment, the value string in calc_input_table, demand_unit/capacity_unit on CheckResult, or a library docstring). The default system is metric: N/mm/MPa for section and material values, kN/m/kPa/kN·m for loads and spans. Convert at boundaries; never mix unit systems silently. Full discipline lives in docs/calc-note-style-guide.md and CLAUDE.md.

Development

make check       # format, lint, type-check, test (340 tests)
make gh39-check  # syntax-guard the civix.site engines + GH host scripts on CPython 3.9

Repository layout

src/civix/                 # the installable package (ships in the wheel)
├─ exceptions.py           #   CivixError hierarchy
├─ log_config.py           #   loguru setup
├─ display/                #   live in-notebook PASS/FAIL rendering
├─ report/                 #   Quarto PDF/HTML/docx export (+ templates/ package data)
├─ utils/                  #   formatting + validation helpers
├─ csi/                    #   ETABS → SAFE raft pipeline (optional `csi` extra)
├─ site/                   #   Grasshopper engines (optional `site` extra)
│  ├─ pointcloud/          #     LAS/LAZ ground-Z KD-tree engine + origin-shift
│  └─ topo/                #     Revit toposolid break-line helpers
└─ core/ elements/ codes/ loads/   # structural-domain stubs (later cycles)

hosts/                     # host-only adapter scripts — NOT in the wheel, ruff/ty-excluded
├─ csi/                    #   ETABS/SAFE OAPI entry scripts, gates, LISP, A.1–A.15 spike record
└─ grasshopper/            #   Rhino/Revit GH components (load engines by file path)
   └─ topo_breaklines/

tests/
├─ unit/                   # mirrors library modules (test_csi/, test_site/, …)
├─ integration/            # external toolchains — Quarto, plus csi/
└─ notebooks/              # deliverable calc-note benchmark suites

docs/
├─ csi/                    # civix.csi invariants guide + OAPI references
├─ gh-tools-cookbook.md    # the two-layer Grasshopper tool pattern
├─ standards/              # binding engineering / API / debugging protocols
└─ superpowers/            # implementation plans + design specs

Two deliberately separate layers throughout: engines (src/civix/…, pure, tested, in the wheel) and hosts (hosts/…, thin vendor-API adapters that run only inside ETABS/SAFE or Rhino/Revit, excluded from the wheel and static checks).

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

civix-0.3.1.tar.gz (96.2 kB view details)

Uploaded Source

Built Distribution

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

civix-0.3.1-py3-none-any.whl (119.8 kB view details)

Uploaded Python 3

File details

Details for the file civix-0.3.1.tar.gz.

File metadata

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

File hashes

Hashes for civix-0.3.1.tar.gz
Algorithm Hash digest
SHA256 6ce2b346999ba8ef7f3e56d358c85fc77f33d013c6de7aa4761075fa4962994a
MD5 ff11e7a77af3f6865d2e6ad9aab0e147
BLAKE2b-256 0ed5bbaf809de0afb32c9c097a63142f7bf7f527a48232f84b6e8c0835ce1319

See more details on using hashes here.

Provenance

The following attestation bundles were made for civix-0.3.1.tar.gz:

Publisher: release.yml on mohamadalitellawi/civix

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

File details

Details for the file civix-0.3.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for civix-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 be974fd584b01df1d85eeb0dda706e9622a1e5ffa31a1122fe8e57e92fdcb1d5
MD5 e174299b49942cfd4fdf860a86e3a9cb
BLAKE2b-256 a7a1f116574885fc4acf671375c52b5459d03104445cd9d0c8d46535c446f602

See more details on using hashes here.

Provenance

The following attestation bundles were made for civix-0.3.1-py3-none-any.whl:

Publisher: release.yml on mohamadalitellawi/civix

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