modern-stone-88910
07/07/2022, 7:47 AM"python.defaultInterpreterPath": "./dist/export/python/virtualenvs/default/3.8.13/bin/python",
in my vscode devcontainer settings? When I add "python.analysis.extraPaths": ["./dist/export/python/virtualenvs/default/3.8.13/bin/python"],
analysis with Pylance starts working, but the imports still fail.flat-zoo-31952
07/07/2022, 1:22 PM./pants tailor
check that can auto-fix missing BUILD files?thousands-plumber-33255
07/07/2022, 1:51 PMinstructions
field of docker_image
and then reuse it for multiple applications? E.g.
instructions=[
"FROM python:${VARIANT}"
"COPY ${DYNAMIC_DIR} /app",
]
Background: the Dockerfile for a lot of services looks almost the same.mammoth-queen-9523
07/07/2022, 2:09 PMdocker_image
with pex_binary
on M1 .
docker image created but when i try to run it i get
Failed to find compatible interpreter on path /usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin.
Examined the following interpreters:
1.) /usr/local/bin/python3.9 CPython==3.9.13
No interpreter compatible with the requested constraints was found:
A distribution for pandas could not be resolved for /usr/local/bin/python3.9.
Found 1 distribution for pandas that do not apply:
1.) The wheel tags for pandas 1.4.3 are cp39-cp39-macosx_11_0_arm64 which do not match the supported tags of /usr/local/bin/python3.9:
cp39-cp39-manylinux_2_31_aarch64
... 367 more ...
As I understand pex and docker image was built for different architectures. How can I solve it?happy-family-315
07/07/2022, 2:33 PM__defaults__
gets ignored somehow by BUILD files inside a subdirectory? Maybe this is a bug, because I have a top level django/BUILD
file which contains:
__defaults__({
(python_tests): dict(dependencies=["django/django_core/settings.py"])
})
And a BUILD file under django/sub/tests/classes/BUILD
which just defines:
python_tests(
name="tests",
)
The dependencies goal in the subdirectory does not reference django/django_core/settings.py
If I extend the contents of django/sub/tests/classes/BUILD
the dependency django/django_core/settings.py
gets shown correctly:
__defaults__({
(python_tests): dict(dependencies=["django/django_core/settings.py"])
})
python_tests(
name="tests",
)
brash-baker-91190
07/07/2022, 2:44 PMpytest-cov
, and am trying to refactor a bit of code to use Python's "walrus operator", introduced in Python 3.8. I'm using Python 3.8.13, my syntax is correct, my tests run and pass, but the coverage reporting fails with the following:
10:40:26.59 [ERROR] 1 Exception encountered:
ProcessExecutionFailure: Process 'Generate Pytest xml coverage report.' failed with exit code 1.
stdout:
Couldn't parse '/tmp/process-executionhBLEdi/build-support/packer_hcl.py' as Python source: 'invalid syntax' at line 23
stderr:
This line is where the walrus operator was introduced. I'm using pytest-cov
3.0.0, which supports Python 3.10. I see no issues or PRs about this in either Pytest or `pytest-cov`'s repositories.
Is it possible that something in how Pants is running things is causing this? Has anybody else seen anything like this? Thanks in advance.happy-kitchen-89482
07/07/2022, 4:31 PMsteep-waitress-53641
07/07/2022, 5:35 PM[python-bootstrap]
config, but specifying ["<PYENV>"] isn't working (which may be a pyenv/path issue)
2. What's blocking pants from using python 3.10 (I see the tracking ticket https://github.com/pantsbuild/pants/issues/14111). I see that pex supports python 3.10 as of Novemberish per https://github.com/pantsbuild/pex/issues/1487.hundreds-father-404
07/07/2022, 5:57 PMhundreds-father-404
07/07/2022, 8:12 PMworried-painter-31382
07/07/2022, 8:38 PMbumpy-soccer-78991
07/07/2022, 9:17 PMbumpy-soccer-78991
07/07/2022, 9:18 PMred-ghost-2220
07/07/2022, 9:33 PMbig-xylophone-43403
07/07/2022, 10:02 PMbumpy-soccer-78991
07/07/2022, 10:18 PM[scala].version_for_resolve
to get some example working (with default and non-default version) would have been helpful. I was able to figure it out with some trial/error though. Also, it’s quite possible I missed it, but wasn’t able to find a page discussing resolve
in more detail - it seems like it’s an important pants concept.bumpy-soccer-78991
07/07/2022, 10:47 PMrough-electrician-21871
07/08/2022, 12:58 AMhappy-family-315
07/08/2022, 9:47 AMpants test ::
for testing django the performance is much worse than just using pytest
. Each test takes 8.5-9.5 secs (constantly) , because of some pants setup I think. Using pytest most of the tests run in under one second. I thought pants could run tests in parallel but only one core out of 4 is used. Maybe I am doing something wrong. Also caching seems not to work: When rerunning tests (without changing any files inbetween) every tests gets called again, not only the ones that failed. Is this because I am using a development version of pants or a configuration error?
PANTS_SHA: f721c1077f97ef1aacba2a093f3f5cfd9677dc75
[pytest]
lockfile = "lockfiles/python/tools/pytest"
version = "pytest>=7.1.2,<7.2"
extra_requirements.add = [
"pytest-django==4.5.2",
"pytest-icdiff==0.5",
"mixer==7.2.1"
]
brave-toddler-94793
07/08/2022, 10:57 AMpytest
you can use markers to run tests selectively. So maybe you want to 1st run all unit tests (quick, no services, etc). Then run tests that require a database and some local services. Then run tests that require external services/APIs. The idea being to not waste time testing some API client if some unit test will fail after it.
The "normal" way is to use markers and run pytest one time for each. Another way is to sort all tests (across all modules) to run unit first, integration after.
But I cannot see a way to leverage this in Pants (without messing around with environment variables). What is the "pants way" to run unit & integrations tests in separate goals?able-shampoo-44547
07/08/2022, 12:56 PMtests/test_hyperspec.py F [100%]
=================================== FAILURES ===================================
_________________________________ test_import __________________________________
def test_import():
> import sphinxcontrib.hyperspec
E ModuleNotFoundError: No module named 'sphinxcontrib.hyperspec'
tests/test_hyperspec.py:19: ModuleNotFoundError
- generated xml file: /tmp/process-execution1Z9sbF/tests.test_hyperspec.py.tests0.xml -
=========================== short test summary info ============================
FAILED tests/test_hyperspec.py::test_import - ModuleNotFoundError: No module ...
============================== 1 failed in 0.08s ===============================
I can see the files there, but i can't seem to actually import the module
$ find sphinxcontrib tests
sphinxcontrib
sphinxcontrib/cldomain.lisp
sphinxcontrib/cldomain.py
sphinxcontrib/test.lisp
sphinxcontrib/__init__.py
sphinxcontrib/package.lisp
sphinxcontrib/hyperspec.py
sphinxcontrib/version.lisp-expr
tests
tests/test_cldomain.py
tests/__init__.py
tests/__pycache__
tests/__pycache__/__init__.cpython-38.pyc
tests/__pycache__/test_cldomain.cpython-38-pytest-7.1.2.pyc
I went into the directory directly and tested with a local python and with the sandbox python, but the cached one can't import stuff? I commented out the contents of the files completely, to make sure it wasn't an issue with loading them
$ cd /tmp/.tmpDGxM5D
$ python
Python 3.8.5 (default, Aug 13 2020, 15:51:26)
[GCC 10.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sphinxcontrib
>>> import sphinxcontrib.cldomain
>>>
$ /home/russell/.cache/pants/named_caches/pex_root/venvs/s/a67a3153/venv/bin/python3.8
Python 3.8.5 (default, Aug 13 2020, 15:51:26)
[GCC 10.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sphinxcontrib
>>> import sphinxcontrib.cldomain
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'sphinxcontrib.cldomain'
>>>
any idea what could be going on? i'm on pants 2.12.0proud-appointment-36730
07/08/2022, 5:24 PMbored-glass-58755
07/08/2022, 6:00 PMProcess
and await Get
the ProcessResult
but the plugin is ending in following error:
Error launching process: Os { code: 2, kind: NotFound, message: "No such file or directory" }
.
I am also having a hard time in providing a workspace folder location to the Process. Could anyone please help me with the above error and providing a workspace folder?happy-kitchen-89482
07/09/2022, 6:07 AMmysterious-waiter-14207
07/09/2022, 7:39 AMClasspathEntry
is third party or first? I thought about adding a third_party
flag to ClasspathEntry
but it seems that a ClasspathEntry
can actually hold both first party and third party jars.
One alternative is to use some kind of regex to recognize coursier jars, but I'm not a big fan of it.
Few reasons for the plugin:
1. Merging all jars can take time
2. we want reproducible jars (no timestamps or metadata), coursier is already reproducible, so we only need to strip first party jars.
3. From our experience, merging jars (fat jar) can actually override resources in un-determinstic way.
4. We would later pack everything with Kaniko and only push the image to registry if digest is different.able-shampoo-44547
07/09/2022, 1:46 PMpex.environment.ResolveError: Failed to resolve requirements from PEX environment @ /home/russell/.cache/pants/named_caches/pex_root/unzipped_pexes/65af0cca88bb416d7230e8e933478380260e9e31.
Needed cp39-cp39-manylinux_2_33_x86_64 compatible dependencies for:
1: Sphinx
Required by:
sphinxcontrib-cldomain 0.14
But this pex had no ProjectName(raw='Sphinx', normalized='sphinx') distributions.
2: setuptools
Required by:
sphinxcontrib-cldomain 0.14
But this pex had no ProjectName(raw='setuptools', normalized='setuptools') distributions.
I have verified that my python_distribution correctly generates with dependencies on these 2 libraries in it's metadata, and
the libraries show up as dependencies
$ ./pants dependencies --transitive tests:tests0
//:pyproject
//:sphinxcontrib-cldomain
//LICENSE:cldomain_files
//README.rst:cldomain_files
//src/sphinxcontrib/__init__.py:../../lib
//src/sphinxcontrib/cldomain/__init__.py:../../../lib
//src/sphinxcontrib/cldomain/cldomain.py:../../../lib
//src/sphinxcontrib/hyperspec/__init__.py:../../../lib
//src/sphinxcontrib/hyperspec/hyperspec.py:../../../lib
3rdparty/python#Sphinx
3rdparty/python#setuptools
3rdparty/python/requirements.txt
src/sphinxcontrib/cldomain/cldomain.lisp:lisp_lib
src/sphinxcontrib/cldomain/package.lisp:lisp_lib
src/sphinxcontrib/cldomain/test.lisp:lisp_lib
src/sphinxcontrib/cldomain/version.lisp-expr:lisp_lib
tests/test_cldomain.py:tests0
tests/test_hyperspec.py:tests0
but i get the ResolveError
as above when i run ./pants tests tests:tests0
the code i'm working off is https://github.com/russell/sphinxcontrib-cldomain/tree/013c10294fb63c5371cbef92ff6999a9845aee32little-zoo-57121
07/10/2022, 5:20 AM./pants test
on the desired target(s), but I'm really digging using pants
as my do-all tool. My question is: do I have a way within pants
to do both of these things together? More specifically, is there a way for pants to run the image as defined as a docker_image
target in a BUILD
and then run the tests that aim to use it? (edit: via a single invocation, where pants knows these tests need this container to run)
I have tried some various exploration using dependencies, and looked through the docs to see if something similar was outlined there but have come up empty handed. Or is this just not something that I can currently do?fresh-cat-90827
07/11/2022, 10:11 AM./pants dependencies project::
or ./pants peek project::
commands? I was relying on ./pants dependencies project:: --dependencies-type=3rdparty
but this option was deprecated in 2.9.0
. The help docs say that a more robust way of querying dependencies should be available in the later versions, but I struggle to find any.thousands-plumber-33255
07/11/2022, 4:11 PMregistries
field to another container? I.e. I am running pants from a container that is in the same network as my localstack container. I can access it with localstack
as the host and not localhost
. But with
registries=[
"localstack:4510",
],
It is trying to reach Get <https://localstack:4510/v2/>": dial tcp: lookup localstack on 192.168.65.5:53: no such host
ambitious-student-81104
07/11/2022, 4:34 PMresolve
respect filesystem hierarchy? e.g. if I have something like this:
BUILD(a)
...
foo/
BUILD(b)
...
If I specify in BUILD(a)
:
python_sources(resolve="my-resolve")
but don’t specify a resolve in BUILD(b)
, does it / can we make it follow what’s in BUILD(a)
by default?