ripe-scooter-10665
06/22/2023, 6:38 AM__init__.py
files) fails when running ruff through pants but not when running manually. I suspect this is to do with how pants splits up files to be linted in batches instead of all together. This isn’t a big deal but thought I’d highlight it as an issue with the ruff integration.
2. Test coverage no longer works, it fails with the following error. This is pretty annoying as we now can’t generate test coverage for our application
ERROR: usage: pex [options] [file_or_dir] [file_or_dir] [...]
pex: error: unrecognized arguments: --cov-report= --cov-config=.coveragerc --cov=src/python --cov=test/python
inifile: None
rootdir: /private/var/folders/vt/dcxqbnwx731dttw2b1ngmsc00000gn/T/pants-sandbox-pkH6WR
3. When defining visibility rules, the docs state that python_sources
can be used as a target unquoted, I didn’t find this to be true, it fails with the following error, putting it in quotes works though:
Engine traceback:
in `dependencies` goal
in Find targets from input specs
MappingError: Failed to parse ./src/python/platform_cli/BUILD:
TypeError: decoding to str: need a bytes-like object, Registrar found
4. It wasn’t clear from your docs on how to define visibility rules for 3rd party dependencies and the way it is defined in the examples in your docs and blog post didn’t seem to work. In the end I figured out, after some trial and error, that "//3rdparty/python**"
worked as a catch all for any 3rd party dependencies. The format "//3rdparty/python:pipenv#xxx"
didn’t work for me (neither did many other combinations of path and wildcards).
5. Pyright doesn’t always seem to give the same errors as VSCode does (i.e. using pyright under the hood), I don’t have specific examples right now but it doesn’t always seem to be consistent.
I want to shout out the great work though, the ruff integration is great and I think being able to define visibility rules will be super useful as our application grows.
Let me know if you want any more information on any of these issues and/or you want me to raise them as GitHub issues.happy-kitchen-89482
06/22/2023, 7:05 AMripe-scooter-10665
06/22/2023, 7:59 AM[pytest]
install_from_resolve = "python-default"
execution_slot_var = "EXECUTION_SLOT"
Adding pytest-cov to my 3rd party requirements has resolved this issue. Thanks for the prompt, still getting my head around the new install_from_resolves
optionbillions-keyboard-33102
06/22/2023, 10:58 AM[pytest]
install_from_resolve = "python-default"
requirements =[
"//:requirements#pytest",
"//:requirements#pytest-cov",
]
This was my requirements
to get coverage working (change to your requirements location). Your python-default
resolve will need to provide those.bitter-ability-32190
06/22/2023, 11:24 AMripe-scooter-10665
06/22/2023, 11:41 AMhappy-kitchen-89482
06/22/2023, 2:57 PMrequirements=
your tests will use the entire lockfile (which is fine if it's a dedicated lockfile for pytest, but probably not what you want if you're using python-default, because it means your tests will all be invalidated if any requirement in that lockfile changes)happy-kitchen-89482
06/22/2023, 2:58 PMhappy-kitchen-89482
06/22/2023, 2:59 PMrequirements
to pick out just the subset of your python-default lockfile that provides pytest and its pluginshappy-kitchen-89482
06/22/2023, 3:00 PMpytest
, pytest-cov
.ripe-scooter-10665
06/22/2023, 3:06 PM