Skip to content

D103 linter warnings from script.py.mako templates #1567

@peterjc

Description

@peterjc

Describe the bug

Scripts created under <project>/alembic/versions/<name>.py from the Mako template fail the pydocstyle D103 style check, e.g. via flake8 or ruff check:

Expected behavior

The templates would include minimal docstrings for the upgrade and downgrade functions.

To Reproduce

Followed the tutorial, having enabled ruff check in alembic.ini and then run this with a trailing dot in the message to avoid D400 or D415.

$ alembic revision -m "Original schema."

Or without using this via the configuration, follow that with:

$ ruff check --select D103  */alembic/versions/*.py
xxx/alembic/versions/7c4c8748a5e0_original_schema.py:39:5: D103 Missing docstring in public function
   |
39 | def upgrade() -> None:
   |     ^^^^^^^ D103
40 |     pass
   |

xxx/alembic/versions/7c4c8748a5e0_original_schema.py:43:5: D103 Missing docstring in public function
   |
43 | def downgrade() -> None:
   |     ^^^^^^^^^ D103
44 |     pass
   |

Found 2 errors.

Error

# Copy error here. Please include the full stack trace.

Versions.

  • OS: macOS
  • Python: 3.12
  • Alembic: 1.14.0
  • SQLAlchemy: 2.0.35
  • Database: Sqlite
  • DBAPI:

Additional context

PR to follow.

Have a nice day!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions