ambitious-actor-36781
05/09/2021, 11:36 AMmyrepo
or mr
). under /libraries
, /services
etc.
But despite setting
[source]
root_patterns = [
"/scripts",
"/libraries",
"/services",
"/devops",
]
./pants count-loc '*'
doesn't find anything that isn't a file in the rootincalculable-yak-57772
05/10/2021, 3:32 PMPEXWarning: PEX_ROOT is configured as /Users/<username>/.pex but that path is un-writeable, falling back to a temporary PEX_ROOT of /private/var/folders/cf/z3ktw6dn467gvm24fgx8ft6c0000gp/T/tmp50005su_ which will hurt performance.
I am curious about the reference to the performance being reduced. Is it because artifacts like installed wheels cannot be re-used across pex builds or is it because of something else?plain-sundown-25537
05/10/2021, 6:56 PMhappy-kitchen-89482
05/10/2021, 8:03 PMbusy-vase-39202
05/10/2021, 8:51 PMplain-carpet-73994
05/10/2021, 11:43 PMtype_stubs
directory to the root of my repo and added the following to my `pants.toml`:
[source]
root_patterns = ['/', 'type_stubs']
I added a BUILD
file in `type_stubs`:
$ cat type_stubs/BUILD
python_requirement_library(
name = 'numpy_stubs',
requirements=[
'numpy-stubs@ git+<https://github.com/numpy/numpy-stubs@c49d2d6875971a669a166ea93ef998911af283a1>'
]
)
That didn't cause any errors but mypy didn't pick up the stubs for numpy so I also added this to my BUILD
target that uses `numpy`:
python_library(
dependencies=[
'//type_stubs/:numpy_stubs'
]
)
which causes the following error:
Exception message: 1 Exception encountered:
InvalidSpecPath: Address spec has un-normalized path part 'type_stubs/'
Removing the leading //
didn't help either. What am I doing wrong? And, is there an easier way to add stubs for things like numpy?plain-carpet-73994
05/10/2021, 11:48 PM//
and now it works. I swear it didn't before 🧌plain-carpet-73994
05/10/2021, 11:50 PM16:45:19.88 [WARN] Ignoring `[python_setup].resolve_all_constraints` option because constraints file does not cover all requirements.
which I think means my constraints.txt
is being ignored (I didn't quite grok the docs). That seems unfortunate. Note that the stubs are git+http
style so I can't freeze them even if I did put them in the <http://requirements.in|requirements.in>
. Is there no way to get these 3rd party type stubs but also keep the constraints.txt
working?plain-carpet-73994
05/10/2021, 11:51 PMenough-analyst-54434
05/11/2021, 2:11 PM--a-list-option=a
appends a to the the list option just as the vector form --a-list-option="+['a']"
does)happy-kitchen-89482
05/11/2021, 3:22 PMhappy-kitchen-89482
05/11/2021, 6:41 PMbig-fall-51153
05/11/2021, 9:46 PMtest.py
settings module, which does a wildcard import on a shared.py
setting file and then does a few overrides. This is working for me and it is a much simpler version of what django does internally:
from django.conf import settings
from my.app.settings import test as test_settings
def pytest_configure():
""" Configure django settings """
settings.configure(**{key: getattr(test_settings, key) for key in dir(test_settings) if key.isupper()})
proud-dentist-22844
05/12/2021, 4:00 AMskip_pylint=True
to a lot of BUILD files, but pylint is still reporting errors on py files in those directories. Any idea what I'm missing?
https://github.com/st2sandbox/st2/commit/aa2ba3a2bb8540fbc80f82d644ba2c7ffad2d3a0proud-dentist-22844
05/12/2021, 5:06 AM[pylint].args
?
[pylint]
args = [
"--jobs=${PYLINT_CONCURRENCY:-1}",
]
[subprocess-environment]
env_vars.add = [
"PYLINT_CONCURRENCY",
]
It looks like I can't use shell syntax, so is there another way?
pex: error: option --jobs: invalid integer value: '${PYLINT_CONCURRENCY:-1}'
proud-dentist-22844
05/12/2021, 8:15 AM./pants lint ::
runs black, flake8, and pylint on the appropriate files now and it completes in a reasonable amount of time (pylint takes a couple minutes)
Next step "Set up tests": https://www.pantsbuild.org/v2.5/docs/existing-repositories#3-set-up-testsproud-dentist-22844
05/12/2021, 8:19 AM~/.pants.toml
)?
I'm interested in providing it on my machine and in CI, but I don't want to turn it on by default on other people's machines (when they check out the open source repo).big-fall-51153
05/12/2021, 1:32 PMbuild-support/bin
in pantsbuild/pants
, but having trouble getting it to run. I have the directory in [source].root_patterns
, and a pex_binary
in build-support/bin
but I feel I'm missing something because I get this error:
λ › ./pants run build-support/bin/changelog.py odl/ol-django nl/pants-t2
Traceback (most recent call last):
File "/home/nathan/odl/ol-django/.pants.d/tmpstd0qzkb/changelog.pex/.bootstrap/pex/pex.py", line 489, in execute
File "/home/nathan/odl/ol-django/.pants.d/tmpstd0qzkb/changelog.pex/.bootstrap/pex/pex.py", line 406, in _wrap_coverage
File "/home/nathan/odl/ol-django/.pants.d/tmpstd0qzkb/changelog.pex/.bootstrap/pex/pex.py", line 437, in _wrap_profiling
File "/home/nathan/odl/ol-django/.pants.d/tmpstd0qzkb/changelog.pex/.bootstrap/pex/pex.py", line 545, in _execute
File "/home/nathan/odl/ol-django/.pants.d/tmpstd0qzkb/changelog.pex/.bootstrap/pex/pex.py", line 672, in execute_entry
File "/home/nathan/odl/ol-django/.pants.d/tmpstd0qzkb/changelog.pex/.bootstrap/pex/pex.py", line 684, in execute_module
File "/home/nathan/.pyenv/versions/3.6.10/lib/python3.6/runpy.py", line 201, in run_module
mod_name, mod_spec, code = _get_module_details(mod_name)
File "/home/nathan/.pyenv/versions/3.6.10/lib/python3.6/runpy.py", line 136, in _get_module_details
raise error("No module named %s" % mod_name)
ImportError: No module named changelog
enough-analyst-54434
05/12/2021, 1:47 PMbig-fall-51153
05/12/2021, 1:54 PMenough-analyst-54434
05/12/2021, 1:56 PMpython_library()
at the top of the BUILD file. As you found out - that's critical.
It's also easy to miss because its not clear why you should need to have it. You might be able to save pain going forward (I still often forget to add a python_library) by using ./pants tailor
. More on that here: https://www.pantsbuild.org/docs/troubleshooting#import-errors-and-missing-dependenciesbig-fall-51153
05/12/2021, 2:08 PMbest-nightfall-7221
05/12/2021, 4:08 PMlibx=1.1
. I'd like to build the fatjar once with libx=1.1
and once with libx=1.2
.
I can think of 2 ways to do it:
a) At the top fatjar, exclude all libx dependencies, and then include the version I want
b) At every point in the tree, pass some flag (env variable?) so that it can switch between 1.1 and 1.2
And of course, I'd like to avoid the solution that requires a copy of all the BUILD
files. Thanks for any pointers.powerful-florist-1807
05/12/2021, 7:16 PMuser
05/12/2021, 7:51 PMhundreds-father-404
05/13/2021, 2:08 AMNailgunClientException: Nailgun client error: "Nailgun client error: Client exited before the server\'s result could be returned."We're trying really hard to track it down, and it's been difficult to reproduce.
proud-dentist-22844
05/13/2021, 7:29 AMimport yaml
$ ./pants dependencies st2common/st2common/constants/meta.py
st2common/st2common/__init__.py
st2common/st2common/conf/base.logging.conf:base_logging_conf
st2common/st2common/constants/__init__.py
Why isn't it picking up the yaml dep?
https://github.com/st2sandbox/st2/blob/pants/st2common/st2common/constants/meta.py
https://github.com/st2sandbox/st2/blob/pants/requirements-pants.txt#L40
https://github.com/st2sandbox/st2/blob/pants/constraints-pants.txt#L89
https://github.com/pantsbuild/pants/blob/2.5.x/src/python/pants/backend/python/dependency_inference/default_module_mapping.py#L19proud-dentist-22844
05/13/2021, 8:13 AMpkg_resources
which is in setuptools
a dep, flex
does not declare a dep on setuptools
(they think its std lib): https://github.com/pipermerriam/flex/blob/master/flex/__init__.py#L6
What are my options for getting pants to include setuptools in this case?creamy-truck-92790
05/13/2021, 2:40 PMproud-dentist-22844
05/13/2021, 3:06 PM