Skip to content
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

different behavior in different python3 version #214

Closed
trim21 opened this issue Oct 19, 2019 · 4 comments
Closed

different behavior in different python3 version #214

trim21 opened this issue Oct 19, 2019 · 4 comments

Comments

@trim21
Copy link

trim21 commented Oct 19, 2019

I'm using pyupgrade in my project, and I run pre-commit run --all-files on my CircleCI with multi python version including 3.6, 3.7, and 3.8.

(And I'm developing under python3.7)

But I found it only fails only in 3.8.0 with hook pyupgrade .

repos:
  - repo: local
    hooks:
      - id: pyupgrade
        name: pyupgrade
        entry: pyupgrade
        require_serial: true
        language: python
        types: [python]
        args: ['--py36-plus']

(I manager my pyupgrade version with package manager and its 1.25.0)

 def print_version():
-    return '''BGmi %sver. %s%s built by %sRicterZ%s with ❤️
+    return '''BGmi {}ver. {}{} built by {}RicterZ{} with ❤️

 Github: https://github.com/BGmi/BGmi
 Email: ricterzheng@gmail.com
-Blog: https://ricterz.me''' % (YELLOW, __version__, COLOR_END, YELLOW, COLOR_END)
+Blog: https://ricterz.me'''.format(YELLOW, __version__, COLOR_END, YELLOW, COLOR_END)
@asottile
Copy link
Owner

I fixed a bug in python3.8 -- the older python versions have a bug which means they can't figure out where the triple quoted string literal exists

@asottile
Copy link
Owner

btw your local hook isn't using the package manager there, it's installing an unpinned copy from pypi

I would strongly suggest not doing that, here's a bunch of reasons -- including the repeatability one. Plus, pyupgrade has first class support for pre-commit

@trim21
Copy link
Author

trim21 commented Oct 19, 2019

@asottile Thank you very much. I thought it's called from PATH.

I read your comment on psf/black#1073. In fact, that's why I'm doing this(I mean with a package manager, not mistaking using unpinned copy from pypi).

I'm also using dependabot to upgrade my python dependencies version including pyupgrade, and all package versions are pinned. So it expected to be both pinned and updated automatically. And it will be repeatable at certain commit if I make sure all packages are installed with the same version, which poetry can help with that.

Although 'pyupgrade has first-class support for pre-commit', but I have to manually check if there is a new release, it's annoying.

Look like the only thing I need to do is changing the language: python to language: system

@asottile
Copy link
Owner

sure, but you're missing the entire point of pre-commit w/ that (and making it harder for your contributors!)

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

No branches or pull requests

2 participants