Giter Site home page Giter Site logo

Comments (2)

JelleZijlstra avatar JelleZijlstra commented on June 20, 2024 1

Thanks @bobwhitelock!

I don't think Black should attempt to parse the Poetry-specific section in pyproject.toml. However, I would support adding a note in the docs to address this issue.

from black.

bobwhitelock avatar bobwhitelock commented on June 20, 2024

I ran into the same issue, but I think it's not actually a bug as the action is operating as documented, though it is a bit of a gotcha when using this with Poetry.

The docs say: "To read the version from the pyproject.toml file instead, set use_pyproject to true. This will first look into the tool.black.required-version field, then the project.dependencies array and finally the project.optional-dependencies table."

The first suggestion is a Black-specific location, and then the other 2 are standard pyproject.toml locations as described in https://peps.python.org/pep-0621/. The issue is Poetry does not follow PEP 621 (yet - see python-poetry/roadmap#3), and so it stores its dependencies in different locations - tool.poetry.dependencies and similar, and so the Black action cannot use the Poetry-specified version without redundancy.

If you add

[tool.black]
required-version = "24.4.2"

to your pyproject.toml file instead then use_pyproject will work as described.

Longer term the solution might be to note this gotcha in the docs, for Black to pick up on the Poetry syntax as well, and/or to just wait for Poetry to follow PEP 621.

from black.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.