Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build and Deploy Docs

on:
push:
branches: [ main ]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[docs]"

- name: Build docs
run: sphinx-build -W -b html docs docs/_build/html

- name: Upload pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/_build/html

deploy:
needs: build
runs-on: ubuntu-24.04
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deploy
uses: actions/deploy-pages@v4
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,5 @@ ENV/
# images
*.png


.envrc
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

96 changes: 86 additions & 10 deletions BREAKING_CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# API Breaking Changes - python_magnetgeo v1.0.0
# API Breaking Changes - python_magnetgeo

## Overview

This document details all API breaking changes introduced in version 1.0.0 compared to previous versions (0.3.x - 0.7.x). **No backward compatibility is provided.**
This document details all API breaking changes introduced across versions. **No backward compatibility is provided.**

## Version History Summary

### v1.0.0 (Current) - Major Architectural Overhaul
### v1.0.1 (Current)
- **`Chamfer` constructor**: parameter `l` renamed to `length` (see [v1.0.0 → v1.0.1](#v100--v101))

### v1.0.0 - Major Architectural Overhaul
- Complete rewrite with base class architecture
- Enhanced type safety and validation system
- **New Profile class** for bump profile management
Expand Down Expand Up @@ -41,6 +44,68 @@ This document details all API breaking changes introduced in version 1.0.0 compa

---

## v1.0.0 → v1.0.1

### Chamfer: parameter `l` renamed to `length`

The `l` parameter of `Chamfer.__init__` was renamed to `length` to resolve the
E741 linting error (ambiguous variable name).

**Old:**
```python
Chamfer(name, side, rside, alpha=None, dr=None, l=None)
```

**New:**
```python
Chamfer(name, side, rside, alpha=None, dr=None, length=None)
```

**Migration — update any call that passes `l` as a keyword argument:**
```python
# Before
chamfer = Chamfer("c1", "HP", "rext", alpha=45.0, l=10.0)

# After
chamfer = Chamfer("c1", "HP", "rext", alpha=45.0, length=10.0)
```

Positional calls (`Chamfer("c1", "HP", "rext", 45.0, None, 10.0)`) are
unaffected. The YAML/JSON serialization key also changes from `"l"` to `"length"`.

**YAML migration:**
```yaml
# Before
!<Chamfer>
name: c1
side: HP
rside: rext
alpha: 45.0
l: 10.0

# After
!<Chamfer>
name: c1
side: HP
rside: rext
alpha: 45.0
length: 10.0
```

A helper script is provided to automate the YAML migration:

```bash
# Preview (no files written)
python examples/migrate_chamfer_l_to_length.py --dry-run path/to/yaml/dir/

# Apply
python examples/migrate_chamfer_l_to_length.py path/to/yaml/dir/
```

---

## v1.0.0 Breaking Changes

## 1. YAML Format Changes

### Evolution Across Versions
Expand Down Expand Up @@ -153,11 +218,10 @@ name: "HL-31_H1"
axi:
name: "HL-31.d"
h: 86.51
turns: [2, 16, 2]
pitch: [...]
...
m3d:
cad: "HL-31_3D"
...
shape:
```

**New Format (v1.0.0):**
Expand All @@ -167,13 +231,25 @@ name: "HL-31_H1"
modelaxi: !<ModelAxi>
name: "HL-31.d"
h: 86.51
turns: [2, 16, 2]
pitch: [...]
model3d: !<Model3D>
cad: "HL-31_3D"
...
...
shape: !<Shape>
...

```

#### Complete Field Name Migration History

| Field (v0.5.x) | Field (v0.7.0) | Field (v1.0.0) | Status in v1.0.0 |
|----------------|----------------|----------------|------------------|
| `axi` | `modelaxi` | `modelaxi` | ✓ Required |
| `m3d` | `model3d` | `model3d` | ✓ Required |
| `shape` | `shape` | `shape` | ✓ Required |

**Migration Notes:**
- **v0.5.x → v0.7.0**: Rename field names
- **v0.7.0 → v1.0.0**: Use nested objects with explicit type annotations

**Breaking Changes:**
- Nested objects require explicit type annotations
- Helix field `axi` renamed to `modelaxi`
Expand Down
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,12 @@ coverage: ## check code coverage quickly with the default Python
$(BROWSER) htmlcov/index.html

docs: ## generate Sphinx HTML documentation, including API docs
rm -f docs/python_magnetgeo.rst
rm -f docs/modules.rst
sphinx-apidoc -o docs/ python_magnetgeo
$(MAKE) -C docs clean
SPHINX_BUILD=1 $(MAKE) -C docs html
$(BROWSER) docs/_build/html/index.html

servedocs: docs ## compile the docs watching for changes
watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .
watchmedo shell-command -p '*.md' -c '$(MAKE) -C docs html' -R -D .

release: dist ## package and upload a release
twine upload dist/*
Expand Down
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Python Magnet Geometry

<!-- [![PyPI version](https://img.shields.io/pypi/v/python_magnetgeo.svg)](https://pypi.python.org/pypi/python_magnetgeo)
[![Build Status](https://img.shields.io/travis/Trophime/python_magnetgeo.svg)](https://travis-ci.com/Trophime/python_magnetgeo)
[![Documentation Status](https://readthedocs.org/projects/python-magnetgeo/badge/?version=latest)](https://python-magnetgeo.readthedocs.io/en/latest/?version=latest)
[![Updates](https://pyup.io/repos/github/Trophime/python_magnetgeo/shield.svg)](https://pyup.io/repos/github/Trophime/python_magnetgeo/)
[![Updates](https://pyup.io/repos/github/MagnetDB/python_magnetgeo/shield.svg)](https://pyup.io/repos/github/MagnetDB/python_magnetgeo/)
-->
Python Magnet Geometry contains magnet geometrical models for high-field magnet design and simulation.

Expand Down Expand Up @@ -41,7 +40,7 @@ poetry add python_magnetgeo@^1.0.0
### Development installation

```bash
git clone https://github.com/Trophime/python_magnetgeo.git
git clone https://github.com/MagnetDB/python_magnetgeo.git
cd python_magnetgeo
git checkout v1.0.0
python -m venv --system-site-packages magnetgeo-env
Expand Down Expand Up @@ -487,7 +486,7 @@ python -m python_magnetgeo.xao HL-31-Axi.xao mesh --group CoolingChannels --geo
- Enum types (e.g., `ShapePosition`)
- Automatic YAML constructor registration

**See [BREAKING_CHANGES.md](BREAKING_CHANGES.md) for complete migration guide and migration scripts.**
**See [BREAKING_CHANGES.md](https://github.com/MagnetDB/python_magnetgeo/blob/main/BREAKING_CHANGES.md) for complete migration guide and migration scripts.**

### Version History

Expand Down Expand Up @@ -530,7 +529,7 @@ python -m python_magnetgeo.xao HL-31-Axi.xao mesh --group CoolingChannels --geo

### Quick Assessment: Which Version Are You Using?

```python
```yaml
# Check your YAML files
# If they look like this, you're on v0.5.x or earlier:
name: "HL-31"
Expand Down Expand Up @@ -578,7 +577,7 @@ except ValidationError as e:

### Migration Path 2: From v0.5.x (or earlier) to v1.0.0

Use the provided migration scripts in [BREAKING_CHANGES.md](BREAKING_CHANGES.md):
Use the provided migration scripts in [BREAKING_CHANGES.md](https://github.com/MagnetDB/python_magnetgeo/blob/main/BREAKING_CHANGES.md):

```bash
# Migrate a single YAML file
Expand Down Expand Up @@ -1476,7 +1475,7 @@ When reporting issues, please include:

## License

MIT License - see [LICENSE](LICENSE) file for details.
MIT License - see [LICENSE](https://github.com/Trophime/python_magnetgeo/blob/main/LICENSE) file for details.

## Documentation

Expand Down Expand Up @@ -1563,4 +1562,4 @@ If you use python_magnetgeo in your research, please cite:

---

**Version 1.0.0** | Released: 2025 | [Changelog](CHANGELOG.md) | [Breaking Changes](BREAKING_CHANGES.md)
**Version 1.0.0** | Released: 2025 | [Changelog](https://github.com/MagnetDB/python_magnetgeo/blob/main/HISTORY.md) | [Breaking Changes](https://github.com/MagnetDB/python_magnetgeo/blob/main/BREAKING_CHANGES.md)
3 changes: 2 additions & 1 deletion archive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ done
shift $((OPTIND - 1))

# add parameters
: ${VERSION:="1.0.0"}
: ${VERSION:="1.0.1"}
: ${DIST:="trixie"}

# cleanup source
Expand All @@ -52,6 +52,7 @@ tar \
--exclude=.pc \
--exclude=.devcontainer \
--exclude=.vscode \
--exclude=.ruff_cache \
--exclude=*.sif \
--exclude=*.crt \
--exclude=*.pem \
Expand Down
3 changes: 1 addition & 2 deletions data/HL-31_H1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@ model3d: !<Model3D>
with_shapes: False
with_channels: False
shape: !<Shape>
name:
profile: ""
length: 0
angle: 0
onturns: 0
position: ABOVE
materials:

10 changes: 9 additions & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
python-magnetgeo (1.0.0-7) UNRELEASED; urgency=medium
python-magnetgeo (1.0.1-8) UNRELEASED; urgency=medium

* d/rules: overwrite dh_auto_test to skip coverage

-- Christophe Trophime <christophe.trophime@lncmi.cnrs.fr> Thu, 07 May 2026 08:46:23 +0200

python-magnetgeo (1.0.1-7) unstable; urgency=medium

* add logging support
* fix helper to create Profile from Shape_profile.dat
* add helper to prepare helix YAML files for magnetdb
* add helper to check yaml files
* add support for lazzy loading
* add json_to_yaml helper to convert JSON objects to YAML
* fix Model3D.__repr__ and __init__ to handle optional name attribute

-- Christophe Trophime <christophe.trophime@lncmi.cnrs.fr> Tue, 03 Feb 2026 15:52:42 +0100

Expand Down
3 changes: 3 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export PYBUILD_NAME=magnetgeo
%:
dh $@ --buildsystem=pybuild

override_dh_auto_test:
PYBUILD_TEST_ARGS='--override-ini=addopts= -v --tb=short --strict-markers' dh_auto_test

# If you need to rebuild the Sphinx documentation
# Add sphinxdoc to the dh --with line
#
Expand Down
9 changes: 9 additions & 0 deletions docs/api_usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# API Usage

```{toctree}
:maxdepth: 2

dependency_analysis
lazy_loading
logging
```
2 changes: 2 additions & 0 deletions docs/authors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
```{include} ../AUTHORS.md
```
1 change: 0 additions & 1 deletion docs/authors.rst

This file was deleted.

2 changes: 2 additions & 0 deletions docs/breaking_changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
```{include} ../BREAKING_CHANGES.md
```
6 changes: 4 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'myst_parser']

myst_heading_anchors = 4

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand All @@ -40,7 +42,7 @@
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ['.rst', '.md']

# The master toctree document.
master_doc = 'index'
Expand Down
2 changes: 2 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
```{include} ../CONTRIBUTING.md
```
Loading
Loading