pre-commit mypy errors

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

还没有人认领这个 Issue。

评估

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

调研方向

Start by comparing the mypy pre-commit setup and the GitHub workflow, then inspect src/graphnet/data/extractors/icecube/i3extractor.py and the contribution guide. Reproduce the reported errors in the stated cvmfs environment and compare with a CPU environment. Done means the supported setup is documented or configured so the mypy hook passes consistently.

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

描述

bug

Describe the bug
Currently if I follow the install guide and install graphnet on GPU with one of the newer cvmfs environments. running the pre-commits will fail on mypy giving rise the erroers like the one below

src/graphnet/data/extractors/icecube/i3extractor.py:35: error: Name "icetray.I3Frame.Calibration" is not defined [name-defined] src/graphnet/data/extractors/icecube/i3extractor.py:56: error: Module has no attribute "I3File" [attr-defined] src/graphnet/data/extractors/icecube/i3extractor.py:59: error: Module has no attribute "I3File" [attr-defined] src/graphnet/data/extractors/icecube/i3extractor.py:63: error: Module has no attribute "I3Frame" [attr-defined] src/graphnet/data/extractors/icecube/i3extractor.py:75: error: Module has no attribute "I3Frame" [attr-defined] src/graphnet/data/extractors/icecube/i3extractor.py:90: error: Name "icetray.I3Frame" is not defined [name-defined]

To Reproduce
Go to cobalt
in /data/user/"your_user" without graphnet already installed (otherwise just choose a different location)
run

eval `/cvmfs/icecube.opensciencegrid.org/py3-v4.3.0/setup.sh`
/cvmfs/icecube.opensciencegrid.org/py3-v4.3.0/RHEL_7_x86_64/metaprojects/icetray/v1.12.1/env-shell.sh
mkdir envs
cd envs
python -m venv "your_env_name"
source "your_env_name"/bin/activate
cd ..
git clone https://github.com/graphnet-team/graphnet.git
cd graphnet
pip install --upgrade pip>=20
pip install wheel setuptools==59.5.0
pip install -r requirements/torch_cu121.txt -e .[torch,develop]
pre-commit install
pre-commit run mypy --files src/graphnet/data/extractors/icecube/i3extractor.py

Expected behavior
Since no files have been changed the expected behaviour is that the hooks should pass as they are doing when being run on the github side.

Full traceback
Please include the full error message to allow for debugging

mypy.....................................................................Failed
- hook id: mypy
- duration: 2.84s
- exit code: 1

src/graphnet/data/extractors/icecube/i3extractor.py:35: error: Name "icetray.I3Frame.Calibration" is not defined  [name-defined]
src/graphnet/data/extractors/icecube/i3extractor.py:56: error: Module has no attribute "I3File"  [attr-defined]
src/graphnet/data/extractors/icecube/i3extractor.py:59: error: Module has no attribute "I3File"  [attr-defined]
src/graphnet/data/extractors/icecube/i3extractor.py:63: error: Module has no attribute "I3Frame"  [attr-defined]
src/graphnet/data/extractors/icecube/i3extractor.py:75: error: Module has no attribute "I3Frame"  [attr-defined]
src/graphnet/data/extractors/icecube/i3extractor.py:90: error: Name "icetray.I3Frame" is not defined  [name-defined]
Found 6 errors in 1 file (checked 1 source file)

Additional context
I have been able to find a solution which is to create another environment without linking to icetray. and just installing with cpu and running the pre-commits from that environments seems to work. I have been trying to track down differences between the package versions when they are being run on the github side and when I run the pre-commit locally but did not manage to find any issue.

So one solution could simply be to update the contribution guide instructing contributers to create a simple environment without cvmfs for when they are running the pre-commits and commiting to github.

主要语言
Python
星标
117
派生
115
平均合并
2 天 21 小时
30 天内合并 PR
1

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

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

graphnet-team/graphnet 的其他 Issue

查看 graphnet-team/graphnet 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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