Skip to content

MAINT MyPy Fails to Find PyRIT Type definitions #720

@ayeganov

Description

@ayeganov

Describe the bug

In my poetry project I had to set these settings:

[[tool.mypy.overrides]]
module = ["pyrit.*"]
ignore_missing_imports = true

If I don't ignore pyrit then I get these errors:

proj/memory/storage.py:10: error: Skipping analyzing "pyrit.common": module is installed, but missing library stubs or py.typed marker  [import-untyped]
proj/memory/storage.py:11: error: Skipping analyzing "pyrit.models": module is installed, but missing library stubs or py.typed marker  [import-untyped]

Steps/Code to Reproduce

  1. Setup a poetry project
  2. Add pyrit poetry add pyrit
  3. Add code to your project where you import pyrit modules: from pyrit.memory.memory_interface import MemoryInterface
  4. Setup mypy in your poetry project:
[tool.mypy]
python_version = "3.12"
  1. Run mypy: poetry run mypy --strict project.

Expected Results

Expect no mypy issues related to pyrit types

Actual Results

error: Skipping analyzing "pyrit.memory": module is installed, but missing library stubs or py.typed marker [import-untyped]

Screenshots

Versions

pyrit = {git = "https://github.com/Azure/PyRIT.git", rev = "c254a9f038517a7df58d7979bf8c9ab0976a88a4"}

Python dependencies:
        pyrit: 0.5.3.dev0
       Cython: None
        numpy: 2.2.3
       openai: 1.62.0
          pip: 24.0
 scikit-learn: 1.6.1
        scipy: 1.15.1
   setuptools: 75.8.0
   tensorflow: None
        torch: None
 transformers: 4.48.3

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthelp wantedExtra attention is needed

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions