bndr / pipreqs

pipreqs - Generate pip requirements.txt file based on imports of any project. Looking for maintainers to move this project forward.
Apache License 2.0
6.11k stars 383 forks source link

Pipreqs does not pick up on google-cloud-translate #188

Open hojlind opened 4 years ago

hojlind commented 4 years ago

Pipreqs does not seem to be able to infer the google-cloud-translate package from the import that is suggested in the package instructions (from google.cloud import translate).

Operating system and version

WSL 1.0 running Ubuntu on Windows 10 Python 3.6.9

Steps to reproduce

  1. Create new python file

  2. Import google translate via:

    from google.cloud import translate
  3. run pipreqs

  4. The package will not be found in the requirements.txt

alfonsomhc commented 3 years ago

I found the same issue with the module google-cloud-secret-manager, which is imported similarly: from google.cloud import secretmanager

chrissyast commented 3 years ago

Same here

from google.cloud import datastore

DEBUG: Found packages: {'google'} DEBUG: Found imports: protobuf

It seems to recognise google but uses protobuf as a requirement instead.

Interestingly, if you type import google and go to the reference for google, the path is .vscode\extensions\ms-python.vscode-pylance-2021.3.3\dist\typeshed-fallback\stubs\protobuf\google\__init__.pyi

I've tried removing pylance as the language server but this still happens

requirements.txt

expected: google-cloud-datastore==1.13.0 actual: protobuf==3.15.6

RentingCol commented 3 years ago

on windows 10, pipreqs missing from google.cloud import secretmanager

also import protobuf. thanks in advance

octopop commented 3 years ago

Same issue of Mac OS when importing GCS from google.cloud import storage

pipreq recommends protobuf==3.17.3

yannick-vinkesteijn commented 2 years ago

For me all imports from google.* are not recognized.

ebonura-fastly commented 2 years ago

Any news on this? Same issue for me when import BigQuery: from google.cloud import bigquery pipreq recommends protobuf==3.19.1

celian-garcia commented 2 years ago

Yes I confirm that every package with '.' in the name is not discovered. For example it is the case for the opentelemetry SDK as well. Reading rapidly the code, I found maybe some lines to change to fix that. Unfortunately, I don't have time to check and propose a Pull Request ... I put here the result of my investigation if someone is interested.