python-poetry / python-poetry/tomlkit
release 0.5.5 breaks requirementslib
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 850
- Forks
- 162
- Avg merge
- 13m
- Merged PRs (30d)
- 2
Description
This is exposed by the requirementslib testsuite or in isort:
[ 146s] _____________________________ test_pipfile_finder ______________________________
[ 146s]
[ 146s] tmpdir = local('/tmp/pytest-of-abuild/pytest-0/test_pipfile_finder0')
[ 146s]
[ 146s] def test_pipfile_finder(tmpdir):
[ 146s] pipfile = tmpdir.join('Pipfile')
[ 146s] pipfile.write(PIPFILE)
[ 146s] si = SortImports(file_contents="")
[ 146s] finder = finders.PipfileFinder(
[ 146s] config=si.config,
[ 146s] sections=si.sections,
[ 146s] > path=str(tmpdir)
[ 146s] )
[ 146s]
[ 146s] /home/abuild/rpmbuild/BUILD/isort-4.3.21/test_isort.py:2685:
[ 146s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[ 146s] /home/abuild/rpmbuild/BUILD/isort-4.3.21/isort/finders.py:199: in __init__
[ 146s] self.names = self._load_names()
[ 146s] /home/abuild/rpmbuild/BUILD/isort-4.3.21/isort/finders.py:221: in _load_names
[ 146s] for name in self._get_names(path):
[ 146s] /home/abuild/rpmbuild/BUILD/isort-4.3.21/isort/finders.py:332: in _get_names
[ 146s] for req in project.packages:
[ 146s] /usr/lib/python2.7/site-packages/requirementslib/models/pipfile.py:240: in __getattr__
[ 146s] return super(Pipfile, self).__getattribute__(k, *args, **kwargs)
[ 146s] /usr/lib/python2.7/site-packages/requirementslib/models/pipfile.py:326: in packages
[ 146s] return self.requirements
[ 146s] /usr/lib/python2.7/site-packages/requirementslib/models/pipfile.py:240: in __getattr__
[ 146s] return super(Pipfile, self).__getattribute__(k, *args, **kwargs)
[ 146s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[ 146s]
[ 146s] self = Pipfile(path=PosixPath('/tmp/pytest-of-abuild/pytest-0/test_pipfile_finder0/Pi...e=None, _pyproject={}, build_system={}, _requirements=[], _dev_requirements=[])
[ 146s]
[ 146s] @property
[ 146s] def requirements(self):
[ 146s] # type: () -> List[Requirement]
[ 146s] if not self._requirements:
[ 146s] > packages = tomlkit_value_to_python(self.pipfile.get("packages", {}))
[ 146s] E AttributeError: 'NoneType' object has no attribute 'get'
[ 146s]
[ 146s] /usr/lib/python2.7/site-packages/requirementslib/models/pipfile.py:344: AttributeError
The logic in requirementslib actually looks okayish so I suppose it is an issue inside tomlkit.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure through the requirementslib testsuite or isort, starting with test_isort.py:2685 and the PipfileFinder path in isort/finders.py:199-332. Trace how requirementslib accesses pipfile.get("packages", {}) and inspect the corresponding tomlkit behavior; done means the reported test no longer raises AttributeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100