Metadata-Version: 2.3
Name: civix
Version: 0.0.26
Summary: useful tools for civil engineering that are needed regularly in the daily tasks for a civil engineer
Author: mohamadalitellawi
Author-email: mohamadalitellawi <mohamadalitellawi@gmail.com>
License: MIT License
         
         Copyright (c) 2025 mohamadalitellawi
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering
Classifier: Programming Language :: Python :: 3
Requires-Dist: numpy>=2.3.5
Requires-Dist: loguru>=0.7
Requires-Dist: pyyaml>=6.0
Requires-Dist: plotly>=5
Requires-Dist: openpyxl>=3.1.5
Requires-Dist: civix[etabs] ; extra == 'all'
Requires-Dist: civix[ifc] ; extra == 'all'
Requires-Dist: civix[geom] ; extra == 'all'
Requires-Dist: civix[notebook] ; extra == 'all'
Requires-Dist: civix[streamlit] ; extra == 'all'
Requires-Dist: pythonnet>=3.0 ; extra == 'etabs'
Requires-Dist: rhino3dm>=8.17 ; extra == 'geom'
Requires-Dist: ifcopenshell>=0.8 ; extra == 'ifc'
Requires-Dist: notebook>=7.5.4 ; extra == 'notebook'
Requires-Dist: handcalcs>=1.11.0 ; extra == 'notebook'
Requires-Dist: streamlit>=1.57.0 ; extra == 'streamlit'
Requires-Python: >=3.12
Project-URL: Homepage, https://github.com/mohamadalitellawi/civix
Project-URL: Repository, https://github.com/mohamadalitellawi/civix
Provides-Extra: all
Provides-Extra: etabs
Provides-Extra: geom
Provides-Extra: ifc
Provides-Extra: notebook
Provides-Extra: streamlit
Description-Content-Type: text/markdown

# civix

Python tools for civil and structural engineering.

`civix` is a flat collection of domain modules for day-to-day structural work — code-based
design checks, BIM/model interop, and calc-sheet reporting. Design functions are pure and
return typed result dataclasses that carry their own demand/capacity ratio and pass/fail
verdict, so a calculation is auditable end to end.

## What's inside

| Module | Purpose |
|---|---|
| `civix.aci318_25` | ACI 318-25 structural design checks — `beams`, `columns`, `foundations`, `retaining_walls`; pure functions returning result dataclasses |
| `civix.materials` | `Concrete` and `Rebar` material objects + named presets (`C25`–`C50`, `GRADE280`/`GRADE420`/`GRADE520`) |
| `civix.sections` | Cross-section geometry (`Rect`/`Circle`) + bundled steel section database: `aisc.shape(...)`, `euro.section(...)` |
| `civix.design` | Shared result plumbing: `CalculationReport` aggregator, `CheckResultMixin`, `Check` protocol |
| `civix.loads` | Load combination generation |
| `civix.etabs` | ETABS .NET API automation via pythonnet (Windows) |
| `civix.ifc` | IFC model querying via ifcopenshell |
| `civix.geom` | Geometry helpers; reads/writes Rhino `.3dm` (rhino3dm) |
| `civix.gh` | Grasshopper snippet helpers |
| `civix.report` | Quarto CLI wrapper: render `.qmd`/`.ipynb` to PDF/HTML |
| `civix.notebook` | Display helpers (`show_check`/`show_report`/`calc_block`) for Jupyter |
| `civix.core` | Config, logging, errors, paths |

Units are carried in variable names (`fck_MPa`, `As_mm2`, `Mu_kNm`); design functions
accept engineer-natural units (kN·m, kN, kPa) at the boundary and compute in N·mm internally.

## Installation

```bash
pip install civix                      # core only (numpy, loguru, pyyaml, plotly, openpyxl)
pip install "civix[etabs]"             # + ETABS automation (Windows)
pip install "civix[ifc]"               # + IFC parsing (ifcopenshell)
pip install "civix[geom]"              # + Rhino/Grasshopper geometry
pip install "civix[notebook]"          # + Jupyter notebook + handcalcs rendering
pip install "civix[streamlit]"         # + Streamlit app
pip install "civix[all]"               # everything
```

With `uv`:

```bash
uv add civix
uv add "civix[etabs,ifc,geom]"
uv add "civix[all]"
```

## Quickstart

```python
from civix.aci318_25.beams import flexure
from civix.materials import C30, GRADE420
from civix.sections import Rect

# Singly-reinforced RC beam flexure (ACI 318-25)
res = flexure(
    Rect(b_mm=300, h_mm=600),
    C30,
    GRADE420,
    d_mm=540,
    As_mm2=1500,
    Mu_kNm=220.0,
)
print(f"phiMn = {res.phiMn_kNm:.1f} kN·m  DCR = {res.dcr:.3f}  "
      f"{'PASS' if res.passed else 'FAIL'}  ({res.code_ref})")
```

In a notebook, render the verdict as a card:

```python
from civix.notebook import show_check
show_check("Beam B1 — flexure", res)
```

Look up standard steel sections by designation (case/space-insensitive). AISC shapes carry
dual US + SI values; European sections are metric:

```python
from civix.sections import aisc, euro

w = aisc.shape("W14X90")        # AISC Shapes Database v15.0
print(w.A_in2, w.A_mm2, w.Ix_in4)        # 26.5  17100.0  999.0

ipe = euro.section("IPE 300")   # EN / ArcelorMittal
print(ipe.h, ipe.b, ipe.Iy)              # 300.0  150.0  8356.0

aisc.UNITS["Ix_mm4"]            # "10^6 mm^4"  — each field's unit
```

Check your environment and optional runtimes (real load-and-one-operation smoke checks):

```bash
civix-health          # dependency + environment check
civix-init-config     # write a default civix.yaml to the current directory
```

## Logging

`civix` is **silent by default** — it calls `logger.disable("civix")` at import and never
attaches a sink itself. To see its logs, opt in from your notebook or script:

```python
import sys
from loguru import logger

logger.enable("civix")
logger.remove()
logger.add(sys.stderr, level="INFO")
```

## Streamlit app

```bash
uv run streamlit run streamlit_app/app.py
```

## Documentation

- [`docs/developer_manual.md`](docs/developer_manual.md) — architecture, patterns, and design rationale
- [`CONTRIBUTING.md`](CONTRIBUTING.md) — branch strategy and release workflow
- [`CLAUDE.md`](CLAUDE.md) — binding conventions (the single source of truth)
