Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
1c873af9
Unverified
Commit
1c873af9
authored
May 08, 2023
by
James Lamb
Committed by
GitHub
May 08, 2023
Browse files
[ci] [python-package] move tool configuration to pyproject.toml (#5872)
parent
3d63ddac
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
21 deletions
+45
-21
.ci/lint-python.sh
.ci/lint-python.sh
+8
-19
.ci/test.sh
.ci/test.sh
+1
-1
build-python.sh
build-python.sh
+5
-0
python-package/README.rst
python-package/README.rst
+1
-1
python-package/pyproject.toml
python-package/pyproject.toml
+18
-0
python-package/setup.cfg
python-package/setup.cfg
+12
-0
No files found.
.ci/lint-python.sh
View file @
1c873af9
#!/bin/sh
#!/bin/sh
DIR_TO_CHECK
=
${
1
}
echo
"running flake8"
echo
"running flake8"
flake8
\
flake8
\
--ignore
=
E501,W503
\
--config
=
./python-package/setup.cfg
\
--exclude
=
./.nuget,./external_libs,./python-package/build,./python-package/compile
\
.
\
"
${
DIR_TO_CHECK
}
"
\
||
exit
-1
||
exit
-1
echo
"done running flake8"
echo
"done running flake8"
echo
"running pydocstyle"
echo
"running pydocstyle"
pydocstyle
\
pydocstyle
\
--convention
=
numpy
\
--config
=
./python-package/pyproject.toml
\
--add-ignore
=
D105
\
.
\
--match-dir
=
"^(?!^external_libs|test|example).*"
\
--match
=
"(?!^test_|setup).*
\.
py"
\
"
${
DIR_TO_CHECK
}
"
\
||
exit
-1
||
exit
-1
echo
"done running pydocstyle"
echo
"done running pydocstyle"
echo
"running isort"
echo
"running isort"
isort
\
isort
\
--check-only
\
--check-only
\
"
${
DIR_TO_CHECK
}
"
\
--settings-path
=
./python-package/pyproject.toml
\
.
\
||
exit
-1
||
exit
-1
echo
"done running isort"
echo
"done running isort"
echo
"running mypy"
echo
"running mypy"
mypy
\
mypy
\
--ignore-missing-imports
\
--config-file
=
./python-package/pyproject.toml
\
--exclude
'build/'
\
./python-package
\
--exclude
'compile/'
\
--exclude
'docs/'
\
--exclude
'examples/'
\
--exclude
'external_libs/'
\
--exclude
'tests/'
\
"
${
DIR_TO_CHECK
}
/python-package"
\
||
true
||
true
echo
"done running mypy"
echo
"done running mypy"
.ci/test.sh
View file @
1c873af9
...
@@ -78,7 +78,7 @@ if [[ $TASK == "lint" ]]; then
...
@@ -78,7 +78,7 @@ if [[ $TASK == "lint" ]]; then
"r-lintr>=3.0"
"r-lintr>=3.0"
source
activate
$CONDA_ENV
source
activate
$CONDA_ENV
echo
"Linting Python code"
echo
"Linting Python code"
sh
${
BUILD_DIRECTORY
}
/.ci/lint-python.sh
${
BUILD_DIRECTORY
}
||
exit
-1
sh
${
BUILD_DIRECTORY
}
/.ci/lint-python.sh
||
exit
-1
echo
"Linting R code"
echo
"Linting R code"
Rscript
${
BUILD_DIRECTORY
}
/.ci/lint_r_code.R
${
BUILD_DIRECTORY
}
||
exit
-1
Rscript
${
BUILD_DIRECTORY
}
/.ci/lint_r_code.R
${
BUILD_DIRECTORY
}
||
exit
-1
echo
"Linting C++ code"
echo
"Linting C++ code"
...
...
build-python.sh
View file @
1c873af9
...
@@ -189,6 +189,11 @@ create_isolated_source_dir() {
...
@@ -189,6 +189,11 @@ create_isolated_source_dir() {
cp
-R
./python-package ./lightgbm-python
cp
-R
./python-package ./lightgbm-python
# temporarily remove these files until
# https://github.com/microsoft/LightGBM/issues/5061 is done
rm
./lightgbm-python/pyproject.toml
rm
./lightgbm-python/setup.cfg
cp
LICENSE ./lightgbm-python/
cp
LICENSE ./lightgbm-python/
cp
VERSION.txt ./lightgbm-python/lightgbm/VERSION.txt
cp
VERSION.txt ./lightgbm-python/lightgbm/VERSION.txt
...
...
python-package/README.rst
View file @
1c873af9
...
@@ -259,7 +259,7 @@ To check that a contribution to the package matches its style expectations, run
...
@@ -259,7 +259,7 @@ To check that a contribution to the package matches its style expectations, run
.. code:: sh
.. code:: sh
sh .ci/lint-python.sh
.
sh .ci/lint-python.sh
.. |License| image:: https://img.shields.io/github/license/microsoft/lightgbm.svg
.. |License| image:: https://img.shields.io/github/license/microsoft/lightgbm.svg
:target: https://github.com/microsoft/LightGBM/blob/master/LICENSE
:target: https://github.com/microsoft/LightGBM/blob/master/LICENSE
...
...
python-package/pyproject.toml
0 → 100644
View file @
1c873af9
[tool.isort]
line_length
=
120
skip_glob
=
[
"external_libs/*"
,
"lightgbm-python/*"
]
[tool.mypy]
exclude
=
'build/*|compile/*|docs/*|examples/*|external_libs/*|lightgbm-python/*|tests/*'
ignore_missing_imports
=
true
[tool.pydocstyle]
add_ignore
=
[
'D105'
]
convention
=
'numpy'
match
=
'(?!^test_|setup).*\.py'
match_dir
=
'^(?!^external_libs|lightgbm-python|test|example).*'
python-package/setup.cfg
0 → 100644
View file @
1c873af9
[flake8]
ignore =
# line too long
E501,
# line break occurred before a binary operator
W503
exclude =
./.nuget,
./external_libs,
./lightgbm-python,
./python-package/build,
./python-package/compile
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment