thebjorn/pydeps

Release 1.12.5 Requires a TOML Library

sdelano opened this issue ยท 6 comments

The newest release now has a dependency on a TOML parsing library, but that dependency isn't being picked up by PyPi, so installing this new version without also manually installing tomlkit or specifying it as a dependency in a pyproject.toml will cause the execution of this tool to fail.

Examples

PyPi doesn't think that this package requires any TOML libraries:

> pip show pydeps
Name: pydeps
Version: 1.12.5
Summary: Display module dependencies
Home-page: https://github.com/thebjorn/pydeps
Author: bjorn
Author-email: bp@datakortet.no
License: BSD
Location: /Users/stephen/.asdf/installs/python/3.9.9/lib/python3.9/site-packages
Requires: stdlib-list
Required-by: 

This results in the following error when run without tomlkit installed:

    raise ImportError("No toml module found")
ImportError: No toml module found

Even when tomlkit is installed manually, if you haven't correctly set up a pydeps config file it will also fail:

    raise NonExistentKey(key)
tomlkit.exceptions.NonExistentKey: 'Key "pydeps" does not exist.'
mivade commented

I think the title here is burying the lede a bit:

Even when tomlkit is installed manually, if you haven't correctly set up a pydeps config file it will also fail:

I came here looking for other issues reported about this since that's what I was seeing in version 1.12.7 so it hasn't been fixed yet.

@mivade apologies. The lack of tomlkit was the first issue I hit, and I started the issue. Trying to fix it, I hit more and more until I determined that the release was basically completely broken based on the documentation at the time.

The title could very well have been "Release 1.12.5 doesn't work at all by following docs"

mivade commented

No need to apologize! I was just trying to point out that this is a much bigger issue than the title implies (but you correctly point out in your report).

I see there is a problem if a config file is found and doesn't contain a pydeps config (configs.pyL365).

Hmm.. I tried to make it so (a) pythons with included tomllib would work, (b) any of the other common(?) toml-libraries (i.e. tomlkit and toml) would work if they were found.

My thinking being that people who wanted to pick up configs from pyproject.toml already had their preferred toml-library installed.

Is there a better way of doing this?

I've fixed the crashing on missing config in config files, and the two most obvious import-error issues.
Version 1.12.8 is available on PyPI.

@thebjorn thank you! A PR was opened in our codebase this morning via Renovate and it's working just as before. ๐ŸŽ‰