dgilland / pydash

The kitchen sink of Python utility libraries for doing "stuff" in a functional way. Based on the Lo-Dash Javascript library.
http://pydash.readthedocs.io
MIT License
1.28k stars 89 forks source link

Export all from `pydash` #194

Closed DeviousStoat closed 1 year ago

DeviousStoat commented 1 year ago

Using pyright as a type checker with reportPrivateUsage=true we get errors that the objects are not exported from pydash. The reason is explained here by pyright's maintainer.

coveralls commented 1 year ago

Coverage Status

Coverage: 100.0%. Remained the same when pulling e3894bc103ba304cdb4304efc6a7628bbe894130 on DeviousStoat:export-all into fd667300367d721520aaf4cbf0f4c23762a9df1b on dgilland:develop.

dgilland commented 1 year ago

Is it possible to have a test that would detect a missing __all__ item?

DeviousStoat commented 1 year ago

Yes of course. We can reuse the logic of one function from the chain interface generator script that parses the imports. But I believe some linters can detect unused imports as well. This would detect missing __all__ item as well. Maybe in a more elegant manner. I will try to look into it later today.

DeviousStoat commented 1 year ago

The F401 rule from flake8 that handles this was disabled. I enabled it back. It is nice, it understands when we export it in __all__ too so it adds the test you requested. For example if I remove "chunk" from the __all__ list in src/pydash/__init__.py I get a lint error from flake8:

src/pydash/__init__.py:5: [F401] '.arrays.chunk' imported but unused
dgilland commented 1 year ago

Thanks for doing this!

DeviousStoat commented 1 year ago

Thank you! Could we get a release with this fix? This is a bit blocking for some of my projects

dgilland commented 1 year ago

Released v7.0.2: https://pypi.org/project/pydash/7.0.2/