PyO3 / PyO3/pyo3

Make warnings suppressible through the python warnings module

Open
#4,999 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
16.2k
Forks
1k
Avg merge
2d 6h
Merged PRs (30d)
66

Description

fastexcel uses this warn macro here

Over on the python side I want to suppress that through

from warnings import catch_warnings, simplefilter
with catch_warnings():
    simplefilter("ignore")
    read_excel(file_path).load_sheet(0)

but the warning persists. It seems that warnings from rust ought to be caught with the warnings module too.

I was able to do this as a workaround

import logging
fe=logging.getLogger("fastexcel.types.dtype")
fe.disabled=True
from fastexcel import read_excel
read_excel(file_path).load_sheet(0)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior from the fastexcel call at src/types/dtype.rs:303 using Python warnings.catch_warnings and simplefilter("ignore"). Start by tracing how PyO3 exposes Rust warnings to Python, then verify that the warning from read_excel(file_path).load_sheet(0) is suppressible through the warnings module while preserving the existing logging workaround behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.