witty-crayon-22786
11/02/2020, 5:47 PMwitty-crayon-22786
11/02/2020, 5:47 PMwitty-crayon-22786
11/02/2020, 5:50 PMgorgeous-eve-12553
11/02/2020, 5:50 PMfull-oyster-41619
11/03/2020, 9:12 AM2.0.0b1
to 2.0.0
. I have a custom versioning function. while moving between version, I've noticed this output when running ./pants -v
(see attach log file)
this is my custom versioning registry.py file
import logging
from pants.base.build_environment import get_buildroot
from pants.backend.python.goals.setup_py import SetupKwargs, SetupKwargsRequest
from pants.engine.addresses import Addresses
from pants.engine.rules import Get, collect_rules, rule, _uncacheable_rule
from pants.engine.target import Target, TransitiveTargets
from pants.backend.python.target_types import PythonProvidesField
from pants.engine.unions import UnionRule
from utilities.versioning import git
class CustomSetupKwargsRequest(SetupKwargsRequest):
@classmethod
def is_applicable(cls, _: Target) -> bool:
return True
# use "@_uncacheable_rule" instead of "@rule" to avoid caching
# Note: from pants team "The API might change a little (probably just a rename), which we'll be happy to help walk through when the time comes that we make it public."
# @rule
@_uncacheable_rule
async def setup_kwargs_plugin(request: CustomSetupKwargsRequest) -> SetupKwargs:
kwargs = request.explicit_kwargs.copy()
build_root = get_buildroot()
target_path = request.target.address.spec_path
transitive_targets = await Get(TransitiveTargets, Addresses([request.target.address]))
# in pants v2 files are now the "atomic unit" for Pants, rather than targets
# <https://www.pantsbuild.org/docs/how-to-upgrade-pants-2-0#files-are-now-the-atomic-unit-rather-than-targets-130-vs-20>
transitive_dependencies_paths = {tgt.address.spec_path for tgt in transitive_targets.dependencies}
kwargs["version"] = git.get_version(build_root, target_path, transitive_dependencies_paths)
logging.info(f'lib name: {kwargs["name"]}, lib version: {kwargs["version"]}')
return SetupKwargs(kwargs, address=request.target.address)
def rules():
return (*collect_rules(), UnionRule(SetupKwargsRequest, CustomSetupKwargsRequest))
acceptable-guitar-79854
11/03/2020, 3:28 PM./pants --changed-diffspec=origin/main --changed-dependees=transitive test
and I have a failing test
1. first time CI runs -> fail
2. I trigger manually another build / push something else unrelated -> pass
Is there a way to tell pants to run over "changes + transitive dependees + earlier failures"?
Thank youacceptable-guitar-79854
11/03/2020, 3:28 PMuser
11/03/2020, 6:52 PMflat-zoo-31952
11/03/2020, 10:47 PM./pants run
? i've got my binary target set up with an entry point flask.cli:main
, but it seems like it's getting confused by the name of the pex it's run inhappy-kitchen-89482
11/04/2020, 3:24 AM<http://flask.ci|flask.ci>
has a main()
function that is its entry point?witty-crayon-22786
11/05/2020, 6:22 PMwitty-crayon-22786
11/05/2020, 6:31 PMjolly-midnight-72759
11/06/2020, 9:02 PMAddress(project/src/python/app1/cli/main.py:cli)
object. Are the following statements true?
* The part to the left of the colon is always a path to a file relative from the top of the repo.
* The part to the right is the name of the target that has the file as a source.
* If no target is listed, then nothing owns that file.
* When a file has no owner, then pants
goals using targets will not be able to act on that file.happy-kitchen-89482
11/09/2020, 5:19 AMflaky-beard-52072
11/09/2020, 2:48 PMflaky-beard-52072
11/09/2020, 5:29 PMAnything we can help with with trying out Pants?I have a bunch of questions related to differences from bazel. I have an intermediate level of bazel experience: I've written some very simple rules, and defined the build a medium sized multi-language project. is there some "compared to bazel" doc somewhere?
shy-island-79431
11/09/2020, 10:44 PMrun
or test
goals to work. I think the errors are as a result of our directory structure, which looks something like this:
package
-- src
-- package
-- package.py
-- test
-- test_package.py
BUILD
shy-island-79431
11/09/2020, 10:47 PMrun
, I get an import error: Error while finding module specification for 'package.package' (ModuleNotFoundError: No module named 'package')
When running test
, the error is a simple ModuleNotFoundError
.
Has anyone ran into a similar issue?enough-analyst-54434
11/10/2020, 2:13 AMpython
, GOPATH in for go
and -sourcepath for javac
.jolly-midnight-72759
11/10/2020, 3:24 PMbuildkite-agent@raulcicd:~/builds/raulcicd-chartbeat-net-1/chartbeat/lint-check$ /var/lib/buildkite-agent/.cache/pants/setup/bootstrap-Linux-x86_64/2.0.0_py36/bin/pants --level=debug version
Scrubbed PYTHONPATH=/home/ubuntu/superfly from the environment.
10:22:04.81 [DEBUG] acquiring lock: <pants.process.lock.OwnerPrintingInterProcessFileLock object at 0x7faddd0b92e8>
10:22:04.81 [DEBUG] releasing lock: <pants.process.lock.OwnerPrintingInterProcessFileLock object at 0x7faddd0b92e8>
10:22:04.81 [DEBUG] connecting to pantsd on port 44973 (attempt 1/3)
Failed to launch child `/var/lib/buildkite-agent/.cache/pants/setup/bootstrap-Linux-x86_64/2.0.0_py36/bin/pants`: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }
I thought it was apparmor at first, but I think I eliminated that as a cause by successfully running scripts in the same directory.jolly-midnight-72759
11/10/2020, 3:26 PMpantsd
daemon is running as buildkite-agent: buildki+ 31558 0.1 2.3 259972 46740 ? Sl 10:19 0:00 pantsd [/var/lib/buildkite-agent/builds/raulcicd-chartbeat-net-1/chartbeat/lint-check]
jolly-midnight-72759
11/10/2020, 3:28 PMpantsd
it is trying to connect to is different then the one that is running.jolly-midnight-72759
11/10/2020, 3:29 PM--no-pantsd
works for pants version
.jolly-midnight-72759
11/10/2020, 3:31 PMException message: 1 Exception encountered:
ProcessExecutionFailure: Process 'Find interpreter for constraints: CPython>=3.6' failed with exit code 102.
stdout:
stderr:
Could not find a compatible interpreter.
Examined the following interpreters:
1.) /usr/bin/python2.7 CPython==2.7.17
No interpreter compatible with the requested constraints was found:
Version matches CPython>=3.6
(Use --print-stacktrace to see more error details.)
buildkite-agent@raulcicd:~/builds/raulcicd-chartbeat-net-1/chartbeat/lint-check$ python3.6
Python 3.6.9 (default, Oct 8 2020, 12:12:24)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
jolly-midnight-72759
11/10/2020, 3:34 PMinterpreter_constraints = ["CPython>=2.7.17,<3","CPython>=3.6.9,<4"]
interpreter_search_paths = ["<PYENV>", "<PATH>"]
hundreds-father-404
11/10/2020, 3:36 PM-ldebug
to see what Pants is choosing.enough-analyst-54434
11/10/2020, 3:36 PMraulcicd
sees python3.6 (presumably that's on the PATH
for raulcicd
) and buildkite-agent
doesn't, that provides the 1st clue.jolly-midnight-72759
11/10/2020, 3:37 PMbuildkite-agent
user.enough-analyst-54434
11/10/2020, 3:37 PMjolly-midnight-72759
11/10/2020, 3:37 PM/usr/bin/
which is where python
(aliased to python2
), python2
, python3
and python3.6
are all located.