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

primer.json is not installed #2153

Closed
hroncok opened this issue Apr 27, 2021 · 5 comments · Fixed by #2154
Closed

primer.json is not installed #2153

hroncok opened this issue Apr 27, 2021 · 5 comments · Fixed by #2154
Labels
C: packaging Installation and packaging of Black T: bug Something isn't working

Comments

@hroncok
Copy link
Contributor

hroncok commented Apr 27, 2021

Describe the bug The black-primer tool uses primer.json on runtime, but the file is not installed.

To Reproduce Steps to reproduce the behavior:

[tmp]$ python -m venv venv
[tmp]$ . venv/bin/activate
(venv) [tmp]$ pip install black
...
Installing collected packages: toml, click, appdirs, mypy-extensions, pathspec, regex, black
Successfully installed appdirs-1.4.4 black-21.4b1 click-7.1.2 mypy-extensions-0.4.3 pathspec-0.8.1 regex-2021.4.4 toml-0.10.2
(venv) [tmp]$ which black-primer
~/tmp/venv/bin/black-primer
(venv) [tmp]$ black-primer
Usage: black-primer [OPTIONS]
Try 'black-primer -h' for help.

Error: Invalid value for '-c' / '--config': Path '/home/churchyard/tmp/venv/lib64/python3.9/site-packages/black_primer/primer.json' does not exist.

Expected behavior site-packages/black_primer/primer.json should be installed

Environment (please complete the following information):

  • Version: at least 20.8b1 to 21.4b1 but possible any
  • OS and Python version: Fedora Linux / Python 3.9.4 (but also happens on any other version)

Does this bug also happen on master? Yes

(venv) [tmp]$ SETUPTOOLS_SCM_PRETEND_VERSION=21.5 pip install -U https://github.com/psf/black/archive/refs/heads/master.zip
...
Successfully installed black-21.5
(venv) [tmp]$ black-primer
...

Error: Invalid value for '-c' / '--config': Path '/home/churchyard/tmp/venv/lib64/python3.9/site-packages/black_primer/primer.json' does not exist.
@hroncok hroncok added the T: bug Something isn't working label Apr 27, 2021
@hroncok
Copy link
Contributor Author

hroncok commented Apr 27, 2021

Working on a fix

@ichard26
Copy link
Collaborator

A simple package_data mod should fix it:

black/setup.py

Line 67 in 1728bb4

package_data={"blib2to3": ["*.txt"], "black": ["py.typed"]},

Thanks for noticing!

@hroncok
Copy link
Contributor Author

hroncok commented Apr 27, 2021

Yes, I have that ready, now going trough https://github.com/psf/black/blob/master/CONTRIBUTING.md

hroncok added a commit to hroncok/black that referenced this issue Apr 27, 2021
@hroncok
Copy link
Contributor Author

hroncok commented Apr 27, 2021

Ready in #2154

@cooperlees
Copy link
Collaborator

This is interesting. I didn't package the config, as I would expect anyone running it locally to want to run their own configs on their own projects. E.g. $ORG has 10 black repos, before bringing in a new version or as a check primer could check to see if everything is black compliant.

I can see the benefit of including this default config tho. So will accept the PR. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: packaging Installation and packaging of Black T: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants