Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

release 0.5.5 breaks requirementslib

未关闭
#58 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
tooling

调研方向

通过 requirementslib testsuite 或 isort 重现该故障,从 test_isort.py:2685 以及 isort/finders.py:199-332 中的 PipfileFinder 路径开始。跟踪 requirementslib 如何访问 pipfile.get("packages", {}),并检查 tomlkit 中对应的行为;当报告的测试不再引发 AttributeError 时即表示完成。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
Python
星标
850
派生
163
平均合并
13 分钟
30 天内合并 PR
2

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

python-poetry/tomlkit 的其他 Issue

查看 python-poetry/tomlkit 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。