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

dependency_tree broken tomli<2.0.0,>=0.2.6, it should be using latest version 2.0.0 #2703

Closed
roshanguptamca opened this issue Dec 16, 2021 · 16 comments · Fixed by #2718
Closed
Labels
C: dependencies C: packaging Installation and packaging of Black T: bug Something isn't working

Comments

@roshanguptamca
Copy link

Describe the bug
black 21.12b0 requires tomli<2.0.0,>=0.2.6, but you have tomli 2.0.0 which is incompatible.

To Reproduce

For example, take this code:

this = "code"

And run it with these arguments:

$ black file.py --target-version py39

The resulting error is:

cannot format file.py: INTERNAL ERROR: ...

Expected behavior

Environment

  • Black's version:
  • OS and Python version:

Additional context

@roshanguptamca roshanguptamca added the T: bug Something isn't working label Dec 16, 2021
@roshanguptamca roshanguptamca changed the title dependency_tree broken dependency_tree broken tomli<2.0.0,>=0.2.6, it should be using latest version 2.0.0 Dec 16, 2021
@MarcoGorelli
Copy link
Contributor

You'll have to downgrade your version of tomli, due to the upper bound on tomli in black

@JelleZijlstra
Copy link
Collaborator

We can probably allow tomli 2 (mypy did the same recently).

@MarcoGorelli
Copy link
Contributor

likewise pytest pytest-dev/pytest#8881

@ichard26
Copy link
Collaborator

I'm pretty sure @hukkin, the author behind tomli, is the one who put this pin here, would probably be a good idea to ask them to weigh in.

@ichard26 ichard26 added C: dependencies C: packaging Installation and packaging of Black labels Dec 16, 2021
@hukkin
Copy link
Contributor

hukkin commented Dec 16, 2021

Black is fully compatible with Tomli v2 starting from this PR here https://github.com/psf/black/pull/2431/files

Also, now that I had my one (and hopefully only) chance to make breaking changes to the API, I don't really object removing the upper pinning altogether. In case I find the need to break API in the future I'll try to do at least a year long deprecation period before.

Note that PR #2408 includes moving the upper pin if you are otherwise happy with the changes there.

@hukkin
Copy link
Contributor

hukkin commented Dec 16, 2021

BTW just out of curiosity: Do I deduce correctly from this issue that Black checks its dependency versions at runtime? Is that really necessary? Wouldn't it be better to leave dependency checking to the installer (typically pip) and make Black use whatever versions are available? And consider issues like this an error on user/environment/installer side.

@MarcoGorelli
Copy link
Contributor

BTW just out of curiosity: Do I deduce correctly from this issue that Black checks its dependency versions at runtime? Is that really necessary? Wouldn't it be better to leave dependency checking to the installer (typically pip) and make Black use whatever versions are available? And consider issues like this an error on user/environment/installer side.

pretty sure the error here comes at installation, the $ black file.py --target-version py39 in the issue is part of the issue template

@JelleZijlstra
Copy link
Collaborator

Do I deduce correctly from this issue that Black checks its dependency versions at runtime? Is that really necessary?

It doesn't. If you are talking about the cannot format file.py: INTERNAL ERROR line, that's part of the issue template. If you're reporting a bug, please don't keep that part around if you don't actually get an internal error.

@roshanguptamca
Copy link
Author

You'll have to downgrade your version of tomli, due to the upper bound on tomli in black

Yes thanks for reply, We did it as of now to go further until having permanent soluton.

@intgr
Copy link

intgr commented Dec 30, 2021

The version pin was changed in #2408, this can be closed.

@ssbarnea
Copy link
Contributor

ssbarnea commented Jan 4, 2022

The fact that it was fixed in main branch is not of much use for most users. This kind of issue is one of the few good reasons for fast-tracking a patch release.

@cbrnr
Copy link

cbrnr commented Jan 25, 2022

Now that black is a required dependency of ipython I think it would be even more important to push a new release rather sooner than later.

@felix-hilden
Copy link
Collaborator

felix-hilden commented Jan 25, 2022

We're releasing this week! But do note that it's our first non-beta, so it can't really be expedited.

@cbrnr
Copy link

cbrnr commented Jan 25, 2022

That's great to hear, thank you ❤️!

@merisbahti
Copy link

is there any workaround?

@MarcoGorelli
Copy link
Contributor

is there any workaround?

could install directly from GitHub, pip install git+https://github.com/psf/black@32dd9ec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: dependencies 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.

10 participants