Skip to content

Improve bindings for configuration types#35

Open
wdeconinck wants to merge 2 commits into
masterfrom
improve-config
Open

Improve bindings for configuration types#35
wdeconinck wants to merge 2 commits into
masterfrom
improve-config

Conversation

@wdeconinck

@wdeconinck wdeconinck commented Apr 29, 2026

Copy link
Copy Markdown
Collaborator

This pull request refactors and extends the Python bindings for configuration objects in atlas4py, improving maintainability and usability. The main changes involve extracting the configuration binding logic into a new dedicated source file, enhancing the Python interface for configuration objects, and updating tests to cover the new features.

Refactoring and modularization:

  • Extracted all logic related to Python bindings for configuration objects (eckit::Configuration, eckit::LocalConfiguration, atlas::util::Config) into new files: _atlas4py_Config.cpp and _atlas4py_Config.hppThis significantly improves code organization and maintainability.

Enhancements to Python bindings:

  • Replaced previous custom Python conversion and binding code for configuration objects with a more robust and feature-rich implementation in the new module. The new bindings provide a consistent interface for getting, setting, and representing configuration objects, and add static constructors for creating Config objects from keyword arguments, YAML strings, and files.
  • Updated the __repr__ methods for several types (Projection, Domain, Grid, Spacing, Metadata) to use the new atlas4py::make_object function for consistent and improved string representations.

Testing improvements:

  • Added new tests to tests/test_bindings.py to verify the new Config constructors (from_kwargs, from_yaml, from_file) and their correct behavior, including nested configuration and type handling.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the atlas4py Python bindings for configuration-related types by extracting config binding logic into a dedicated module and expanding the Python-facing Config API (including YAML/file constructors), while updating string representations to use the new config-to-Python conversion helper.

Changes:

  • Split configuration binding/conversion logic into _atlas4py_Config.{hpp,cpp} and register it from _atlas4py.cpp.
  • Expanded Python bindings for eckit::Configuration / eckit::LocalConfiguration / atlas::util::Config (mapping protocol, constructors from kwargs/YAML/file).
  • Added pytest coverage for new Config behaviors and bumped the package dev version.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/test_bindings.py Adds tests for new Config constructors and mapping/contains semantics.
src/atlas4py/CMakeLists.txt Ensures the new config binding translation unit is compiled into _atlas4py.
src/atlas4py/_atlas4py.cpp Wires in bind_Config() and updates several __repr__ paths to use make_object().
src/atlas4py/_atlas4py_Config.hpp Declares the new config binding/conversion API surface used by _atlas4py.cpp.
src/atlas4py/_atlas4py_Config.cpp Implements the new binding/conversion logic and Config constructors.
pyproject.toml Bumps atlas4py version from 0.41.1.dev4 to 0.41.1.dev5.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/atlas4py/_atlas4py_Config.cpp Outdated
Comment thread src/atlas4py/_atlas4py_Config.cpp Outdated
Comment thread src/atlas4py/_atlas4py_Config.cpp
Comment thread src/atlas4py/_atlas4py_Config.cpp Outdated
Comment thread tests/test_bindings.py Outdated
Comment thread tests/test_bindings.py Outdated
@wdeconinck wdeconinck marked this pull request as ready for review July 1, 2026 10:38
@wdeconinck wdeconinck requested a review from tehrengruber July 1, 2026 10:38
@wdeconinck

Copy link
Copy Markdown
Collaborator Author

Hi @tehrengruber this is the following PR in line, now ready for you to review :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants