All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Jupyter server extension:
pip install sqlnbfmtnow auto-registers with jupyterlab-code-formatter — no manual config needed
- Switched build system from setuptools to hatchling
- Updated JupyterLab docs to use
jupyter_server_config.py(modern) instead ofjupyter_notebook_config.py(legacy)
- Marimo notebook support: format SQL in Marimo
.pynotebooks viamo.sql()calls — samesqlnbfmtcommand, auto-detected by file extension - Python file support:
sqlnbfmtnow accepts.pyfiles alongside.ipynb— works on any Python file containing SQL strings - JupyterLab integration:
sqlnbfmt.jupyterlab_integration.register()for use withjupyterlab-code-formatter format_cell_source()public API for formatting a single cell's source code_format_python_source(),process_python_file(),diff_python_file()public API for programmatic usesqladded to default recognized function names (matchesmo.sql(), etc.)sqlnbfmt-pyandsqlnbfmt-py-checkpre-commit hooks for Python files- Marimo eval fixtures:
marimo_basic_sql,marimo_fstring_interpolation,marimo_complex_sql,marimo_multi_cell_mixed,marimo_comment_preservation,marimo_multi_statement,marimo_skip_hint,marimo_non_sql_unchanged,marimo_idempotency
- Idempotency: already-formatted SQL in triple-quoted strings (with leading whitespace/indentation) is no longer re-formatted on every run
- CLI description and help text updated to reflect multi-format support
- Project description and keywords updated for Marimo discoverability
- Multiple SQL statements in a single cell are no longer concatenated on one line — each statement now starts on its own line after the
;separator (#3)
- SQL parsing switched from
sqlglot.parse_one()tosqlglot.parse()to correctly handle multi-statement inputs
multi_statementeval fixture case coveringDROP TABLE+CREATE TABLEsequences
diff_notebook()no longer duplicates cell-processing logic — extracted shared_format_cells()helper to prevent future divergence--check --diffcombined mode no longer double-counts notebooks or processes them twice- Skip hint (
# sqlnbfmt: skip) no longer triggers on string literals containing the directive — only dedicated comment lines are recognised load_config()with a partial config file (missing keys) now falls back to built-in defaults instead of empty setsload_config()with an empty YAML file no longer raisesAttributeError- In-function SQL indentation now respects
indent_widthconfig instead of hardcoded 4 spaces
main()integration tests for--diff,--check, and--check --diffexit code behavior- Docstring on
_has_skip_hint()clarifying that inline trailing comments are intentionally ignored
- Zero-config defaults: sqlnbfmt now works out of the box without a
config.yamlfile — built-in defaults for SQL keywords, function names, and decorators --checkmode: verify formatting without modifying files; exits with code 1 if changes are needed (CI-friendly)--diffmode: print a unified diff of formatting changes without modifying files- Skip hints: add
# sqlnbfmt: skipto any cell to skip formatting sqlnbfmt-checkpre-commit hook: a read-only hook variant for CI pipelines- Cell index in all warning/debug messages for easier debugging
- PyPI keywords and project URLs in package metadata
skip_hinteval fixture case
--configargument is now optional (defaults to built-in settings instead of requiringconfig.yaml)load_config()acceptsNoneto return defaults; passing a missing path still raisesFileNotFoundError- Version bumped to 0.3.0
- Python comments in code cells are no longer stripped during formatting (#2)
- Replaced AST-mutation approach (
ast.NodeTransformer+astor+black) with surgical string replacement (ast.NodeVisitor+ offset-based text splicing), preserving all non-SQL content exactly - Removed
astorandblackfrom dependencies — fewer install requirements - CI publish now uses PyPI Trusted Publishers (OIDC) instead of API tokens
- Migrated
tool.uv.dev-dependenciestodependency-groups.dev(PEP 735) - Updated
actions/checkoutfrom v3 to v4
- Python 3.13 classifier
- Comment-preservation test case
- Typo in config.yaml:
exeucte_query→execute_query
- Updated dependencies (attrs, black, referencing, sqlglot, typing-extensions)
- First-line indentation error for in-function SQL
- New-line handling issues in formatted output
- Introduced
blackformatter to resolve in-function SQL formatting edge cases
- Pre-commit hook support
- F-string SQL formatting (with and without variables)
- In-function SQL formatting (e.g.,
pd.read_sql(...))
- Initial release
- SQL formatting in Jupyter notebook code cells using sqlglot
- Support for
%sql/%%sqlmagic commands - Configurable SQL keywords, function names, and formatting options
- GitHub Actions CI pipeline