Skip to content

Increase Type Checking #26

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

Merged

Conversation

duragdatadude
Copy link
Contributor

Summary (AI-Generated)

This PR introduces type hint improvements, code cleanup, and enhanced development tooling. The changes focus on modernizing type hints, improving code quality, and adding new development commands.

Key Changes

  • Modernized type hints across the codebase to use Python 3.12 syntax

    • Replaced Optional[T] with T | None
    • Replaced Union[T1, T2] with T1 | T2
    • Added explicit return types to functions
    • Updated collection type hints (List → list, Dict → dict, etc.)
  • Enhanced development tooling

    • Added new Makefile commands:
      • clean-db: Cleans database tables while preserving source tables
      • sqlmesh-plan and sqlmesh-run: Direct SQLMesh commands
      • clean-dev: Combined command for database and Dagster cleanup
    • Improved Dagster development command with better path handling
  • Extended .gitignore

    • Added Dagster-specific directories to ignore:
      • storage/
      • logs/
      • history/
      • schedules/

Implementation Details

  • The type hint updates follow modern Python best practices and improve static type checking
  • Reorganized imports for better readability and consistency
  • Added proper return type annotations to test fixtures and utility functions
  • The new Makefile commands provide better development workflow and database management
  • Dagster command improvements handle Windows paths correctly using subst in Makefile

The changes are primarily focused on maintainability and developer experience, with no functional changes to the core logic.

KLonge added 3 commits March 21, 2025 19:18
- Add new directories to .gitignore for Dagster project storage, logs, history, and schedules.
- Modify Makefile to support Windows environments and add new clean commands for Dagster and database.
- Update pyproject.toml to change version to 0.8.0 and add new dependencies for FastAPI and SSE-Starlette.
- Refactor type hints across multiple files to use modern syntax and improve consistency.
- Enhance console and event handling in dagster_sqlmesh for better logging and event management.
- Clean up imports and ensure proper typing throughout the codebase.
- Update sample project definitions for compatibility with new changes.
- Update type hints to use modern syntax throughout the file.
- Clean up and reorganize import statements for better clarity.
- Enhance function signatures with appropriate return types.
- Ensure consistency in typing for fixtures and context classes.
- Unified command definitions for Python, SQLMESH, and UV to streamline setup.
- Removed Windows-specific command handling for a cleaner and more consistent configuration.
- Simplified activation and deactivation commands for the virtual environment.
- Simplified assertion statements in the test_restating_models function for better clarity.
- Enhanced readability by formatting assertions with inline messages.
- Maintained existing test logic and functionality.
@duragdatadude duragdatadude changed the title Increase Type Checking V2 Increase Type Checking Mar 21, 2025
rm -rf sample/dagster_project/storage sample/dagster_project/logs sample/dagster_project/history

clean-db:
$(PYTHON_CMD) -c "import duckdb; conn = duckdb.connect('db.db'); [conn.execute(cmd[0]) for cmd in conn.execute(\"\"\"SELECT 'DROP TABLE ' || table_schema || '.' || table_name || ' CASCADE;' as drop_cmd FROM information_schema.tables WHERE table_schema != 'sources' AND table_schema != 'information_schema' AND table_type = 'BASE TABLE'\"\"\").fetchall()]; [conn.execute(cmd[0]) for cmd in conn.execute(\"\"\"SELECT 'DROP VIEW ' || table_schema || '.' || table_name || ' CASCADE;' as drop_cmd FROM information_schema.tables WHERE table_schema != 'sources' AND table_schema != 'information_schema' AND table_type = 'VIEW'\"\"\").fetchall()]; conn.close()"
Copy link
Member

Choose a reason for hiding this comment

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

Hrm, I'd prefer if this was just a python script we called but I'll accept this for now.

@ravenac95 ravenac95 added this pull request to the merge queue Mar 24, 2025
Merged via the queue into opensource-observer:main with commit 2be6d82 Mar 24, 2025
2 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.

3 participants