Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardized checks #685

Open
dsmedia opened this issue Feb 22, 2025 · 3 comments · May be fixed by #687
Open

Standardized checks #685

dsmedia opened this issue Feb 22, 2025 · 3 comments · May be fixed by #687

Comments

@dsmedia
Copy link
Collaborator

dsmedia commented Feb 22, 2025

The vega-datasets repository currently lacks a straightforward, documented way to run code quality checks locally that match CI checks (.github/workflows/test.yml). This diverges from projects like Altair (@dangotbanned) that use uv and taskipy for an efficient developer workflow. Such an approach paves the way for a very user-friendly CONTRIBUTING.md in Altair.

Current Situation

Currently, developers can run each CI check manually using separate commands:

# TOML formatting check
uvx taplo fmt --check --diff
# Python linting
uvx ruff check
# Python formatting check
uvx ruff format --check

While this works, it's cumbersome to run multiple commands and inconsistent with related projects like Altair that provide a single command for all checks. There's no documented way to run all checks with one command.

Proposed Solutions

Option 1: Shell Script

A simple, direct approach:

  1. Create run_checks.sh:
#!/bin/bash
set -e
uvx taplo fmt --check --diff
uvx ruff check
uvx ruff format --check
echo "All checks passed!"
  1. Usage: ./run_checks.sh

Advantages:

  • No additional dependencies needed
  • Simple to understand and maintain
  • Directly mirrors CI commands
  • Quick to implement
  • Easy to modify or extend

Option 2: Full taskipy Implementation

Adopt an Altair-like taskipy setup for better structure and extensibility:

  1. Add to pyproject.toml dependency groups:
[dependency-groups]
dev = ["taskipy>=1.14.1"]
  1. Define individual tasks:
[tool.taskipy.tasks]
check-toml = "taplo fmt --check --diff"
check-lint = "ruff check"
check-format = "ruff format --check"
checks = "task check-toml && task check-lint && task check-format"
  1. Usage: uv run task checks

Advantages:

  • Structured approach matching Altair
  • Centralized task definitions
  • Extensible for future additions
  • Familiar interface for Altair contributors (uv run task ...)

Disadvantages:

  • Slightly more complex initial setup (though minimal)

What approach would work best?

@dangotbanned
Copy link
Member

@dsmedia I listed some alternatives in the description for vega/altair#3723

I would strongly recommend avoiding using shell scripts as they introduce cross-platform complexity.

Most of that PR was trying to find things that can run anywhere and don't require learning a new DSL

@dangotbanned
Copy link
Member

If you went with taskipy, this would already get you most of the way there #664 (comment)

(If there's concerns over initial setup)

@dsmedia
Copy link
Collaborator Author

dsmedia commented Feb 22, 2025

Given this is a low-velocity repository, taskipy seems like a bit more than we need right now as an interim step while we wait for native uv task support. Maybe we just document the current workflow in the README?

uvx taplo fmt --check --diff
uvx ruff check
uvx ruff format --check

dsmedia added a commit that referenced this issue Feb 22, 2025
Document standardized check commands in README for local development.
This provides a simple interim solution for running quality checks
that match CI, without introducing additional dependencies.

Closes #685
dsmedia added a commit that referenced this issue Feb 22, 2025
Document standardized check commands in README for local development.
This provides a simple interim solution for running quality checks
that match CI, without introducing additional dependencies.

Closes #685
@dsmedia dsmedia linked a pull request Feb 22, 2025 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants