Skip to content

Polars/phase 1 setup and pilot#1046

Draft
EngCaioFonseca wants to merge 2 commits intopolars/phase-0-anti-patternsfrom
polars/phase-1-setup-and-pilot
Draft

Polars/phase 1 setup and pilot#1046
EngCaioFonseca wants to merge 2 commits intopolars/phase-0-anti-patternsfrom
polars/phase-1-setup-and-pilot

Conversation

@EngCaioFonseca
Copy link
Copy Markdown
Contributor

PR of the series of migrating pandas to polars in 8knot

Generative AI disclosure

  • This contribution was assisted or created by Generative AI tools.
    • What tools were used?
    • How were these tools used?
    • Did you review these outputs before submitting this PR?

Phase 1 - Preparation:
- Add polars~=1.30 to pyproject.toml
- Create polars_utils.py adapter layer with:
  - to_polars(): Pandas -> Polars conversion
  - to_pandas(): Polars -> Pandas conversion
  - process_with_polars(): Auto-wrap for Polars processing
  - lazy_process(): Lazy evaluation wrapper
  - Expressions class: Common reusable expressions

Phase 2 - Pilot Conversion:
- Convert repo_general_info.py to use 'Polars Core, Pandas Edge' pattern
  - All data processing now uses Polars expressions
  - Converts to Pandas only at visualization boundary
  - Uses pl.col(), .with_columns(), .filter(), .select()
  - Demonstrates the migration pattern for other modules

Architecture pattern established:
  Database -> Polars (fast) -> Pandas (Plotly/Dash boundary)

Next: Apply same pattern to remaining visualization modules
Continue Phase 2 - Converting repo_overview visualizations:

code_languages.py:
- SVG line count fix using pl.when().then().otherwise()
- Language grouping with threshold using Polars expressions
- Aggregation using group_by().agg()
- Percentage calculations with Polars

ossf_scorecard.py:
- Extract process_data() function for clean separation
- Date handling with Polars datetime
- Column renaming with pl.when() for conditional logic
- Sort and rename operations in Polars

Pattern: All data processing in Polars, to_pandas() only at visualization boundary

3 of ~40 visualization modules now use Polars core processing
@EngCaioFonseca EngCaioFonseca self-assigned this Dec 19, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Dec 19, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch polars/phase-1-setup-and-pilot

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@EngCaioFonseca EngCaioFonseca moved this to Testing | Waiting on PR response | Blocked in Aspen Project Board Jan 26, 2026
@EngCaioFonseca EngCaioFonseca moved this from Testing | Waiting on PR response | Blocked to "On Deck" in Aspen Project Board Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: "On Deck"

Development

Successfully merging this pull request may close these issues.

1 participant