Skip to content

Conversation

@nikhil-zlai
Copy link
Contributor

@nikhil-zlai nikhil-zlai commented Mar 13, 2025

Summary

cutting over to the new compiler

Checklist

  • Added Unit Tests
  • Covered by existing CI
  • Integration tested - YET TO DO THIS
  • Documentation update

Summary by CodeRabbit

  • New Features

    • Introduced a new compile command in the CLI for processing configuration files.
    • Added a function for dynamic importing of Python modules from specified file paths.
  • Refactor

    • Streamlined output messages for error and success notifications.
    • Improved team configuration handling and namespace retrieval methods.
    • Adjusted import statements for better organization.
  • Chores

    • Updated dependency libraries to enhance functionality related to markdown processing and syntax highlighting.
    • Modified the commands in the tox.ini file to reflect changes in the compilation process.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 13, 2025

Walkthrough

This pull request introduces a new compile command in the zipline command group, replacing the extract_and_convert command. It validates the presence of configuration files before initiating the compilation process. Several dependencies, including rich, markdown-it-py, and pygments, are added. Logger output formatting is simplified, and the namespace parameter is renamed to outputNamespace in team definitions. The import logic for compilation and dynamic team configuration is modified, along with minor formatting updates and changes in the tox.ini file to streamline directory handling.

Changes

File(s) Change Summary
api/py/ai/chronon/repo/zipline.py Replaced extract_and_convert with new compile command.
api/py/requirements/base.in, api/py/requirements/base.txt Added dependencies: rich, markdown-it-py==3.0.0, pygments==2.19.1, attrs==25.3.0, boltons==25.0.0, face==24.0.0, glom==24.11.0.
api/py/ai/chronon/cli/logger.py Updated output formatting in require and done functions (removed emojis).
api/py/test/sample/teams.py Renamed parameter from namespace to outputNamespace in the Team class instantiations.
api/py/ai/chronon/cli/compile/compile_context.py Updated import for Model to source from ai.chronon.api.ttypes.
api/py/ai/chronon/cli/compile/compiler.py Enhanced compilation logic to map object statuses; removed traceback printing for specific errors.
api/py/ai/chronon/cli/compile/parse_configs.py Modified module parsing: removed compile status updates and restructured naming logic.
api/py/ai/chronon/cli/compile/parse_teams.py Added import_module_from_file for dynamic module loading; updated default team name from "common" to "default".
api/py/test/sample/group_bys/sample_team/sample_group_by_missing_input_column.py Added a comment explaining the intentional omission of input_column.
api/py/ai/chronon/repo/teams.py Minor formatting adjustments in the module docstring; updated quotes for DEFAULT_CONF_TEAM.
api/py/tox.ini Changed commands to remove and create the compiled directory instead of production.
api/py/ai/chronon/utils.py Added get_team_conf_from_py for dynamic team config retrieval; modified join namespace extraction.
api/py/ai/chronon/repo/compilev3.py Introduced new compile command and its associated functionality.

Possibly related PRs

Suggested reviewers

  • nikhil-zlai
  • varant-zlai

Poem

In code we compile with a brand new twist,
Config files checked with a cautious list.
Dependencies join in a neat parade,
Logs now speak clearly, progress displayed.
Modules load dynamically, smooth and bright,
A whimsical update to keep our code light.
Cheers to changes that code our future just right!

Warning

Review ran into problems

🔥 Problems

GitHub Actions and Pipeline Checks: Resource not accessible by integration - https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-repository.

Please grant the required permissions to the CodeRabbit GitHub App under the organization or repository settings.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
api/py/ai/chronon/repo/zipline.py (1)

16-23: Fix error message inconsistency.

Error message refers to "teams.json" but code checks for "team.json".

-                "teams.py or teams.json file not found in current directory."
+                "teams.py or team.json file not found in current directory."
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 20359a2 and 03aecba.

📒 Files selected for processing (1)
  • api/py/ai/chronon/repo/zipline.py (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: python_tests
  • GitHub Check: non_spark_tests
  • GitHub Check: non_spark_tests
🔇 Additional comments (4)
api/py/ai/chronon/repo/zipline.py (4)

1-1: Imports look good.

New imports support the compile functionality.

Also applies to: 4-5


14-15: Command definition is clean.

Properly adds compile command to CLI.


30-30: Command registration is correct.

Properly adds new compile command to zipline group.


25-27:

✅ Verification successful

Consider simplifying compiler initialization.

Passing compile_context twice seems redundant.

     compile_context = CompileContext()
     compiler = Compiler(compile_context)
-    compiler.compile(compile_context)
+    compiler.compile()

🏁 Script executed:

#!/bin/bash
# Check Compiler class implementation to verify if compile method requires context
rg -A 5 "class Compiler" --glob "*.py"
rg -A 5 "def compile\(" --context 5 --glob "*.py" | grep "Compiler"

Length of output: 557


Simplify Compiler Usage: Remove redundant context parameter.

The Compiler is initialized with a compile context, so calling compiler.compile(compile_context) is unnecessary. Instead, call compiler.compile().

  • File: api/py/ai/chronon/repo/zipline.py (Lines 25-27)
 compile_context = CompileContext()
 compiler = Compiler(compile_context)
-compiler.compile(compile_context)
+compiler.compile()

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
api/py/ai/chronon/cli/logger.py (2)

56-56: Emoji replaced with text

Changed error indicator from emoji to text format for better compatibility.

Consider extracting "X: " as a constant for maintainability.


61-61: Emoji replaced with text

Changed success indicator from emoji to text format.

Consider extracting "DONE: " as a constant. Also, cond parameter is unused.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 77110b9 and 7c3e882.

📒 Files selected for processing (1)
  • api/py/ai/chronon/cli/logger.py (1 hunks)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
api/py/ai/chronon/repo/zipline.py (3)

26-28: Redundant context passing.

Compiler already receives compile_context in constructor, but it's passed again to compile method.

compile_context = CompileContext()
compiler = Compiler(compile_context)
-compiler.compile(compile_context)
+compiler.compile()

15-29: Missing error handling.

Add try-except block to catch and handle potential compilation errors.

@click.command(name="compile")
def compile():
    # check that a "teams.py" file exists in the current directory
    if not (os.path.exists("teams.py") or os.path.exists("teams.json")):
        raise click.ClickException(
            (
                "teams.py or teams.json file not found in current directory."
                " Please run from the top level of conf directory."
            )
        )

    compile_context = CompileContext()
    compiler = Compiler(compile_context)
+   try:
        compiler.compile(compile_context)
+   except Exception as e:
+       raise click.ClickException(f"Compilation failed: {str(e)}")

15-16: Consider adding command options.

The compile command might benefit from options like output directory or verbosity level.

-@click.command(name="compile")
-def compile():
+@click.command(name="compile")
+@click.option("--output", "-o", default=".", help="Output directory for compiled files")
+@click.option("--verbose", "-v", is_flag=True, help="Enable verbose output")
+def compile(output, verbose):
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 7c3e882 and 6e924ad.

📒 Files selected for processing (1)
  • api/py/ai/chronon/repo/zipline.py (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: non_spark_tests
  • GitHub Check: non_spark_tests
  • GitHub Check: enforce_triggered_workflows
🔇 Additional comments (3)
api/py/ai/chronon/repo/zipline.py (3)

1-1: Appropriate imports added.

Adds necessary imports for OS operations and compilation components.

Also applies to: 4-5


15-24: File existence check is implemented correctly.

Ensures either teams.py or teams.json exists before proceeding with compilation.


31-31: Command properly added to zipline group.

The compile command is correctly registered with the zipline command group.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (5)
api/py/ai/chronon/repo/zipline.py (3)

15-29: New compile command looks good but lacks error handling

Missing error handling for compiler.compile() and feedback to user.

    compile_context = CompileContext()
    compiler = Compiler(compile_context)
+   try:
    compiler.compile(compile_context)
+       click.echo("Compilation completed successfully.")
+   except Exception as e:
+       raise click.ClickException(f"Compilation failed: {str(e)}")

26-28: Redundant parameter passing

compile_context is passed to both constructor and compile method.

    compile_context = CompileContext()
    compiler = Compiler(compile_context)
-   compiler.compile(compile_context)
+   compiler.compile()

35-36: Remove commented out code

Unused main block can be removed.

-# if __name__ == "__main__":
-#     compile()
api/py/test/sample/teams.py (2)

65-67: Commented code should be removed

Old namespace parameter still present in comments.

sample_team = Team(
-    # namespace="test",
    outputNamespace="test",

65-84: Duplicate team definition

sample_team and test have identical configurations.

Consider removing one of these duplicate Team definitions or documenting why both are needed.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 6e924ad and 98e7c3b.

📒 Files selected for processing (3)
  • api/py/ai/chronon/repo/compile.py (0 hunks)
  • api/py/ai/chronon/repo/zipline.py (2 hunks)
  • api/py/test/sample/teams.py (3 hunks)
💤 Files with no reviewable changes (1)
  • api/py/ai/chronon/repo/compile.py
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: non_spark_tests
  • GitHub Check: non_spark_tests
🔇 Additional comments (2)
api/py/test/sample/teams.py (2)

44-45: Parameter changed from namespace to outputNamespace

Consistent with parameter renaming.


86-92: Consistent parameter renaming across all teams

All Team instances updated to use outputNamespace.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
api/py/ai/chronon/cli/compile/parse_teams.py (2)

20-37: New dynamic module import function added.

Function works correctly but lacks error handling.

 def import_module_from_file(file_path):
     # Get the module name from the file path (without .py extension)
     module_name = file_path.split("/")[-1].replace(".py", "")
 
     # Create the module spec
     spec = importlib.util.spec_from_file_location(module_name, file_path)
+    if spec is None:
+        raise ImportError(f"Could not create module spec for {file_path}")
 
     # Create the module based on the spec
     module = importlib.util.module_from_spec(spec)
 
     # Add the module to sys.modules
     sys.modules[module_name] = module
 
-    # Execute the module
-    spec.loader.exec_module(module)
+    try:
+        # Execute the module
+        spec.loader.exec_module(module)
+    except Exception as e:
+        # Clean up sys.modules if execution fails
+        if module_name in sys.modules:
+            del sys.modules[module_name]
+        raise ImportError(f"Error executing module {module_name}: {str(e)}")
 
     return module

50-52: Outdated error message.

Error message still references PYTHONPATH despite new import method.

     require(
         team_module is not None,
-        f"Team config file {teams_file} is not on the PYTHONPATH. You might need to add the your config directory to the PYTHONPATH.",
+        f"Failed to load team config file {teams_file}. Please check that it's a valid Python file.",
     )
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 98e7c3b and 43395b7.

📒 Files selected for processing (7)
  • api/py/ai/chronon/cli/compile/compile_context.py (1 hunks)
  • api/py/ai/chronon/cli/compile/compiler.py (0 hunks)
  • api/py/ai/chronon/cli/compile/parse_configs.py (2 hunks)
  • api/py/ai/chronon/cli/compile/parse_teams.py (4 hunks)
  • api/py/ai/chronon/repo/zipline.py (2 hunks)
  • api/py/test/sample/group_bys/sample_team/sample_group_by_missing_input_column.py (1 hunks)
  • api/py/test/sample/teams.py (3 hunks)
💤 Files with no reviewable changes (1)
  • api/py/ai/chronon/cli/compile/compiler.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • api/py/test/sample/teams.py
🧰 Additional context used
🧬 Code Definitions (1)
api/py/ai/chronon/cli/compile/parse_teams.py (1)
api/py/ai/chronon/cli/logger.py (1) (1)
  • require (54-57)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: non_spark_tests
  • GitHub Check: non_spark_tests
🔇 Additional comments (12)
api/py/test/sample/group_bys/sample_team/sample_group_by_missing_input_column.py (1)

28-28: Good clarification comment.

Helpful comment explaining the intentional omission for testing.

api/py/ai/chronon/cli/compile/compile_context.py (1)

6-6: Standardized Model import location.

Import now consistently comes from api.ttypes package.

api/py/ai/chronon/repo/zipline.py (3)

1-8: Added necessary imports for new compile command.

Required modules for the new functionality.


15-29: Added new compile command with prerequisite checks.

Function properly validates environment before compilation.


31-31: Added compile command to zipline group.

Command properly registered.

api/py/ai/chronon/cli/compile/parse_configs.py (2)

75-76: Simplified module parsing logic.

Improved path handling by only splitting into two parts.


86-88: Updated metadata assignment.

Now uses new mod_path variable for consistent naming.

api/py/ai/chronon/cli/compile/parse_teams.py (5)

3-4: Added necessary imports for dynamic module loading.

New imports support the new import_module_from_file function.


47-47: Using new import function instead of PYTHONPATH-dependent approach.

Good change that makes module loading more flexible.


55-55: Added helpful logging statement.

Improves visibility into processing flow.


87-87: Grammar fix in error message.

Added period at end of message for consistency.


17-17:

❓ Verification inconclusive

Changed default team from "common" to "default".

Verify this change doesn't break existing configurations.


🏁 Script executed:

#!/bin/bash
# Check for any references to "common" team in config files
rg -l "common" --type py

Length of output: 453


Update Default Team Configuration and Verify Consistency

  • The constant in api/py/ai/chronon/cli/compile/parse_teams.py has been updated from "common" to "default".
  • However, references to "common" still appear in multiple modules (e.g., docs/source/conf.py, api/py/ai/chronon/group_by.py, api/py/ai/chronon/join.py, etc.).
  • Please confirm that the change is intentional and verify that all configuration-dependent logic (including tests) handles the new default correctly.

@david-zlai david-zlai force-pushed the nikhil/compile_switch branch from 48bc817 to 6bdba7c Compare March 19, 2025 21:52
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
api/py/ai/chronon/cli/compile/compiler.py (1)

79-84: Fix unused variable per static analysis

This display update logic looks good, but rename unused variable per static analyzer:

-            for name, successful_obj in objects.items():
+            for name, _successful_obj in objects.items():
🧰 Tools
🪛 Ruff (0.8.2)

80-80: Loop control variable successful_obj not used within loop body

Rename unused successful_obj to _successful_obj

(B007)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 43395b7 and 13dd1eb.

📒 Files selected for processing (4)
  • api/py/ai/chronon/cli/compile/compiler.py (1 hunks)
  • api/py/ai/chronon/cli/compile/display/class_tracker.py (1 hunks)
  • api/py/ai/chronon/cli/compile/parse_configs.py (2 hunks)
  • api/py/ai/chronon/repo/teams.py (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • api/py/ai/chronon/repo/teams.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • api/py/ai/chronon/cli/compile/parse_configs.py
🧰 Additional context used
🪛 Ruff (0.8.2)
api/py/ai/chronon/cli/compile/compiler.py

80-80: Loop control variable successful_obj not used within loop body

Rename unused successful_obj to _successful_obj

(B007)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: non_spark_tests
  • GitHub Check: non_spark_tests
🔇 Additional comments (1)
api/py/ai/chronon/cli/compile/display/class_tracker.py (1)

64-64: Improved feedback for added objects

Good addition for consistent output with updates.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
api/py/ai/chronon/utils.py (1)

329-335: Replace old team config retrieval method

Changed from file-based approach to direct team configuration loading.

Considerations:

  • Debug prints should be removed before production
  • TODO comment is unnecessary since change is already implemented
-        print(f"chronon_root_path: {chronon_root_path}")
         namespace = parse_teams.load_teams(chronon_root_path).get(team_name).outputNamespace
-        print(f"namespace: {namespace}")
-        # TODO replace this with teams.py
-        # namespace = teams.get_team_conf(
-        #     os.path.join(chronon_root_path, TEAMS_FILE_PATH), team_name, "namespace"
-        # )
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 9591d90 and 11ea2e2.

📒 Files selected for processing (1)
  • api/py/ai/chronon/utils.py (3 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
api/py/ai/chronon/utils.py (1)
api/py/ai/chronon/cli/compile/parse_teams.py (1) (1)
  • load_teams (38-61)
🔇 Additional comments (1)
api/py/ai/chronon/utils.py (1)

316-318: New function for dynamic team config import

This function provides a cleaner way to fetch team configurations through module imports.

@david-zlai david-zlai force-pushed the nikhil/compile_switch branch 2 times, most recently from f534199 to 000ea50 Compare March 19, 2025 22:35
@david-zlai david-zlai force-pushed the nikhil/compile_switch branch from 000ea50 to 91b240f Compare March 19, 2025 22:40
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
api/py/ai/chronon/repo/compilev3.py (1)

19-21: Compiler instantiation appears redundant.

compile_context is passed twice - once during Compiler initialization and again in compile().

compiler = Compiler(compile_context)
-compiler.compile(compile_context)
+compiler.compile()
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 6917ecb and 91b240f.

📒 Files selected for processing (3)
  • api/py/ai/chronon/repo/compilev3.py (1 hunks)
  • api/py/ai/chronon/repo/zipline.py (2 hunks)
  • api/py/tox.ini (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • api/py/ai/chronon/repo/zipline.py
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: non_spark_tests
  • GitHub Check: non_spark_tests
  • GitHub Check: enforce_triggered_workflows
🔇 Additional comments (4)
api/py/ai/chronon/repo/compilev3.py (3)

1-6: Imports look good.

Clean imports for the new compiler implementation.


8-17: Good error handling.

Properly checks for configuration files before proceeding.


24-25: Standard main block.

Allows script to be run both as module and standalone.

api/py/tox.ini (1)

12-15: Updated compilation workflow.

Path changed from 'production' to 'compiled' and using new compilev3.py.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
api/py/ai/chronon/repo/compilev3.py (1)

25-27: Redundant context passing.

CompileContext passed twice unnecessarily.

-    compiler = Compiler(compile_context)
-    compiler.compile(compile_context)
+    compiler = Compiler(compile_context)
+    compiler.compile()
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 91b240f and aa1921c.

📒 Files selected for processing (3)
  • api/py/ai/chronon/repo/compilev3.py (1 hunks)
  • api/py/requirements/base.txt (4 hunks)
  • api/py/tox.ini (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • api/py/tox.ini
🧰 Additional context used
🪛 LanguageTool
api/py/requirements/base.txt

[duplication] ~29-~29: Possible typo: you repeated a word.
Context: ...irements/base.in face==24.0.0 # via glom glom==24.11.0 # via -r requirements/base...

(ENGLISH_WORD_REPEAT_RULE)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: non_spark_tests
  • GitHub Check: non_spark_tests
  • GitHub Check: enforce_triggered_workflows
🔇 Additional comments (3)
api/py/requirements/base.txt (1)

8-13: New dependencies look good.

Added dependencies support rich text formatting and data manipulation capabilities.

Also applies to: 28-31, 59-60, 74-75, 82-83

api/py/ai/chronon/repo/compilev3.py (2)

1-6: Command structure looks good.

Command definition and imports are clean and clear.

Also applies to: 8-14


30-31: Standalone execution works correctly.

Entry point properly calls the compile function.

face==24.0.0
# via glom
glom==24.11.0
# via -r requirements/base.
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix incomplete requirements comment.

The comment reference is incomplete.

-    # via -r requirements/base.
+    # via -r requirements/base.in
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# via -r requirements/base.
# via -r requirements/base.in

@david-zlai david-zlai force-pushed the nikhil/compile_switch branch from aa1921c to 4e59371 Compare March 19, 2025 23:18
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
api/py/ai/chronon/repo/compilev3.py (1)

14-30: Potential redundancy in compiler usage.

compile_context is passed to both the constructor and the compile method.

-    compiler = Compiler(compile_context)
-    compiler.compile(compile_context)
+    compiler = Compiler(compile_context)
+    compiler.compile()
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between aa1921c and 4e59371.

📒 Files selected for processing (4)
  • api/py/ai/chronon/repo/compilev3.py (1 hunks)
  • api/py/ai/chronon/repo/zipline.py (2 hunks)
  • api/py/ai/chronon/utils.py (3 hunks)
  • api/py/tox.ini (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • api/py/ai/chronon/repo/zipline.py
🧰 Additional context used
🧬 Code Definitions (1)
api/py/ai/chronon/utils.py (1)
api/py/ai/chronon/cli/compile/parse_teams.py (1) (1)
  • load_teams (38-61)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: non_spark_tests
  • GitHub Check: non_spark_tests
  • GitHub Check: enforce_triggered_workflows
🔇 Additional comments (7)
api/py/ai/chronon/utils.py (3)

28-28: Updated import to use new compiler module

Import changed to use parse_teams from the compile module, replacing the old teams module approach.

Also applies to: 35-36


317-320: New utility function for team configuration

New function dynamically imports team modules, enhancing flexibility for team configuration access.


331-337:

✅ Verification successful

Namespace retrieval implementation changed

Updated to use parse_teams.load_teams() instead of the previous file-based approach.

Note the TODO comment indicates this may be a transitional change.


🏁 Script executed:

#!/bin/bash
# Verify consistent behavior between old and new team configuration approach
grep -r "get_team_conf" --include="*.py" .

Length of output: 1035


Namespace retrieval update verified

  • In api/py/ai/chronon/utils.py (lines 331-337), the implementation correctly uses parse_teams.load_teams() as intended.
  • The commented-out old approach via teams.get_team_conf() remains only as a transitional note.
  • Other parts of the codebase still use the old interface, which aligns with the current incremental migration.
api/py/ai/chronon/repo/compilev3.py (3)

1-6: Import organization looks good.

Clean imports with logical grouping.


19-26: Error handling for config files looks good.

Clear error message when configuration files are missing.


33-34:

❓ Verification inconclusive

CLI invocation lacks chronon_root parameter.

When running directly, no path is provided to compile_v3().


🏁 Script executed:

#!/bin/bash
# Check if compile works without parameters
python -c "from ai.chronon.cli.compile.compiler import Compiler; from ai.chronon.cli.compile.compile_context import CompileContext; print('Compiler expects parameters:', Compiler.compile.__code__.co_varnames)"

Length of output: 333


CLI Parameter Verification Needed

The initial test failed due to PYTHONPATH issues, so we need to re-run our checks with the correct environment. Please execute the following scripts to verify whether the CLI invocation of compile_v3() is missing the required chronon_root parameter and to inspect its definition:

  • Re-run with PYTHONPATH set:

  • Locate the compile_v3 definition:

Once these outputs are available, we can conclusively determine if the CLI invocation should pass a chronon_root parameter.


🏁 Script executed:

#!/bin/bash
# Re-run ensuring PYTHONPATH is set.
PYTHONPATH=. python -c "from ai.chronon.cli.compile.compiler import Compiler; print('Compiler params:', Compiler.compile.__code__.co_varnames)"

Length of output: 391


🏁 Script executed:

#!/bin/bash
# Search for compile_v3 definition.
rg "def compile_v3(" -n .

Length of output: 230


CLI Invocation Parameter Issue – Manual Verification Needed

Our automated tests couldn’t load the module (ModuleNotFoundError) or locate the definition for compile_v3(). Please manually verify that the CLI invocation of compile_v3() includes the required chronon_root parameter and that the PYTHONPATH is correctly configured.

  • Confirm that the definition of compile_v3 expects a parameter for the chronon_root.
  • Ensure the CLI command passes the chronon_root path when run directly.
api/py/tox.ini (1)

11-15: Updated commands reflect new compilation approach.

Directory structure changed from 'production' to 'compiled', and now using the new compile command.

@david-zlai
Copy link
Contributor

Closing this PR in favor of #541

@david-zlai david-zlai closed this Mar 27, 2025
@david-zlai david-zlai deleted the nikhil/compile_switch branch May 12, 2025 19:36
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.

3 participants