Skip to content

[Bug]: Python type stubs are missing two configuration properties #72

@sbp

Description

@sbp

Component

exarch-core (Rust library)

Bug Description

The SecurityConfig.allowed_extensions and SecurityConfig.banned _path_components properties are missing from exarch.pyi.

Background and details:

When using the exarch Python bindings, pyright complains that exarch.SecurityConfig is missing the banned_path_components property, but the property is present in the bindings and declared mutable with a setter:

    #[getter]
    fn get_banned_path_components(&self) -> Vec<String> {
        self.inner.banned_path_components.clone()
    }

    #[setter]
    fn set_banned_path_components(&mut self, value: Vec<String>) {
        self.inner.banned_path_components = value;
    }

Indeed, this property is missing in exarch.pyi:SecurityConfig. When I researched this, I found that the same applies to SecurityConfig.allowed_extensions.

I could not find that the typestubs are automatically generated, which could be considered the root cause.

Expected Behavior

I expected lints to pass when using the properties as described above.

Steps to Reproduce

The following script shows in a pytest that the properties exist and are mutable. It then runs pyright on itself, and will print type errors showing that it does not recognise the properties that, nevertheless, exist at runtime.

#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.11"
# dependencies = [
#   "exarch==0.2.7",
#   "pyright==1.1.408",
#   "pytest==9.0.2",
# ]
# ///
# pyright: strict
from __future__ import annotations

import os
import pathlib

import exarch
import pyright
import pytest


def test_exarch_runtime_properties() -> None:
    config = exarch.SecurityConfig()

    assert hasattr(config, "banned_path_components")
    assert hasattr(config, "allowed_extensions")

    config.banned_path_components = [".env", "__pycache__"]
    assert config.banned_path_components == [".env", "__pycache__"]

    config.allowed_extensions = [".txt", ".md"]
    assert config.allowed_extensions == [".txt", ".md"]

    banned: list[str] = config.banned_path_components
    config.banned_path_components = [component for component in banned if component != ".env"]
    allowed: list[str] = config.allowed_extensions
    config.allowed_extensions = allowed + [".json"]


def main() -> int:
    script = pathlib.Path(__file__).resolve()
    pytest_exit_code = pytest.main(["-c", os.devnull, "-p", "no:cacheprovider", str(script)])
    if pytest_exit_code != 0:
        return pytest_exit_code
    return pyright.run(str(script)).returncode


if __name__ == "__main__":
    raise SystemExit(main())

Code Example

See above.

Environment

$ uv --version
uv 0.8.8 (9a54754b0 2025-08-08)

macOS, ARM64.

Error Output / Logs

$ ./exarch_type_error.py
Installed 9 packages in 189ms
============================================================ test session starts =============================================================
platform darwin -- Python 3.13.2, pytest-9.0.2, pluggy-1.6.0
rootdir: /dev
configfile: null
collected 1 item                                                                                                                             

../../dev .                                                                                                                            [100%]

============================================================= 1 passed in 0.02s ==============================================================
./exarch_type_error.py
  ./exarch_type_error.py:27:12 - error: Cannot assign to attribute "banned_path_components" for class "SecurityConfig"
    Attribute "banned_path_components" is unknown (reportAttributeAccessIssue)
  ./exarch_type_error.py:28:19 - error: Cannot access attribute "banned_path_components" for class "SecurityConfig"
    Attribute "banned_path_components" is unknown (reportAttributeAccessIssue)
  ./exarch_type_error.py:30:12 - error: Cannot assign to attribute "allowed_extensions" for class "SecurityConfig"
    Attribute "allowed_extensions" is unknown (reportAttributeAccessIssue)
  ./exarch_type_error.py:31:19 - error: Cannot access attribute "allowed_extensions" for class "SecurityConfig"
    Attribute "allowed_extensions" is unknown (reportAttributeAccessIssue)
  ./exarch_type_error.py:33:32 - error: Cannot access attribute "banned_path_components" for class "SecurityConfig"
    Attribute "banned_path_components" is unknown (reportAttributeAccessIssue)
  ./exarch_type_error.py:34:12 - error: Cannot assign to attribute "banned_path_components" for class "SecurityConfig"
    Attribute "banned_path_components" is unknown (reportAttributeAccessIssue)
  ./exarch_type_error.py:35:33 - error: Cannot access attribute "allowed_extensions" for class "SecurityConfig"
    Attribute "allowed_extensions" is unknown (reportAttributeAccessIssue)
  ./exarch_type_error.py:36:12 - error: Cannot assign to attribute "allowed_extensions" for class "SecurityConfig"
    Attribute "allowed_extensions" is unknown (reportAttributeAccessIssue)
8 errors, 0 warnings, 0 informations

Severity

Low - Minor inconvenience

Security

Checklist

  • I have searched existing issues to ensure this is not a duplicate
  • I have provided all requested information

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions