Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
PEP8-format generated revisions #307
Michael Bayer (@zzzeek) wrote:
see also https://bitbucket.org/zzzeek/alembic/pull-request/11/changed-autogenerated-code-so-it-fits-80/diff. line length is very tough. E2 rules should be working as well as E11*, but for E12, E13, E3, E5, I'm not optimistic this is ever going to be "fixed". I know there are code formatters but those are going to just create more headaches.
jmagnusson (@jmagnusson) wrote:
What about having one argument per line of a function call in the generated code? Should fix most problems of non PEP-8 compliant code. Example with what I mean:
op.alter_column( 'blocki18n', 'links_to_text', existing_type=sa.TEXT(), server_default='', nullable=False )
ukrutt (@ukrutt) wrote:
UPDATE: oops, sorry, saw now that this code has changed in
** please disregard comments below... **
It looks like a fair amount of work was done on this leading up to https://bitbucket.org/zzzeek/alembic/commits/tag/rel_0_8_9. I still get a few
These are due to this code in the top of the generated file:
# revision identifiers, used by Alembic. revision = '175a74063cca' down_revision = '99c454c52997' branch_labels = None depends_on = None from alembic import op import sqlalchemy as sa
(specifically, the two imports.) It seems like this is a fairly straightforward thing to fix; however I'm new to this code in particular (and autogenerated code in general...)
Wes Downey wrote:
Here is another example:
This fails linting for these two rules:
The passing format would be like this:
Mike Waites (@mikeywaites) wrote:
I've recently started helping Mike out with sqlalchemy and alembic. On first inspection I agree with @ThiefMaster
Would solve the vast majority of peps -- That said there might be things I'm over looking. I'll get started on this on Tuesday and try and get a couple of "worst case scenario" tests cases together that highlight the issues. From there, the rendering of op instructions is fairly centralised so it should be fairly straight forward to prove out.
The work here will certainly be trying to produce test cases that produce all of the formatting issues. Perhaps it would make sense to deal with the really obvious ones first rather than going to deep.
It would be a great help if anyone interested in this fix could list any pep errors they have encountered not already listed above.
I'll report back here with my findings.
hoping there's still some people interested in this. I've been (very slowly) getting through some of these tickets and would love some feedback/testing on the proposed solution linked above.
The plan is to provide formatting via some simple hooks (with a couple of popular options baked in) to allow users to specify a third party library that alembic can defer formatting to. We think this is the best option as it means all the various nuances of pep8 can be catered for by libraries that will do a much better job than we will
I'm hoping to get this merged next week so any help before then would be greatly appreciated.