Skip to content

Conversation

@hendrikhofstadt
Copy link

This PR ports Vexillographer codegen from C# to Python. The aim is to piece-by-piece replace all dependencies on Mono/Dotnet to reduce the build system SBOM. Python is required as part of the bindings build process anyway and a much more minimal / usual build toolchain component. Given jinja2 is already a dependency we use it here as well.

The change was tested by comparing outputs of codegen for all languages between the reimplementation and original codebase.
All outputs are binary-equivalent, except ruby (one missing newline) and Java (usage of \n instead of a mix of \n & \r).

This is the first of 4 changes replacing CS components with Python reimplementations. Next up are traceloghelper, coveragetool and actorcompiler before the Mono dependency can be dropped.

Code-Reviewer Section

The general pull request guidelines can be found here.

Please check each of the following things and check all boxes before accepting a PR.

  • The PR has a description, explaining both the problem and the solution.
  • The description mentions which forms of testing were done and the testing seems reasonable.
  • Every function/class/actor that was touched is reasonably well documented.

For Release-Branches

If this PR is made against a release-branch, please also check the following:

  • This change/bugfix is a cherry-pick from the next younger branch (younger release-branch or main if this is the youngest branch)
  • There is a good reason why this PR needs to go into a release branch and this reason is documented (either in the description above or in a linked GitHub issue)

@xis19 xis19 closed this Nov 14, 2025
@xis19 xis19 reopened this Nov 14, 2025
@xis19
Copy link
Collaborator

xis19 commented Nov 14, 2025

This is cool! Just one question -- No offensive, just my personal feeling, it looks like AI is involved in programming, not quite sure about the policy here though, but in case (again, it is just my feeling, I have no objection on AI) if it is being used, it might be nice to mention which AI it is using, so people who knows the policy may have more information? If no AI is involved, please ignore me.

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-clang-ide on Linux RHEL 9

  • Commit ID: 7df391a
  • Duration 0:26:41
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@hendrikhofstadt
Copy link
Author

hendrikhofstadt commented Nov 14, 2025

@xis19 thanks for flagging, should have mentioned in the PR description. The initial porting work was done using Anthropic Sonnet 4.5.
Then I reworked it to make sure the outputs don't deviate significantly.

If the code is too AI sloppy (overly verbose comments and boilerplate) to be considered for merging I'm happy to rework it further.

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-clang-arm on Linux CentOS 7

  • Commit ID: 7df391a
  • Duration 0:46:17
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@xis19
Copy link
Collaborator

xis19 commented Nov 14, 2025

@xis19 thanks for flagging, should have mentioned in the PR description. The initial porting work was done using Anthropic Sonnet 4.5. Then I reworked it to make sure the outputs don't deviate significantly.

If the code is too AI sloppy (overly verbose comments and boilerplate) to be considered for merging I'm happy to rework it further.

I'v no preference, I mean, if it works it is good. Yet I heard there was AI related rule but you know, never actually remember what it was... @jzhou77 may provide you more information.

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-cluster-tests on Linux RHEL 9

  • Commit ID: 7df391a
  • Duration 1:11:50
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)
  • Cluster Test Logs zip file of the test logs (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-clang on Linux RHEL 9

  • Commit ID: 7df391a
  • Duration 1:12:01
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr on Linux RHEL 9

  • Commit ID: 7df391a
  • Duration 1:13:56
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@jzhou77
Copy link
Contributor

jzhou77 commented Nov 14, 2025

@xis19 thanks for flagging, should have mentioned in the PR description. The initial porting work was done using Anthropic Sonnet 4.5. Then I reworked it to make sure the outputs don't deviate significantly.
If the code is too AI sloppy (overly verbose comments and boilerplate) to be considered for merging I'm happy to rework it further.

I'v no preference, I mean, if it works it is good. Yet I heard there was AI related rule but you know, never actually remember what it was... @jzhou77 may provide you more information.

I think it's fine. We are allowed to use AI tools for this project.

@jzhou77 jzhou77 requested a review from xis19 November 14, 2025 21:29
Copy link
Collaborator

@xis19 xis19 left a comment

Choose a reason for hiding this comment

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

Some minor improvements can be good.

Args:
output_path: Path where output file(s) should be written
"""
pass
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think here raise NotImplementedError() is a more proper response for abstract methods

*
* This source file is part of the FoundationDB open source project
*
* Copyright 2013-2024 Apple Inc. and the FoundationDB project authors
Copy link
Collaborator

Choose a reason for hiding this comment

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

It will be more helpful to interpolate the copyright line using datetime library.

#
# This source file is part of the FoundationDB open source project
#
# Copyright 2013-2024 Apple Inc. and the FoundationDB project authors
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same above

template = self.env.get_template(template_name)
return template.render(**context)

def write_file(self, path: str, content: str) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not a big deal if ignored, but it is better to use pathlib.Path in this case.

return f"({option.param_type.value}) {option.param_desc or ''}"

@abstractmethod
def write_files(self, output_path: str) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Considder pathlib.Path

@@ -0,0 +1,12 @@
#include "fdbclient/FDBOptions.g.h"

Copy link
Collaborator

Choose a reason for hiding this comment

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

add license?

@@ -0,0 +1,36 @@
package com.apple.foundationdb;

Copy link
Collaborator

Choose a reason for hiding this comment

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

license?

@@ -0,0 +1,86 @@
package com.apple.foundationdb;

Copy link
Collaborator

Choose a reason for hiding this comment

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

lclicense

@@ -0,0 +1,33 @@
# FoundationDB Python API
Copy link
Collaborator

Choose a reason for hiding this comment

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

generate the license from code?

# 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,
Copy link
Collaborator

Choose a reason for hiding this comment

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

In Ruby, multiple line comments can be grouped by

=begin
COMMENT
=end

so leading # can be removed

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.

4 participants