Skip to content

Add experimental floweaver "compiler"#139

Merged
ricklupton merged 11 commits intomasterfrom
spec-executor
Feb 8, 2026
Merged

Add experimental floweaver "compiler"#139
ricklupton merged 11 commits intomasterfrom
spec-executor

Conversation

@ricklupton
Copy link
Owner

This introduces a compiler that takes a SankeyDefinition and "compiles" it to a "spec" which includes all the information needed to actually create a Sankey diagram from a particular dataset later.

Testing compares results from the new version with the original code for a variety of input definitions and datasets.

As part of this, also made a lot of updates to typing, linting, formatting of files to bring the code up to date and easier to work with. This includes switching from setup.py to pyproject.toml and updating minimum Python version.

One change to existing code logic about how Elsewhere stubs are handled when added implicitly; I think this was a bug in the previous version.

Older sphinx wasn't compatible with newer Python versions.  Also moved
the source code into the src/ subdirectory for better package layout.
I'm not sure why this wasn't causing a problem before, but it seems to
be needed; original Elsewhere bundles are added like this when building
the original view graph.

Motivated by adding compiler implementation
This introduces a compiler that takes a SankeyDefinition and "compiles"
it to a "spec" which includes all the information needed to actually
create a Sankey diagram from a particular dataset later.

Testing compares results from the new version with the original code for
a variety of input definitions and datasets.

The implementation uses a routing tree-based approach which should be
O(rows × tree_depth), rather the (perhaps more obvious) approach based
on filtering dataset rows, like the current implementation, which is
less efficient for large diagrams/datasets -- O(rows × edges).
@codecov-commenter
Copy link

codecov-commenter commented Feb 8, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 81.85028% with 257 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.30%. Comparing base (a382db0) to head (3f794b1).
⚠️ Report is 12 commits behind head on master.

Files with missing lines Patch % Lines
src/floweaver/graph_to_sankey.py 0.00% 66 Missing ⚠️
src/floweaver/compiler/selection_router.py 72.05% 29 Missing and 9 partials ⚠️
src/floweaver/compiler/partition_router.py 63.51% 26 Missing and 1 partial ⚠️
src/floweaver/compiler/rules.py 85.53% 19 Missing and 4 partials ⚠️
src/floweaver/compiler/execute.py 87.50% 7 Missing and 9 partials ⚠️
src/floweaver/dataset.py 66.66% 14 Missing ⚠️
src/floweaver/compiler/__init__.py 90.51% 6 Missing and 5 partials ⚠️
src/floweaver/compiler/tree.py 89.01% 1 Missing and 9 partials ⚠️
src/floweaver/compiler/combined_router.py 92.74% 4 Missing and 5 partials ⚠️
src/floweaver/results_graph.py 92.79% 5 Missing and 3 partials ⚠️
... and 9 more
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@             Coverage Diff             @@
##           master     #139       +/-   ##
===========================================
+ Coverage    0.00%   82.30%   +82.30%     
===========================================
  Files          18       26        +8     
  Lines        1035     2034      +999     
  Branches        0      385      +385     
===========================================
+ Hits            0     1674     +1674     
+ Misses       1035      277      -758     
- Partials        0       83       +83     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ricklupton ricklupton merged commit 5213d33 into master Feb 8, 2026
5 checks passed
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