Skip to content

black (and Python) is old #368

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

Closed
jaraco opened this issue Nov 24, 2019 · 5 comments · Fixed by #369
Closed

black (and Python) is old #368

jaraco opened this issue Nov 24, 2019 · 5 comments · Fixed by #369

Comments

@jaraco
Copy link
Member

jaraco commented Nov 24, 2019

This repo is failing me. I've submitted #364, but the CI tests fail (due to black apparently). I tried running pre-commit install to install the pre-commit steps and then running black on the code. When I run black the code, it reformats a bunch of stuff but won't commit. When I run black . on the repo, it reformats 12 files.

What steps do I need to execute to commit code that will pass tests on this repo?

@RonnyPfannschmidt
Copy link
Contributor

pre-commit intentionally does not commit
pre-commit run or pre-commit run -a should adapt the working directory to something commit-able

the pre-commit author is working on a git-hub action that will suggest/push changes to the repos

@jaraco
Copy link
Member Author

jaraco commented Nov 24, 2019

I'd tried that, but when I do, I get an error.

setuptools_scm feature/declarative-config $ pre-commit run --all-files                                                                                                    
[WARNING] Unexpected key(s) present on https://github.com/ambv/black => black: python_version
black....................................................................Failed
hookid: black

Traceback (most recent call last):
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/bin/black", line 10, in <module>
    sys.exit(main())
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/black.py", line 208, in main
    sources, line_length, fast, write_back, report, loop, executor
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete
    return future.result()
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/black.py", line 273, in schedule_formatting
    cache = read_cache(line_length)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/black.py", line 2514, in read_cache
    cache: Cache = pickle.load(fobj)
ValueError: unsupported pickle protocol: 5
Traceback (most recent call last):
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/bin/black", line 10, in <module>
    sys.exit(main())
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/black.py", line 208, in main
    sources, line_length, fast, write_back, report, loop, executor
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete
    return future.result()
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/black.py", line 273, in schedule_formatting
    cache = read_cache(line_length)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/black.py", line 2514, in read_cache
    cache: Cache = pickle.load(fobj)
ValueError: unsupported pickle protocol: 5
Traceback (most recent call last):
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/bin/black", line 10, in <module>
    sys.exit(main())
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/black.py", line 208, in main
    sources, line_length, fast, write_back, report, loop, executor
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete
    return future.result()
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/black.py", line 273, in schedule_formatting
    cache = read_cache(line_length)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/black.py", line 2514, in read_cache
    cache: Cache = pickle.load(fobj)
ValueError: unsupported pickle protocol: 5
Traceback (most recent call last):
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/bin/black", line 10, in <module>
    sys.exit(main())
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/black.py", line 208, in main
    sources, line_length, fast, write_back, report, loop, executor
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete
    return future.result()
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/black.py", line 273, in schedule_formatting
    cache = read_cache(line_length)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/black.py", line 2514, in read_cache
    cache: Cache = pickle.load(fobj)
ValueError: unsupported pickle protocol: 5
Traceback (most recent call last):
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/bin/black", line 10, in <module>
    sys.exit(main())
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/black.py", line 208, in main
    sources, line_length, fast, write_back, report, loop, executor
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete
    return future.result()
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/black.py", line 273, in schedule_formatting
    cache = read_cache(line_length)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/black.py", line 2514, in read_cache
    cache: Cache = pickle.load(fobj)
ValueError: unsupported pickle protocol: 5
Traceback (most recent call last):
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/bin/black", line 10, in <module>
    sys.exit(main())
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/black.py", line 208, in main
    sources, line_length, fast, write_back, report, loop, executor
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete
    return future.result()
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/black.py", line 273, in schedule_formatting
    cache = read_cache(line_length)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/black.py", line 2514, in read_cache
    cache: Cache = pickle.load(fobj)
ValueError: unsupported pickle protocol: 5
Traceback (most recent call last):
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/bin/black", line 10, in <module>
    sys.exit(main())
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/black.py", line 208, in main
    sources, line_length, fast, write_back, report, loop, executor
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete
    return future.result()
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/black.py", line 273, in schedule_formatting
    cache = read_cache(line_length)
  File "/Users/jaraco/.cache/pre-commit/repow9lp1l4h/py_env-python3.6/lib/python3.6/site-packages/black.py", line 2514, in read_cache
    cache: Cache = pickle.load(fobj)
ValueError: unsupported pickle protocol: 5

Trim Trailing Whitespace.................................................Passed
Fix End of Files.........................................................Passed
Check Yaml...............................................................Passed
Debug Statements (Python)................................................Passed
Flake8...................................................................Failed
hookid: flake8

src/setuptools_scm/config.py:117:44: E231 missing whitespace after ','

pyupgrade................................................................Passed

@jaraco
Copy link
Member Author

jaraco commented Nov 24, 2019

Looks like psf/black#875.

@jaraco
Copy link
Member Author

jaraco commented Nov 24, 2019

After manually clearing the cache, I was able to run black. It's a little annoying that it runs on an old Python (3.6) and old alpha black (18.4a4). Perhaps a future version could automatically use a late version of Python and black. Even better would be to integrate the black checks with the test so they're reported with the tests.

@jaraco jaraco changed the title unable to black the code black (and Python) is old Nov 24, 2019
@RonnyPfannschmidt
Copy link
Contributor

will bring the black declaration up to current standard after merging the pr

black isnt doing checks, its changing files, so i dont see a sanesible way to inntegrate it with the testsuite

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

Successfully merging a pull request may close this issue.

2 participants