-
-
Notifications
You must be signed in to change notification settings - Fork 739
/
pants.toml
155 lines (143 loc) · 5.59 KB
/
pants.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
[anonymous-telemetry]
# This is opt-in by default, but we explicitly disable here as well.
enabled = false
# repo_id here allows individuals to opt-in on their machine
# To opt-in, use ~/.pants.rc or envrc to set [anonymous-telemetry].enabled=true
repo_id = "de0dea7a-9f6a-4c6e-aa20-6ba5ad969b8a"
[GLOBAL]
pants_version = "2.14.0"
backend_packages = [
# python
"pants.backend.python",
"pants.backend.experimental.python", # activates twine `publish` support
"pants.backend.python.mixed_interpreter_constraints",
"pants.backend.python.lint.bandit",
"pants.backend.python.lint.black",
"pants.backend.python.lint.flake8",
# shell
"pants.backend.shell",
"pants.backend.shell.lint.shellcheck",
]
# pants ignores files in .gitignore, .*/ directories, /dist/ directory, and __pycache__.
pants_ignore.add = [
# TODO: remove these once we start building wheels with pants.
"dist_utils.py",
"setup.py",
# keep tailor from using legacy requirements files (not for pants)
"contrib/examples/requirements.txt",
"contrib/hello_st2/requirements.txt",
"contrib/runners/*/in-requirements.txt",
"contrib/runners/*/requirements.txt",
"st2*/in-requirements.txt",
"st2*/requirements.txt",
"st2common/tests/fixtures/requirements-used-for-tests.txt",
"/fixed-requirements.txt",
"/test-requirements.txt",
# ignore requirements.txt for now, preferring interim files that are decoupled from
# legacy requirements files generation: requirements-pants.txt & lockfiles/st2-constraints.txt
"/requirements.txt",
]
[source]
# recording each pack individually under root patterns is not great, but resolves these issues:
# - Using a /contrib/* or other glob in root_patterns is dodgy as runners & schemas are in the same dir.
# In particular, with /contrib/* in root_patterns, *_runner imports become ambiguous
# (eg `import noop_runner` should use runners/noop_runner/noop_runner not runners/noop_runner).
# - Using pack.yaml in marker_filenames prevents pants from inferring which fixture packs are
# used by which tests. We import a PACK_NAME and PACK_PATH from fixture.py in each of these
# fixture packs to enable this dependency inferrence. Having fine grained inferrence in-turn
# reduces the number of tests that need to be re-run when we change a fixture.
# - Using another marker_file, like PACK_ROOT, is also problematic because of the core pack.
# /contrib/core is symlinked to /st2tests/st2tests/fixtures/packs/core for use as a fixture.
# It is used in quite a few tests, so it needs to continue living in both places.
# But, overlapping source roots (for st2tests and the pack) make importing from the fixture
# as we do with the other fixtures impossible.
# Thus, we really do need to register each pack in contrib (but never under st2tests) separately.
# We might also need to register packs in st2tests/testpacks.
root_patterns = [
# root conftest.py
"/",
# core libs
"/st2*",
# runners
"/contrib/runners/*_runner",
# packs (list /contrib/* packs individually; see note above)
"/contrib/chatops",
"/contrib/core", # WARNING: also symlinked to st2tests/st2tests/fixtures/packs/core
"/contrib/default",
"/contrib/examples",
"/contrib/hello_st2",
"/contrib/linux",
"/contrib/packs",
"/st2tests/testpacks/checks",
"/st2tests/testpacks/errorcheck",
# odd import in examples.isprime
"/contrib/examples/lib",
# lint plugins
"/pylint_plugins",
# misc
"/scripts",
"/tools",
# benchmarks
"/st2common/benchmarks/micro",
]
[python]
# resolver_version is always "pip-2020-resolver". legacy is not supported.
enable_resolves = true
default_resolve = "st2"
interpreter_constraints = [
# python_distributions needs a single constraint (vs one line per python version).
# officially, we exclude 3.7 support, but that adds unnecessary complexity: "CPython>=3.6,!=3.7.*,<3.9",
"CPython>=3.6,<3.9",
]
[python.resolves]
st2 = "lockfiles/st2.lock"
pylint_plugins = "lockfiles/pylint_plugins.lock"
[python.resolves_to_constraints_file]
# Our direct requirements are in requirements-pants.txt;
# put indirect/transitive version constraints here:
st2 = "lockfiles/st2-constraints.txt"
[python-infer]
# https://www.pantsbuild.org/docs/reference-python-infer#unowned_dependency_behavior
# The default changed from "ignore" to "warning" in pants 2.14.
# Many of the new warnings however have been adressed via explicit deps,
# so the warnings are not helpful. In pants 2.16, a "visibility" feature might help
# us to disambiguate deps between files without those explicit BUILD dependencies,
# and without adding "# pants: no-infer-dep" comments all over the codebase.
# Revisit this in pants 2.16 to see if it is feasible to use the default "warning".
unowned_dependency_behavior = "ignore"
[bandit]
lockfile = "lockfiles/bandit.lock"
version = "bandit==1.7.0"
args = [
"-lll", # only HIGH severity level
"--exclude",
"build,dist",
"--quiet", # only show output in the case of an error
]
extra_requirements = [
"setuptools",
# bandit needs stevedore which needs importlib-metadata<5
# see: https://github.com/PyCQA/bandit/pull/952
"importlib-metadata<5;python_version<'3.8'",
]
[black]
lockfile = "lockfiles/black.lock"
version = "black==22.3.0"
interpreter_constraints = [
"CPython>=3.6.2,<3.9",
]
[flake8]
lockfile = "lockfiles/flake8.lock"
version = "flake8==4.0.1" # st2flake8 does not support flake8 v5
extra_requirements = [
# license check plugin
"st2flake8==0.1.0", # TODO: remove in favor of regex-lint
]
config = "lint-configs/python/.flake8"
[pylint]
version = "pylint~=2.8.2"
extra_requirements = [
"setuptools", # includes pkg_resources
]
[regex-lint]
config = "@lint-configs/regex-lint.yaml"