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

new section not added to pyproject.toml #461

Open
finswimmer opened this issue Mar 15, 2022 · 3 comments
Open

new section not added to pyproject.toml #461

finswimmer opened this issue Mar 15, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@finswimmer
Copy link

finswimmer commented Mar 15, 2022

Hello,

I've prepared a style that should add the readme keyword to [tool.poetry] in my pyproject.toml and a config for black as well.

Expected behavior

After running nitpick fix I expect that

  • the readme keyword is added to [tool.poetry] in pyproject.toml
  • a new section [tool.black] is added to the pyproject.toml

Current behavior

  • The readme keyword is added to [tool.poetry] in pyproject.toml
  • No new [tool.black] section is added

Steps to reproduce

This is how the project looks like:

enforce-styles
├── my-style.toml
├── poetry.lock
└── pyproject.toml

pyproject.toml:

[tool.poetry]
name = "enforce-styles"
version = "0.1.0"
description = ""
authors = ["Fin Swimmer <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.9"

[tool.poetry.dev-dependencies]
nitpick = "^0.31.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.nitpick]
style = ["./my-style.toml"]

my-style.toml:

["pyproject.toml".tool.black]
line-length = 100

["pyproject.toml".tool.poetry]
readme="README.md"

When running nitpick fix I receive this message:

$ nitpick fix
nitpick fix      
pyproject.toml:1: NIP318  has missing values:
[tool.black]
line-length = 100

[tool.poetry]
readme = "README.md"
Violations: ✅ 1 fixed.

And this is how the pyproject.toml looks afterwards:

[tool.poetry]
name = "enforce-styles"
version = "0.1.0"
description = ""
authors = ["Fin Swimmer <[email protected]>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.9"

[tool.poetry.dev-dependencies]
nitpick = "^0.31.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.nitpick]
style = ["./my-style.toml"]

As one can see readme is added as expected, but [tool.black] is missing

Your environment

  • nitpick version used: 0.31.0
  • Python version: 3.9.1
  • Operating System and version: Ubuntu 20.4

fin swimmer

@finswimmer finswimmer added the bug Something isn't working label Mar 15, 2022
@finswimmer
Copy link
Author

I was able to find a workaround. This problem seems to only appear if the [build-system] is not at the end of the file. Once I moved it there it works as expected.

@andreoliwa
Copy link
Owner

Thanks for the bug report! 🙏🏻

This problem seems to only appear if the [build-system] is not at the end of the file. Once I moved it there it works as expected.

This is super weird, it doesn't make much sense. 🤔

I will try to reproduce this bug soon-ish and get back to you after I do it.

@andreoliwa andreoliwa added this to Upvoted / Requests from others in Nitpick Roadmap Mar 19, 2022
@andreoliwa
Copy link
Owner

I could reproduce the bug with your files, thanks!

This is odd.
I still didn't debug it to find out what is the cause...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Upvoted / Requests
Nitpick Roadmap
  
Upvoted / Requests
Development

No branches or pull requests

2 participants