Commit Graph

17 Commits

Author SHA1 Message Date
Mike Bayer 9f16251b64 lock down format_docs_code.py to specific paths
the script too quick to pick up on dot directories,
random .py files I have in my local checkout, etc.

Change-Id: I6eb66ddd3598495a420d9e4fc0f644b60fb3ec6d
2025-09-29 11:56:05 -04:00
Federico Caselli fb5e64c51a add example to update from that uses values
Change-Id: Ic02a722be9a30851a87e0da4759c728e86fb22c8
References: #11768
2025-06-24 17:43:43 -04:00
Federico Caselli e6b0b421d6 General improvement on annotated declarative
Fix issue that resulted in inconsistent handing of unions
depending on how they were declared

Consistently support TypeAliasType. This has required a revision
of the implementation added in #11305 to have a consistent
behavior.

References: #11944
References: #11955
References: #11305
Change-Id: Iffc34fd42b9769f73ddb4331bd59b6b37391635d
2024-12-12 22:06:48 +01:00
Federico Caselli d539bc3a0f update the format_docs_code to also work on python files
Change-Id: I0a6c9610b3fd85365ed4c2c199e3cad87ee64022
2024-11-30 21:10:21 +01:00
Federico Caselli 73344fd0d3 Fix select.with_only_columns type hints
Fixes: #11782
Change-Id: Idce218a9730986d3ca70547c83aa1c0f8b5ee5b2
2024-08-28 21:52:30 +02:00
Federico Caselli 058c230cea Update black to v23.3.0 and flake8 to v6
This change could be added to .git-blame-ignore-revs

Change-Id: I7ba10052b26bc3c178d23fb50a1123d0aae965ca
2023-05-30 21:44:26 +02:00
Mike Bayer cd96ffe287 refactor code generation tools , include --check command
in particular it looks like CI was not picking up on the
"git diff" oriented commands, which were failing to run due
to pathing issues.  As we were setting cwd for black/zimports
relative to sqlalchemy library, and tox installs it in
the venv, black/zimports would fail to run from tox, and
since these are subprocess.run we didn't pick up the
failure.

This overall locks down how zimports/black are run
so that we are definitely from the source root, by using
the location of tools/ to determine the root.

Fixes: #8892
Change-Id: I7c54b747edd5a80e0c699b8456febf66d8b62375
2023-01-18 15:07:55 -05:00
Federico Caselli dce11383f8 Improve sql formatting
change {opensql} to {printsql} in prints, add missing markers

Change-Id: I07b72e6620bb64e329d6b641afa27631e91c4f16
2023-01-11 20:24:29 +01:00
Federico Caselli 25c2b7dd10 Add new script to sync test files adding future annotation
Create a new test file test_tm_future_annotations_sync.py that's obtained
from test_tm_future_annotations.py by using the new script sync_test_files.
This files includes the ``from __future__ import annotations``

It also turns out we had some bugs in there and we can also support some
additional typing things

Change-Id: Iac005df206d45a55345d9d88d67a80ce799d449f
2022-11-26 19:25:37 +01:00
Federico Caselli 4eb4ceca36 Try running pyupgrade on the code
command run is "pyupgrade --py37-plus --keep-runtime-typing --keep-percent-format <files...>"
pyupgrade will change assert_ to assertTrue. That was reverted since assertTrue does not
exists in sqlalchemy fixtures

Change-Id: Ie1ed2675c7b11d893d78e028aad0d1576baebb55
2022-11-16 23:03:04 +01:00
Mike Bayer d4b8b41832 update executemany for new features
also fixes issue in format_docs_code which didn't work with
pre-commit for more than one file.  will backport

Fixes: #8597
Change-Id: I21b2625514987b1cd90f7c00f06e72e57e257390
2022-10-11 15:29:15 -04:00
Federico Caselli 153a95a38d Add format docs to pre-commits
Change-Id: Ia41399155ee0ec1b878aebf18967eabe38f5afd1
2022-10-06 22:53:37 +02:00
Federico Caselli a5252fa366 Remove all formatting errors
Improve format docs script, replace {sql} with {opensql}

Change-Id: Ie1aaa8f3d8ff8f8e89b7b5149a1876d9f8a211ed
2022-10-03 17:44:20 +02:00
Mike Bayer 7051dc5842 detect {opensql} and {stop} sections
this so that I can still have
{opensql} and {stop} sections in non-console python.

this isn't the norm but I would prefer if I dont have to
be 100% strict about it

also maintaining {sql} / {stop} being at the start
of a code line.  this is more prevalent in 1.4.

Change-Id: Iaf748b7ff1120e21f729c2fd794d9b8a33d83170
2022-10-02 14:16:34 -04:00
Federico Caselli 04a72ff3a9 Add proper code block formatting
Change-Id: I63585eeae0b0bc78109da64520696928dfb3982c
2022-10-02 11:51:02 -04:00
Federico Caselli dcbda9f1ea Improvements to code formatter
Change-Id: I75cf7143f3ed3bbc09aa8bc18edbce5c8af0f0be
2022-10-02 10:55:42 -04:00
Federico Caselli 23dbf572ce Format code in the rst docs file
Added script to format code in the rst documentation using black.
This is also added to the lint tox job to ensure that the code
in the docs is properly formatted.

Change-Id: I799444f22da153484ca5f095d57755762348da40
2022-09-30 14:39:48 -04:00