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

adorable-engine-71736

05/24/2022, 9:36 AM
hi, im trying to add a python package that is a
pytest
plugin - to test it i think i need to have it added in to my
.pytest.lock
but as the package is not yet published im struggling to get
generate-lock-files
to recognize it i have tried adding
"pytest-iters @ file:///src/workspace/pytooling/pytest-iters",
to
pytest::extra_requirements
in
pants.toml
but it doesnt find my dep if i try to generate the lockfile i have an existing pytest-plugin so i must have done this before somehow - but seem to be in a chicken and egg situation where i can add the plugin until its published, or publish the plugin till its added
1
i can generate a lockfile using a similar
file:///
line for my existing plugin, and separately, im able to
pip install
my new plugin so that should work also it seems as though while generate-lock-files is able to handle a local src, if it doesnt find it indexed it wont handle it
it was a while back when i added the previous pytest-plugin, but i have a feeling i ended up working around as i have now - manually publishing the initial version of the plugin. once its there everything seems to work as expected
h

hundreds-father-404

05/24/2022, 12:16 PM
Hi! Support for local requirements in lockfiles is not yet 100% supported - but John has been making lots of progress in Pex land
a

adorable-engine-71736

05/24/2022, 12:17 PM
ah k - so i guess im not doing it wrong - thanks
somewhat relatedly i hit what seems to be some kinda caching bug...
👀 1
i updated my pytest-plugin (manually) and tried to rerun generate-lock-files
no matter what i did it would not see the newer version on pypi
in the end i deleted all my caches, and it worked straight away
h

hundreds-father-404

05/24/2022, 12:37 PM
Hmmm that's not expected: https://github.com/pantsbuild/pants/blob/65a3e9967be0b3e245c41a8c87c1d51f59d3351a/src/python/pants/backend/python/goals/lockfile.py#L184-L194 Do you remember if Pants was still trying to re-resolve the lockfile? Like it was running a process? I'm wondering if Pex was using a TTL or something, that it was Pex caching rather than Pants
a

adorable-engine-71736

05/24/2022, 12:37 PM
let me dump the error...
Copy code
root@iota:/src/workspace/pytooling# ./pants generate-lockfiles --resolve=pytest
12:23:25.52 [INFO] Completed: Generate lockfile for pytest
12:23:25.52 [ERROR] 1 Exception encountered:

  ProcessExecutionFailure: Process 'Generate lockfile for pytest' failed with exit code 1.
stdout:
The currently activated Python version 3.9.2 is not supported by the project (>=3.10.0).
Trying to find and use a compatible version. 
Using python3 (3.10.3)
Creating virtualenv pants-lockfile-generation-iFyrOtby-py3.10 in /root/.cache/pypoetry/virtualenvs
Updating dependencies
Resolving dependencies...

  SolverProblemError

  Because pants-lockfile-generation depends on pytest-iters (>=0.0.2) which doesn't match any versions, version solving failed.

  at ~/.cache/pants/named_caches/pex_root/venvs/s/9b4f269e/venv/lib/python3.9/site-packages/poetry/puzzle/solver.py:241 in _solve
      237│             packages = result.packages
      238│         except OverrideNeeded as e:
      239│             return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
      240│         except SolveFailure as e:
    → 241│             raise SolverProblemError(e)
      242│ 
      243│         results = dict(
      244│             depth_first_search(
      245│                 PackageNode(self._package, packages), aggregate_package_nodes
h

hundreds-father-404

05/24/2022, 12:39 PM
Ah I wonder if it is Poetry's caching
a

adorable-engine-71736

05/24/2022, 12:39 PM
yep, seems to be
do you want me to report it on github ?
h

hundreds-father-404

05/24/2022, 12:40 PM
Cool. Yeah not much we can do there I think, but Poetry is on its way out as we get more user testing of Pex lockfiles
Related: until yesterday's commit, Poetry's cache dir setting also does not work -- so we can't control where Poetry writes to
a

adorable-engine-71736

05/24/2022, 12:41 PM
so to clarify - but report or not ?
s/but/bug/
h

hundreds-father-404

05/24/2022, 12:41 PM
No because I don't think there's much Pants can do here, and the code is slated for removal ~soon. Thank you for reporting on Slack tho
a

adorable-engine-71736

05/24/2022, 12:42 PM
yep, cool, understood
thanks for support! (again)
❤️ 1
to confirm that this issue is poetic -
rm ~/.cache/pypoetry/ -rf
resolves
👍 1
5 Views