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

delightful-appointment-93222

06/23/2022, 7:52 PM
Hi, I'm a little confused on whether or not I am able to use my own lockfile as is. I've set
Copy code
[python]
enable_resolves = true
resolves = {python-default = "requirements.txt"}
in my pants.toml but then I get the following error:
Copy code
InvalidLockfileError: Could not find a Pants metadata block in the lockfile `requirements.txt` for `python-default`. To resolve this error, you will need to regenerate the lockfile by running `./pants generate-lockfiles --resolve=python-default`.
A few outside factors are preventing me from running poetry on this build machine so generating the lockfile using poetry is failing. Can someone help me understand why the lockfile has to be regenerated?
1
b

bitter-ability-32190

06/23/2022, 7:55 PM
Use ignore to avoid needing a lockfile header at all, e.g. if you are manually managing lockfiles rather than using the generate-lockfiles goal.
d

delightful-appointment-93222

06/23/2022, 8:00 PM
ah, thank you!
h

happy-kitchen-89482

06/23/2022, 8:24 PM
Is your requirements.txt a lockfile?
Usually requirements.txt is just a loose list of direct requirements
a lockfile contains dependency pins for the entire transitive dep graph
You can use Pants without a lockfile, or you can have Pants generate the lockfile using Pex instead of Poetry
But manually managing a lockfile is difficult
1
d

delightful-appointment-93222

06/23/2022, 8:49 PM
Hi @happy-kitchen-89482, first off, thanks for all your work on this project. I listened to your SE Daily podcast episode last week and immediately saw that it could solve a lot of my nagging issues around the build/deploy process.
❤️ 2
i'm using poetry (export) to manage dependencies in the dev environment (my laptop) but i've run into a few hitches running poetry on the build hosts/production since they are firewalled off from the internet
h

happy-kitchen-89482

06/23/2022, 8:57 PM
ah, yes, that will be tricky
so how do they work today?
d

delightful-appointment-93222

06/23/2022, 9:06 PM
oh its embarrassing. mostly git pulling to a fresh vm and then one or two shell scripts to put everything in place. our main codebase is in java and my python repo is for the operations/reporting/support-type stuff. the java team uses bamboo a lot so i am looking to incorporate that a bit more as we're currently doing some greenfield rebuilding
i was thinking i should be able to build a poetry pex and host that on our internal artifact host
but definitely not opposed to using pex to generate lockfiles
i'm just getting started with pants but looking forward to learning a lot more and hopefully even contributing
🎉 1
h

happy-kitchen-89482

06/23/2022, 9:19 PM
I'm in europe right now so it's my bed time, but I'll tackle any further questions tomorrow. 🙂
Do you have an internal artifactory or something that those build machines are allowed to connect to and download from?
You also mentioned production, so I'm curious why you'd need Pants to run on a production machine
d

delightful-appointment-93222

06/23/2022, 9:20 PM
cheers. yep nexus
i guess more of a build machine now that i can build pex's
h

happy-kitchen-89482

06/23/2022, 9:23 PM
So you can configure Pants to talk to a custom repository instead of PyPI
d

delightful-appointment-93222

06/23/2022, 9:24 PM
but it was kind of a "production" machine since i was pulling from git and running in place. didn't really have any sort of formal build process
yep. got that working
5 Views