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

[BUG] toml support is incomplete #639

Open
nat-n opened this issue Oct 12, 2023 · 1 comment
Open

[BUG] toml support is incomplete #639

nat-n opened this issue Oct 12, 2023 · 1 comment
Labels
bug dependencies Pull requests that update a dependency file

Comments

@nat-n
Copy link

nat-n commented Oct 12, 2023

prospector fails with stack trace and error like the following in the presence of valid pyproject.toml files.

toml.decoder.TomlDecodeError: Not a homogeneous array (line 152 column 1 char 4093)

To Reproduce

  1. add a line to your pyproject.toml like foo = ["bar", { "baz" = "qux}]
  2. Call prospector
  3. See error

Expected behavior
No error

Additional context

The issue here is that prospector uses the toml library which doesn't support the current toml standard.

The solution is to replace toml with tomli, which is part of the python standard library from 3.11.

I'd be happy to create a PR for this if you agree.

@nat-n nat-n changed the title toml support is incomplete [BUG] [BUG] toml support is incomplete Oct 12, 2023
@Pierre-Sassoulas Pierre-Sassoulas added bug dependencies Pull requests that update a dependency file and removed investigate labels Oct 13, 2023
@nat-n
Copy link
Author

nat-n commented Oct 14, 2023

Turns out I'm not this first to notice this, this PR in requirements-detector is already there to address the root cause.

Incidentally it looks like the dependency on toml in this package is redundant.


Also FYI when I setup out this project locally 4 tests were failing out of the box (python 3.10.4 on macOS):

FAILED tests/execution/test_execution.py::test_total_errors - assert 6 == 5
FAILED tests/profiles/test_profile.py::TestProfileInheritance::test_module_file_inheritance - prospector.profiles.exceptions.ProfileNotFound
FAILED tests/profiles/test_profile.py::TestProfileInheritance::test_module_inheritance - prospector.profiles.exceptions.ProfileNotFound
FAILED tests/tools/pylint/test_pylint_tool.py::TestPylintTool::test_wont_throw_false_positive_relative_beyond_top_level - AssertionError: Lists differ: [pylint-django-not-available] != []

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

2 participants