@@ -110,20 +110,37 @@ interpreter_constraints = [
110110 # python_distributions needs a single constraint (vs one line per python version).
111111 # officially, we exclude 3.7 support, but that adds unnecessary complexity: "CPython>=3.6,!=3.7.*,<3.9",
112112 " CPython>=3.6,<3.9" ,
113+ # NB: constraints for tools defined below
113114]
114115
115116[python .resolves ]
117+ # st2 is the primary resolve
116118st2 = " lockfiles/st2.lock"
117- pylint_plugins = " lockfiles/pylint_plugins.lock" # lockfiles/pylint.lock should have same contents
118- pants-plugins = " lockfiles/pants-plugins.lock"
119+ # tool and misc other resolves (for most, see //BUILD.tools)
120+ bandit = " lockfiles/bandit.lock"
121+ black = " lockfiles/black.lock"
122+ flake8 = " lockfiles/flake8.lock"
123+ pants-plugins = " lockfiles/pants-plugins.lock" # see //pants-plugins/BUILD
124+ pylint = " lockfiles/pylint.lock" # see //pylint_plugins/BUILD
125+ pytest = " lockfiles/pytest.lock"
126+ setuptools = " lockfiles/setuptools.lock"
127+ twine = " lockfiles/twine.lock"
119128
120129[python .resolves_to_interpreter_constraints ]
130+ # for tools, we have to include constraints for st2 and pants-plugins
131+ bandit = [" CPython>=3.6,<3.10" ]
132+ black = [" CPython>=3.6.2,<3.10" ] # black doesn't support <3.6.2
133+ flake8 = [" CPython>=3.6,<3.10" ]
121134pants-plugins = [
122135 # this should match the pants interpreter_constraints:
123136 # https://github.com/pantsbuild/pants/blob/2.14.x/pants.toml#L125
124137 # See: https://www.pantsbuild.org/docs/prerequisites
125138 " CPython>=3.7,<3.10" ,
126139]
140+ pylint = [" CPython>=3.6,<3.10" ]
141+ pytest = [" CPython>=3.6,<3.10" ]
142+ setuptools = [" CPython>=3.6,<3.10" ]
143+ twine = [" CPython>=3.6,<3.10" ]
127144
128145[python .resolves_to_constraints_file ]
129146# Our direct requirements are in requirements-pants.txt;
@@ -158,34 +175,25 @@ ambiguity_resolution = "by_source_root"
158175generate_setup_default = true # true by default
159176
160177[bandit ]
161- lockfile = " lockfiles/bandit.lock"
162- version = " bandit==1.7.0"
163178args = [
164179 " -lll" , # only HIGH severity level
165180 " --exclude" ,
166181 " build,dist" ,
167182 " --quiet" , # only show output in the case of an error
168183]
169- extra_requirements = [
170- " setuptools" ,
171- # bandit needs stevedore which needs importlib-metadata<5
172- # see: https://github.com/PyCQA/bandit/pull/952
173- " importlib-metadata<5;python_version<'3.8'" ,
174- ]
184+ install_from_resolve = " bandit"
185+ requirements = [" bandit" , " setuptools" , " GitPython" ] # versions in BUILD.tools
175186
176187[black ]
177- lockfile = " lockfiles/black.lock"
178- version = " black==22.3.0"
179- interpreter_constraints = [
180- " CPython>=3.6.2,<3.9" ,
181- ]
188+ install_from_resolve = " black"
189+ requirements = [" black" ] # version in BUILD.tools
182190
183191[flake8 ]
184- lockfile = " lockfiles/ flake8.lock "
185- version = " flake8==4.0.1 " # st2flake8 does not support flake8 v5
186- extra_requirements = [
192+ install_from_resolve = " flake8"
193+ requirements = [ # versions in BUILD.tools
194+ " flake8 " ,
187195 # license check plugin
188- " st2flake8==0.1.0 " , # TODO: remove in favor of regex-lint
196+ " st2flake8" , # TODO: remove in favor of regex-lint or preamble
189197]
190198config = " lint-configs/python/.flake8"
191199
@@ -207,11 +215,8 @@ known_versions = [
207215]
208216
209217[pylint ]
210- lockfile = " lockfiles/pylint.lock"
211- version = " pylint~=2.8.2"
212- extra_requirements = [
213- " setuptools" , # includes pkg_resources
214- ]
218+ install_from_resolve = " pylint"
219+ requirements = [" pylint" , " setuptools" ] # versions in pylint_plugins/BUILD
215220config = " lint-configs/python/.pylintrc"
216221source_plugins = [
217222 # the /pylint_plugins directory
@@ -227,10 +232,10 @@ args = [
227232]
228233
229234[pytest ]
230- lockfile = " lockfiles/ pytest.lock "
231- version = " pytest==7.0.1 " # copied from https://www.pantsbuild.org/v2.14/docs/reference-pytest#version
232- extra_requirements.add = [
233- " pytest-benchmark[histogram]==3.4.1 " , # used for st2common/benchmarks
235+ install_from_resolve = " pytest"
236+ requirements = [ # versions in BUILD.tools
237+ " pytest " ,
238+ " pytest-benchmark[histogram]" , # used for st2common/benchmarks
234239 # "pytest-timer[colorama]", # report test timing (--with-timer ala nose-timer)
235240 " pytest-icdiff" , # make diff output easier to read
236241 " pygments" , # highlight code in tracebacks
@@ -239,9 +244,9 @@ extra_requirements.add = [
239244 # "pytest-timeout", # time limit on tests
240245 # "pytest-mock", # more convenient mocking
241246
242- # included by default with pants
243- # "pytest-cov", # coverage
244- # "pytest-xdist", # parallel test runs (pants uses this if [pytest].xdist_enabled)
247+ # needed by pants
248+ " pytest-cov" , # coverage
249+ " pytest-xdist" , # parallel test runs (pants uses this if [pytest].xdist_enabled)
245250]
246251args = [
247252 " --no-header" , # don't print pytest version for every tested file
@@ -252,10 +257,9 @@ execution_slot_var = "ST2TESTS_PARALLEL_SLOT"
252257config = " @lint-configs/regex-lint.yaml"
253258
254259[setuptools ]
255- # setuptools 59.7 (at least) does not support python 3.6
256- version = " setuptools>=50.3.0,<59.0"
257- lockfile = " lockfiles/setuptools.lock"
260+ install_from_resolve = " setuptools"
261+ requirements = [" setuptools" , " wheel" ] # versions in BUILD.tools
258262
259263[twine ]
260- lockfile = " lockfiles/ twine.lock "
261- version = " twine>=3.7.1,<3.8 "
264+ install_from_resolve = " twine"
265+ requirements = [ " twine" , " colorama " ] # versions in BUILD.tools
0 commit comments