Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2023.9.6 duplicate "self" argument in rdfiltercatalog/__init__.pyi #7401

Closed
JHucker opened this issue Apr 30, 2024 · 10 comments
Closed

2023.9.6 duplicate "self" argument in rdfiltercatalog/__init__.pyi #7401

JHucker opened this issue Apr 30, 2024 · 10 comments
Assignees
Milestone

Comments

@JHucker
Copy link

JHucker commented Apr 30, 2024

Describe the bug
Upgrading to 2023.9.6 fails mypy in my pre-commit when importing FilterCatalogParams:

/home/jacobhucker/miniforge3/envs/min_rep_issue/lib/python3.11/site-packages/rdkit-stubs/Chem/rdfiltercatalog/__init__.pyi:671: error: Duplicate argument "self" in function definition
Found 1 error in 1 file (errors prevented further checking)

Viewing this file, self appears untyped and again typed:

class PythonFilterMatcher(FilterMatcherBase):
    __instance_size__: typing.ClassVar[int] = 72
    @staticmethod
    def __reduce__(*args, **kwargs):
        ...
    def __init__(self, self: typing.Any) -> None:
        """
            C++ signature :
                void __init__(_object*,_object*)
        """

To Reproduce
Minimal conda environment yaml:

name: min_rep_issue
channels:
  - conda-forge
dependencies:
  - python=3.11.8
  - pip
  - pip:
    - rdkit==2023.9.6
    - mypy==1.10.0

Minimal main.py:

from rdkit.Chem.rdfiltercatalog import FilterCatalogParams

if __name__ == "__main__":
    _ = FilterCatalogParams()

Running mypy:

$ mypy  .
/home/jacobhucker/miniforge3/envs/min_rep_issue/lib/python3.11/site-packages/rdkit-stubs/Chem/rdfiltercatalog/__init__.pyi:671: error: Duplicate argument "self" in function definition
Found 1 error in 1 file (errors prevented further checking)

Expected behavior
There should be no errors detected by mypy when scanning the above main.py example.

Configuration (please complete the following information):

  • RDKit version: 2023.9.6
  • OS: Pop!_OS 22.04 LTS
  • Python version (if relevant): 3.11.8
  • Are you using conda? In the minimal example yes, but this firstly originated when installing rdkit via poetry
  • If you are using conda, which channel did you install the rdkit from? as above
  • If you are not using conda: how did you install the RDKit? Via poetry 1.8.2
@JHucker JHucker added the bug label Apr 30, 2024
@ptosco
Copy link
Contributor

ptosco commented Apr 30, 2024

Thanks for reporting. Automated stub generation with C++ Python wrappers is tricky. I'll fix that.

@ptosco ptosco self-assigned this Apr 30, 2024
@lukasturcani
Copy link
Contributor

I have a similar issue with rdkit-stubs/Chem/rdMolDescriptors.pyi:185: error: Duplicate argument "self" in function definition

@mikemhenry
Copy link

I've been having the same issues, so far pinning to rdkit=2023.09.5 fixes it, which is okay since for now we only need to worry about this error when running mypy

andrewtarzia added a commit to JelfsMaterialsGroup/stko that referenced this issue May 15, 2024
Make ruff stricter and clean up doc strings throughout src and examples directories.

mypy fails due to issue with rdkit version: rdkit/rdkit#7401

We will wait till that is solved to fix.
@nishant-aionics
Copy link

nishant-aionics commented May 29, 2024

@ptosco Any updates on this? I'm facing the same issue as @lukasturcani

@nishant-aionics
Copy link

nishant-aionics commented May 29, 2024

FWIW I've changed mypy.ini to the following to keep using rdkit version 2023.9.6:

[mypy]
disallow_untyped_defs = True
; disallow_any_unimported = True
no_implicit_optional = True
check_untyped_defs = True
; warn_return_any = True
show_error_codes = True 
warn_unused_ignores = True
exclude = venv|.venv

[mypy-rdkit.*]
follow_imports = skip
follow_imports_for_stubs = True

@ptosco
Copy link
Contributor

ptosco commented May 30, 2024

Apologies, I have had very little time for RDKit lately; I’ll try to get this fixed for the next patch release.

@nishant-aionics
Copy link

Thanks @ptosco! Appreciate the help! 💯

@ElricleNecro
Copy link

The same problem exist in RDKit 2024.3.5 but in the file rdkit-stubs/Chem/rdMolDescriptors.pyi. In this declaration:

    def __init__(self, self: typing.Any, name: str, version: str) -> None:
        """
            C++ signature :
                void __init__(_object*,_object*,std::string,std::string)
        """

there is 2 self where only one should be needed:

    def __init__(self: typing.Any, name: str, version: str) -> None:
        """
            C++ signature :
                void __init__(_object*,_object*,std::string,std::string)
        """

@UnixJunkie
Copy link
Collaborator

maybe related to this one: #7554

@ElricleNecro
Copy link

Yes, they are both showing the same problem, just in different files. I posted in both, because the incriminated file was mentionned ion both. And I'm not sure which one is really active.

ptosco pushed a commit to ptosco/rdkit that referenced this issue Sep 9, 2024
@greglandrum greglandrum added this to the 2024_09_1 milestone Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants