Skip to content
代码片段 群组 项目
未验证 提交 7ed94383 编辑于 作者: tvalentyn's avatar tvalentyn 提交者: GitHub
浏览文件

Don't hardcode python version in tox.ini for lint, mypy and docs. (#31222)

* Don't hardcode python version in tox.ini for lint, mypy and docs.

* fixup

* fixup
上级 287ed388
No related branches found
No related tags found
无相关合并请求
......@@ -491,12 +491,11 @@ tasks.register("pythonDockerBuildPreCommit") {
}
tasks.register("pythonLintPreCommit") {
// TODO(https://github.com/apache/beam/issues/20209): Find a better way to specify lint and formatter tasks without hardcoding py version.
dependsOn(":sdks:python:test-suites:tox:py38:lint")
dependsOn(":sdks:python:test-suites:tox:pycommon:linter")
}
tasks.register("pythonFormatterPreCommit") {
dependsOn("sdks:python:test-suites:tox:py38:formatter")
dependsOn("sdks:python:test-suites:tox:pycommon:formatter")
}
tasks.register("python38PostCommit") {
......
......@@ -26,24 +26,10 @@ applyPythonNature()
// Required to setup a Python 3 virtualenv and task names.
pythonVersion = '3.8'
toxTask "formatter", "py3-yapf-check"
check.dependsOn formatter
// TODO(BEAM-12000): Move tasks that aren't specific to 3.8 to Py 3.9.
def posargs = project.findProperty("posargs") ?: ""
task lint {}
check.dependsOn lint
toxTask "lintPy38", "py38-lint", "${posargs}"
lint.dependsOn lintPy38
toxTask "mypyPy38", "py38-mypy", "${posargs}"
lint.dependsOn mypyPy38
apply from: "../common.gradle"
toxTask "testPy38CloudCoverage", "py38-cloudcoverage", "${posargs}"
test.dependsOn "testPy38CloudCoverage"
project.tasks.register("preCommitPyCoverage") {
......
......@@ -24,8 +24,22 @@
plugins { id 'org.apache.beam.module' }
applyPythonNature()
toxTask "docs", "py38-docs"
def posargs = project.findProperty("posargs") ?: ""
toxTask "docs", "docs"
assemble.dependsOn docs
task preCommitPyCommon() {
}
\ No newline at end of file
}
task linter {}
check.dependsOn linter
toxTask "formatter", "py3-yapf-check"
check.dependsOn formatter
toxTask "lint", "lint", "${posargs}"
linter.dependsOn lint
toxTask "mypy", "mypy", "${posargs}"
linter.dependsOn mypy
......@@ -17,7 +17,7 @@
[tox]
# new environments will be excluded by default unless explicitly added to envlist.
envlist = py38,py39,py310,py311,py38-{cloud,docs,lint,mypy,cloudcoverage,dask},py39-{cloud},py310-{cloud,dask},py311-{cloud,dask},whitespacelint
envlist = py38,py39,py310,py311,py38-{cloud,cloudcoverage,dask},py39-{cloud},py310-{cloud,dask},py311-{cloud,dask},docs,lint,mypy,whitespacelint
toxworkdir = {toxinidir}/target/{env:ENV_NAME:.tox}
[pycodestyle]
......@@ -103,7 +103,7 @@ extras = test,gcp,interactive,dataframe,aws
commands =
bash {toxinidir}/scripts/run_pytest.sh {envname} "{posargs}" "--cov-report=xml --cov=. --cov-append"
[testenv:py38-lint]
[testenv:lint]
# Don't set TMPDIR to avoid "AF_UNIX path too long" errors in pylint.
setenv =
# keep the version of pylint in sync with the 'rev' in .pre-commit-config.yaml
......@@ -124,7 +124,7 @@ deps =
commands =
time {toxinidir}/scripts/run_whitespacelint.sh
[testenv:py38-mypy]
[testenv:mypy]
deps =
mypy==0.790
dask==2022.01.0
......@@ -137,7 +137,7 @@ commands =
python setup.py mypy
[testenv:py38-docs]
[testenv:docs]
extras = test,gcp,docs,interactive,dataframe,dask
deps =
Sphinx==1.8.5
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册