https://pantsbuild.org/ logo
#general
Title
# general
i

incalculable-hydrogen-44003

11/04/2022, 4:28 PM
@witty-crayon-22786 Staring a new thread here for deprecation moving from 2.13 to 2.14
👍 1
I'm trying to find how to fix
Invalid option 'inits' under [python-infer]
w

witty-crayon-22786

11/04/2022, 4:30 PM
you should have a deprecation for that in 2.13
i

incalculable-hydrogen-44003

11/04/2022, 4:30 PM
oh. I see it! my mistake.
w

witty-crayon-22786

11/04/2022, 4:31 PM
Deprecated, is scheduled to be removed in version: 2.14.0.dev1.
Use the more powerful option
[python-infer].init_files
. For identical behavior, set to ‘always’. Otherwise, we recommend the default of
content_only
(simply delete the option
[python-infer].inits
to trigger the default).
i

incalculable-hydrogen-44003

11/04/2022, 4:32 PM
got it. making the upgrades now
Getting a ton of
python can't Pants cannot infer owners for the following imports in the target
warning because of Django prob
I assume that is expected?
h

happy-kitchen-89482

11/04/2022, 4:39 PM
Hmm, and you weren’t getting these on 2.13?
i

incalculable-hydrogen-44003

11/04/2022, 4:40 PM
nope
seems to run tho 🤷‍♂️
w

witty-crayon-22786

11/04/2022, 4:49 PM
“warn for unowned imports” was enabled by default in 2.14: many of those warnings likely represent issues that would be good to fix: https://www.pantsbuild.org/docs/reference-python-infer#unowned_dependency_behavior
Usually when an import cannot be inferred, it represents an issue like Pants not being properly configured, e.g. targets not set up. Often, missing dependencies will result in confusing runtime errors like
ModuleNotFoundError
, so this option can be helpful to error more eagerly.
To ignore any false positives, either add
# pants: no-infer-dep
to the line of the import or put the import inside a
try: except ImportError:
block.
i

incalculable-hydrogen-44003

11/04/2022, 4:50 PM
Unfortunately there are hundreds of them. Django does a lot of magic importing
w

witty-crayon-22786

11/04/2022, 4:52 PM
ok. you can disable that warning as well, but particularly when they have to do with an undeclared dependencies, they’re good to fix. if most of them have the same shape (such as referring to a particular missing 3rdparty dep), they might be easy to clear (such as by adding the dep)
i

incalculable-hydrogen-44003

11/04/2022, 5:00 PM
ok. got it. will give it a shot
c

curved-television-6568

11/04/2022, 5:05 PM
Unfortunately there are hundreds of them. Django does a lot of magic importing
Is that imports for 3rd party deps? If so, you may be able to address them with a proper fix by providing module_mapping config to your
python_requirements
target.
☝️ 1
8 Views