brainy-airline-59624
10/20/2025, 6:30 AMcheck goal
in Find targets from input specs
ValueError: Invalid requirement 'git+https://github.com/...@v0.x.xxx in third_party/zero-api_requirements.txt at line 9: Expected end or semicolon (after name and no valid version specifier)
git+https://github.com/...@v0.x.xxx
One thing I found recommended that I put this into a python_requirement block and it seems to grab and build this repo fine. The problem is I want to include this third_party in my default resolve so that it's a part of the lockfile I use with my IDE. Perhaps there's some simple way to do this, but I'm having a hard time solving this.elegant-florist-94385
10/20/2025, 12:32 PMrequirements.txt file that you are using with python_requirements(source="requirements.txt") and now adding your new requirement as a separate python_requirement(requirements=["something"]) target. Is that right?
Good news, this should do exactly what you want already. If you'll notice, both python_requirement and python_requirements have a resolve key that can be used to declare which resolve the requirement(s) belong to (defaulting to your default resolve). The resolve doesn't care where they came from in the first place, they all get converted to individual python_requirement targets behind the scenes and the resolve will use them all.brief-scientist-13682
10/20/2025, 9:41 PMgit+https://...#egg=<project-name>... , the python_requirement code gets things right (https://github.com/pantsbuild/pants/blob/8e7f71e5ff858c9d46fe9cdd81cddaf95616817a/src/python/pants/util/pip_requirement.py#L33), but when the same requirement string is in a requirement file loaded via python_requirements, faulty comment stripping (Comments in a requirement file begin with # too) cuts the egg=<project-name> off your otherwise completely valid requirement string (https://github.com/pantsbuild/pants/blob/8e7f71e5ff858c9d46fe9cdd81cddaf95616817a/src/python/pants/util/requirements.py#L17).
You can maintain using a requirements file if you switch from git+https://...#egg=<project-name>... form to the more standard `project-name @ git+https://..`form. That said, if you use the #subdirectory=<some subdir in the clone> form, there is no workaround except to follow @elegant-florist-94385's lead and stick to python_requirement until https://github.com/pantsbuild/pants/issues/22239 gets fixed.brainy-airline-59624
10/20/2025, 11:32 PMelegant-florist-94385
10/21/2025, 3:33 AMhow do I incrementally specify to projects to use the Github version of the code imported in a Poetry file?I would try to enforce the idea (during the length of the refactor, that is), that the dependency should never exist in the same resolve twice. So you would end up with the following process (loosely): • Start with a number of (copy-pasted) resolves • Create the standard default resolve (which should include the git project under discussion) ◦ At the moment, no first party code is using dependencies from this resolve (They are still using their multitude of specific resolves) ◦ If one of your original resolves was considered a default, force the old default into a specific named resolve and let your new default be on its own • One by one, remove the individual specific resolves. For each one, you will need to: ◦ Ensure all first party code is compatible with the versions of the 3rd party packages in your default resolve (lint, check, test, functionality, etc) ◦ Set first party code to point at default resolve ◦ Remove the resolve (requirements, lockfile, declaration of resolve in
pants.toml)
This enables you to work on one project at a time, and to have a (relatively) clean divide of "If its using the default resolve, it is fixed, else it is considered legacy".
There will potentially be some ordering dependencies where (apart from the git repo as 3rd party dependency) you might have some common library type code that needs to be ported over before some projects that are using it, but then it still needs to know about the resolves for those projects. If you can do them all at once, the above process would work, otherwise those libs would need to follow a multi-resolve process in the meantime (Hopefully you can avoid needing to do this).