Skip to content

Conversation

@sayalaruano
Copy link
Collaborator

@sayalaruano sayalaruano commented Jun 16, 2025

This structure would enable the support of various backend engines and separate the validation, style, and building logic for the plots.

Here is a diagram of the proposed project structure:

vuecore/
├── __init__.py
├── constants.py         # Defines global enums and constants (e.g., plot types, engine types)
├── engines/             # Manages all plotting backends
│   ├── __init__.py      # Engine registry and loading logic
│   ├── plotly/             
│   │   ├── __init__.py  # Registers Plotly engine components
│   │   ├── saver.py     # Functions to save Plotly figures
│   │   ├── theming.py   # Applies styles and themes to Plotly figures
│   │   ├── scatter.py   # Generates plotly scatter plots from data and config
│   │   └── ... 
├── plots/               # User-facing API
│   ├── basic/       
│   │   ├── scatter.py   # Creates scatter plots using schemas and engines
│   │   └── ...
│   ├── .../        
├── schemas/             # Pydantic models for validating plot configurations
│   ├── basic/          
│   │   ├── scatter.py  
│   │   └── ...
├── utils/               # Helper functions shared across the project
│   ├── statistics.py           
│   ├── validation.py    # Custom validation logic beyond Pydantic 
└── ...
tests/
├── test_scatter.py      # Unit and integration tests for scatter plot generation
│   
docs/
├── api_examples/       # Plot examples
│   ├── scatter_plot.py           
│   ├── scatter_plot.py    
└── ...

Also, here is the workflow:

User Code
    │
    ▼
plots/basic/scatter.py             # "Create scatter plot"
    │
    │ Uses
    ├──► schemas/basic/scatter.py  # Pydantic validation
    │                        │
    │                        └──► utils/validation.py    # Custom validation
    │
    │ Uses
    ├──► constants.py                     # Access plot types, engine types, etc.
    │
    │ Selects engine:
    ▼
engines/plotly/scatter.py       # Generate Plotly scatter plot from data + config
    │
    │ Uses
    ├──► engines/plotly/theming.py        # Apply theming
    │
    │ Uses
    ├──► utils/statistics.py              # Support for transformations, etc
    │
    │ Uses
    ▼
engines/plotly/saver.py              # Save plot (e.g., as PNG/HTML/JSON)

from typing import List


def validate_columns_exist(df: pd.DataFrame, required_columns: List[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.

This is a simple version of pandera. Let's discuss that tomorrow.

@enryH
Copy link
Collaborator

enryH commented Jun 17, 2025

I would add a small api-example in docs/api-examples/scatter.ipynb to highlight it in the docs. Maybe the current small test case is enough?

Copy link
Collaborator

@enryH enryH left a comment

Choose a reason for hiding this comment

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

I will need to see if it's easy to inspect the arguments of ScatterConfig in an interactive session. I will do this in a bit.

python: "3.12"
# apt_packages:
# - some-package
apt_packages:
Copy link
Collaborator

Choose a reason for hiding this comment

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

needs to be one indentation to the left I think

@sayalaruano sayalaruano merged commit adb72c7 into main Jun 25, 2025
8 checks passed
@sayalaruano sayalaruano deleted the refactor-scatter branch June 25, 2025 12:47
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