achillesrasquinha / pipupgrade

🗽 Like yarn outdated/upgrade, but for pip. Upgrade all your pip packages and automate your Python Dependency Management.
https://git.io/pipupgrade
MIT License
587 stars 28 forks source link

pipupgrade --check --format json and yaml crash #126

Open crucio55 opened 3 years ago

crucio55 commented 3 years ago

What's the bug all about?

pipupgrade --check --format {json,yaml} crash, while the formats table and tree work fine

What command led to this issue?

$ pipupgrade --check --format json

and

$ pipupgrade --check --format yaml

Logs

2021-11-23 19:35:11,551 | INFO | Environment: {'version': '0.2.0', 'python_version': '3.9.7', 'os': 'Linux-5.14.18-1-MANJARO-x86_64-with-glibc2.33', 'config': {'path': {'BASE': '/usr/lib/python3.9/site-packages/bpyutils', 'DATA': '/usr/lib/python3.9/site-packages/bpyutils/data', 'CACHE': '/home/nataly/.config/bpyutils', 'JOBS': '/usr/lib/python3.9/site-packages/bpyutils/jobs'}}, 'settings': {'settings': {'version': '0.2.0', 'cache_timeout': '86400', 'jobs': '12'}}}
2021-11-23 19:35:11,551 | INFO | Arguments Passed: {'args': (), 'kwargs': {'ARGUMENTS': <class 'inspect._empty'>, 'packages': [], 'resolve': False, 'ignore': None, 'pip_path': None, 'yes': 0, 'clean': 0, 'check': True, 'upgrade_type': ['minor', 'patch'], 'latest': 0, 'format': 'json', 'all': 0, 'pip': 0, 'self': False, 'requirements': None, 'pipfile': None, 'interactive': 0, 'project': None, 'git_username': None, 'git_email': None, 'pull_request': False, 'github_access_token': None, 'github_reponame': None, 'github_username': None, 'target_branch': 'master', 'jobs': 12, 'user': 0, 'no_included_requirements': 0, 'no_cache': 0, 'output': None, 'ignore_error': 0, 'force': 0, 'doctor': False, 'no_color': 0, 'verbose': True}, 'a': <pipupgrade.commands.to_params.<locals>.O object at 0x7ff18e36ba00>}
Checking...
...
2021-11-23 19:35:23,365 | INFO | Packages within `pip` /home/nataly/.local/bin/pip3 found: [<Package astroid (2.8.6)>, <Package cryptography (35.0.0)>, <Package duplicity (0.8.21)>, <Package google-auth (1.34.0)>, <Package Jinja2 (2.11.3)>, <Package PyJWT (1.7.1)>, <Package pyOpenSSL (20.0.1)>, <Package pyparsing (2.4.7)>, <Package setuptools (57.4.0)>, <Package sip (4.19.25)>, <Package uritemplate (3.0.1)>]...
2021-11-23 19:35:23,366 | INFO | Packages within `pip` /home/nataly/.local/bin/pip found: [<Package astroid (2.8.6)>, <Package cryptography (35.0.0)>, <Package duplicity (0.8.21)>, <Package google-auth (1.34.0)>, <Package Jinja2 (2.11.3)>, <Package PyJWT (1.7.1)>, <Package pyOpenSSL (20.0.1)>, <Package pyparsing (2.4.7)>, <Package setuptools (57.4.0)>, <Package sip (4.19.25)>, <Package uritemplate (3.0.1)>]...
2021-11-23 19:35:23,370 | INFO | Updating registries: [<pipupgrade.model.registry.Registry object at 0x7ff18c7137c0>, <pipupgrade.model.registry.Registry object at 0x7ff18c7139a0>]...

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/pipupgrade/commands/__init__.py", line 79, in command
    return _command(**ARGUMENTS)
  File "/usr/lib/python3.9/site-packages/pipupgrade/commands/__init__.py", line 258, in _command
    update_registry(registry, yes = a.yes, user = a.user, check = a.check,
  File "/usr/lib/python3.9/site-packages/pipupgrade/commands/helper.py", line 251, in update_registry
    string = _render_json(nodes)
  File "/usr/lib/python3.9/site-packages/pipupgrade/commands/helper.py", line 154, in _render_json
    dict_ = package.to_dict()
  File "/usr/lib/python3.9/site-packages/pipupgrade/model/package.py", line 201, in to_dict
    dependencies = self.dependency_tree.to_dict(repr_ = lambda x: x.name)
  File "/usr/lib/python3.9/site-packages/bpyutils/tree.py", line 133, in to_dict
    dict_ = {
  File "/usr/lib/python3.9/site-packages/bpyutils/tree.py", line 134, in <dictcomp>
    to_key(child): child.to_dict(repr_ = repr_, level = level + 1) or None
  File "/usr/lib/python3.9/site-packages/bpyutils/tree.py", line 130, in to_key
    key = repr_(o) if repr_ else o
  File "/usr/lib/python3.9/site-packages/pipupgrade/model/package.py", line 201, in <lambda>
    dependencies = self.dependency_tree.to_dict(repr_ = lambda x: x.name)
AttributeError: 'Node' object has no attribute 'name'

An error occured while performing the above command. This could be an issue with
"pipupgrade". Kindly post an issue at https://github.com/achillesrasquinha/pipupgrade/issues