Skip to content

Commit dc00da8

Browse files
authored
Configure pantsbuild source roots (#5724)
Configure pants source roots https://www.pantsbuild.org/docs/initial-configuration\#configure-source-roots based on a lot of work in a PoC pants branch.
1 parent 675b1e6 commit dc00da8

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

CHANGELOG.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Added
5353

5454
* Begin introducing `pants <https://www.pantsbuild.org/docs>`_ to improve DX (Developer Experience)
5555
working on StackStorm, improve our security posture, and improve CI reliability thanks in part
56-
to pants' use of PEX lockfiles. This is not a user-facing addition. #5713
56+
to pants' use of PEX lockfiles. This is not a user-facing addition. #5713 #5724
5757
Contributed by @cognifloyd
5858

5959
Changed

pants.toml

+44
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,46 @@
11
[GLOBAL]
22
pants_version = "2.13.0rc2"
3+
4+
[source]
5+
# recording each pack individually under root patterns is not great, but resolves these issues:
6+
# - Using a /contrib/* or other glob in root_patterns is dodgy as runners & schemas are in the same dir.
7+
# In particular, with /contrib/* in root_patterns, *_runner imports become ambiguous
8+
# (eg `import noop_runner` should use runners/noop_runner/noop_runner not runners/noop_runner).
9+
# - Using pack.yaml in marker_filenames prevents pants from inferring which fixture packs are
10+
# used by which tests. We import a PACK_NAME and PACK_PATH from fixture.py in each of these
11+
# fixture packs to enable this dependency inferrence. Having fine grained inferrence in-turn
12+
# reduces the number of tests that need to be re-run when we change a fixture.
13+
# - Using another marker_file, like PACK_ROOT, is also problematic because of the core pack.
14+
# /contrib/core is symlinked to /st2tests/st2tests/fixtures/packs/core for use as a fixture.
15+
# It is used in quite a few tests, so it needs to continue living in both places.
16+
# But, overlapping source roots (for st2tests and the pack) make importing from the fixture
17+
# as we do with the other fixtures impossible.
18+
# Thus, we really do need to register each pack in contrib (but never under st2tests) separately.
19+
# We might also need to register packs in st2tests/testpacks.
20+
root_patterns = [
21+
# root conftest.py
22+
"/",
23+
# core libs
24+
"/st2*",
25+
# runners
26+
"/contrib/runners/*_runner",
27+
# packs (list /contrib/* packs individually; see note above)
28+
"/contrib/chatops",
29+
"/contrib/core", # WARNING: also symlinked to st2tests/st2tests/fixtures/packs/core
30+
"/contrib/default",
31+
"/contrib/examples",
32+
"/contrib/hello_st2",
33+
"/contrib/linux",
34+
"/contrib/packs",
35+
"/st2tests/testpacks/checks",
36+
"/st2tests/testpacks/errorcheck",
37+
# odd import in examples.isprime
38+
"/contrib/examples/lib",
39+
# lint plugins
40+
"/pylint_plugins",
41+
# misc
42+
"/scripts",
43+
"/tools",
44+
# benchmarks
45+
"/st2common/benchmarks/micro",
46+
]

0 commit comments

Comments
 (0)