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
Default "type_stub_modules" deduction using "types-" prefix is not working (TypeError: '<' not supported between instances of 'ModuleProviderType' and 'ModuleProviderType'). #15111
Comments
Thank you so much for this report! I will take a look today. |
By the way, it is recommended generally that you have a distinct Python requirement target for each of those requirements. python_requirement(
name='docopt',
requirements=['docopt'],
)
python_requirement(
name='types-docopt',
requirements=['types-docopt'],
) If you do it that way, there is no need to set the type stub modules field. The defaults will work. That can be annoying to type that all out, so many people use the Python requirements target generator: https://www.pantsbuild.org/docs/python-third-party-dependencies#requirementstxt |
…lementation (pantsbuild#15121) Closes pantsbuild#15111. This is a particular edge case when the same python module has multiple entries, and those entries come from the same target. The better fix is pantsbuild#14719. [ci skip-rust] [ci skip-build-wheels]
…lementation (pantsbuild#15121) Closes pantsbuild#15111. This is a particular edge case when the same python module has multiple entries, and those entries come from the same target. The better fix is pantsbuild#14719. [ci skip-rust] [ci skip-build-wheels]
Thank you for your instant response and fix. We are deciding to make our company Pythons' projects Pants compatible. The main reason for this migration is to avoid too many files and tools when developing code and managing the interdependence between projects:
For novice developers, there are many tools and flows to learn for starting development. So, we prefer a single BUILD (which Pants is not happy with that and we put different BUILD files for src/ and tests/ directories) for each project (similar to MSBuild, Ant, and Maven) with all properties needed and targets/tasks supported. |
Hi @AlirezaRoshanzamir , welcome to Pants! Glad we could fix this issue, and just wanted to let you know that the Pants slack workspace is a great place to ask questions: https://www.pantsbuild.org/docs/getting-help |
Also, you should be able to have a single top-level BUILD file if you really want one, with |
Thanks a lot. I will definitely join. But there seems to be a set of assumptions that make this somewhat problematic (such as #15084) or non-boilerplate (for example, the default "sources" field in the "python_sources" and "python_tests" field which assumes that all the sources are in the current directory). I should share and discuss this issue in the Slack workspace. |
Description
According to the python_requirement's type_stub_modules field documentation, the requirements with the "types-" prefix is deduced as a stub automatically, but running any command (such as
check
,test
, and etc) raises:The simple use-case:
However, by uncommenting the
type_stub_modules=['docopt']
, the error will gone.Pants version: 2.10.0
OS: Ubuntu 20.04.3 LTS
The text was updated successfully, but these errors were encountered: