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

plain-fireman-49959

01/31/2022, 3:49 PM
Hello! Quick question: I'm trying to adopt mypy on my monorepo, I've been able to run
fmt
,
lint
,
test
,
package
,
run
on everything so far (with the same set of external dependencies). mypy is failing to generate lockfiles because it can't find the dependencies that are in private repos (behind simple auth). I tried adding to the indexes, even including credentials, but it gives the same error:
Copy code
Because pants-lockfile-generation depends on REDACTED (<0.4.0,>=0.3.20) which doesn't match any versions, version solving failed.
h

hundreds-father-404

01/31/2022, 3:57 PM
Hey Jack! Unfortunately generating lockfiles doesn't work with private indexes 😕 We're using Poetry for lockfile generation atm, and it doesn't have the same options as Pip's resolver here. We have been prioritizing teaching Pex how to generate lockfiles, which under-the-hood uses pip. When we make that switch, we'll support custom indexes automatically In the meantime, some options: 1. Give up on a lockfile for MyPy by setting
[mypy].lockfile = "<none>"
. You can mostly recreate pinning transitive dependencies by adding them all to
[mypy].extra_requirements
. These won't have
--hash
unfortunately. 2. Generate the lockfile without Pants, however you'd like to do it, and then set
[mypy].lockfile
to point to that path. There are two awkward edges here: you'd probably want to add in Pants's header to the file which is used for invalidation, and
generate-lockfiles
wouldn't realize you don't want to generate for this tool, so you'd have to explicitly allowlist all the ones you want with
generate-lockfiles --resolve=['tool1', 'tool2']
etc
👀 1
h

happy-kitchen-89482

01/31/2022, 4:30 PM
Sorry for the inconvenience. Much better lockfile support is coming soon!
🙌 2
h

hundreds-father-404

01/31/2022, 4:48 PM
Let us know btw if you go with the second approach, I can try to give more helpful instructions on how to work around those two things like the invalidation header
p

plain-fireman-49959

02/01/2022, 8:49 AM
Thanks guys! Solution 1 works well enough for my needs, I don't think I'll try the second option as I'll wait for the incoming lockfile upgrades :)
6 Views