Skip to content

Add converters between C# and Python - #2

Merged
vietle-bh merged 29 commits into
developfrom
BHoM_PythonSchema-#1-AddConverters
Oct 29, 2026
Merged

vietle-bh merged 29 commits into
developfrom
BHoM_PythonSchema-#1-AddConverters

Conversation

@vietle-bh

Copy link
Copy Markdown
Collaborator

NOTE: Depends on

Issues addressed by this PR

This pull request introduces several new utilities and enhancements to the Python schema generation tooling, focusing on improved default value formatting, cycle detection in type references, and manifest generation for rendered types. The changes add new files and functionality to support more robust and maintainable code generation.

New utilities and enhancements:

Cycle detection:

  • Added the new CycleDetector utility (.ci/generation/PythonSchemaGeneration.Core/CycleDetector.cs) to identify strongly connected components (cycles) in type reference graphs using Tarjan's algorithm, which helps manage type imports during code generation.

Default value formatting:

  • Introduced the DefaultFormatter class (.ci/generation/PythonSchemaGeneration.Core/Emission/DefaultFormatter.cs) to convert C# property default values into appropriate Python source code, handling primitives, collections, enums, special types (e.g., Guid, DateTime, Color), and reporting when defaults cannot be represented.

Manifest generation:

  • Added the ManifestWriter utility (.ci/generation/PythonSchemaGeneration.Core/Emission/ManifestWriter.cs) to serialize rendered types into a language-neutral JSON manifest, including detailed type, property, and enum metadata for testing and cross-language comparison.

Build configuration:

References management:

  • Added .ci/BHoMReferences.props to centralize and standardize the reference path for BHoM assemblies used during builds.

Test files

Changelog

Additional comments

@vietle-bh vietle-bh self-assigned this Oct 29, 2026
@vietle-bh vietle-bh added the type:feature New capability or enhancement label Oct 29, 2026
@vietle-bh
vietle-bh merged commit 2dc8c0e into develop Oct 29, 2026
6 of 7 checks passed
@vietle-bh
vietle-bh deleted the BHoM_PythonSchema-#1-AddConverters branch October 29, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:feature New capability or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant