Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scikit-build-cpp-python
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Neutrino Physics tutorial
scikit-build-cpp-python
Commits
bd06a59a
Commit
bd06a59a
authored
3 months ago
by
Xuefeng Ding
Browse files
Options
Downloads
Patches
Plain Diff
update by ruff
parent
ad628911
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.pre-commit-config.yaml
+1
-36
1 addition, 36 deletions
.pre-commit-config.yaml
notebooks/example.ipynb
+2
-3
2 additions, 3 deletions
notebooks/example.ipynb
pyproject.toml
+10
-0
10 additions, 0 deletions
pyproject.toml
with
13 additions
and
39 deletions
.pre-commit-config.yaml
+
1
−
36
View file @
bd06a59a
...
...
@@ -30,27 +30,11 @@ repos:
-
id
:
clang-format
types_or
:
[
c++
,
c
,
cuda
]
-
repo
:
https://github.com/psf/black-pre-commit-mirror
rev
:
24.10.0
# Use the latest stable version
hooks
:
-
id
:
black-jupyter
-
repo
:
https://github.com/pycqa/isort
rev
:
5.13.2
hooks
:
-
id
:
isort
name
:
isort (python)
-
repo
:
https://github.com/Lucas-C/pre-commit-hooks
rev
:
"
v1.5.5"
hooks
:
-
id
:
remove-tabs
-
repo
:
https://github.com/charliermarsh/ruff-pre-commit
rev
:
v0.7.4
# Use the latest version
hooks
:
-
id
:
ruff
args
:
[
"
--fix"
,
"
--show-fixes"
]
args
:
[
"
--fix"
,
"
--exit-non-zero-on-fix"
,
"
--show-fixes"
]
-
repo
:
https://github.com/cheshirekow/cmake-format-precommit
rev
:
v0.6.13
...
...
@@ -58,22 +42,3 @@ repos:
-
id
:
cmake-format
types
:
[
file
]
files
:
(\.cmake|CMakeLists.txt)(.in)?$
# - repo: https://github.com/codespell-project/codespell
# rev: v
# hooks:
# - id: codespell
# args: ["-L", "sur,falsy,gaus,hist,lsit,nd,parms,retur,ue,ba,claus,fo"]
# - repo: https://github.com/pre-commit/pygrep-hooks
# rev: v
# hooks:
# - id: rst-backticks
# - id: rst-directive-colons
# - id: rst-inline-touching-normal
# - repo: https://github.com/shellcheck-py/shellcheck-py
# rev: v0.9.0.5
# hooks:
# - id: shellcheck
# stages: [manual]
This diff is collapsed.
Click to expand it.
notebooks/example.ipynb
+
2
−
3
View file @
bd06a59a
...
...
@@ -48,8 +48,7 @@
"import pylint.lint\n",
"from pylint.reporters import JSONReporter\n",
"\n",
"# Adjust PYTHONPATH\n",
"# sys.path.append('/datafs/users/dingxf/neutrino-physics-tutorial/scikit-build-cpp-python')\n",
"root = \"/datafs/users/dingxf/neutrino-physics-tutorial/scikit-build-cpp-python\"\n",
"\n",
"# Define the Pylint options\n",
"pylint_options = [\n",
...
...
@@ -58,7 +57,7 @@
" \"--extension-pkg-allow-list=simulation._csrc._hello\",\n",
" \"--prefer-stubs=true\",\n",
" \"--clear-cache-post-run=y\",\n",
" \"
/datafs/users/dingxf/neutrino-physics-tutorial/scikit-build-cpp-python
/python/myproj/simulation/core.py\", # The file you want to lint\n",
"
f
\"
{root}
/python/myproj/simulation/core.py\", # The file you want to lint\n",
"]\n",
"\n",
"# Create a StringIO buffer to capture Pylint output\n",
...
...
%% Cell type:code id: tags:
```
python
import
myproj.simulation
as
ms
import
numpy
as
np
print
(
ms
.
add
(
1
,
2
))
print
(
ms
.
complex
(
1
,
2
))
print
(
np
.
array
([
1
,
2
,
3
]))
```
%% Cell type:code id: tags:
```
python
import
pylint
pylint
.
run_pylint
([
"
myproj/simulation
"
])
```
%% Cell type:code id: tags:
```
python
from
astroid.interpreter._import
import
util
print
(
util
.
is_namespace
(
"
myproj
"
))
```
%% Cell type:code id: tags:
```
python
import
json
from
io
import
StringIO
import
pylint.lint
from
pylint.reporters
import
JSONReporter
# Adjust PYTHONPATH
# sys.path.append('/datafs/users/dingxf/neutrino-physics-tutorial/scikit-build-cpp-python')
root
=
"
/datafs/users/dingxf/neutrino-physics-tutorial/scikit-build-cpp-python
"
# Define the Pylint options
pylint_options
=
[
"
--reports=n
"
,
"
--output-format=json
"
,
"
--extension-pkg-allow-list=simulation._csrc._hello
"
,
"
--prefer-stubs=true
"
,
"
--clear-cache-post-run=y
"
,
"
/datafs/users/dingxf/neutrino-physics-tutorial/scikit-build-cpp-python
/python/myproj/simulation/core.py
"
,
# The file you want to lint
f
"
{
root
}
/python/myproj/simulation/core.py
"
,
# The file you want to lint
]
# Create a StringIO buffer to capture Pylint output
pylint_output
=
StringIO
()
reporter
=
JSONReporter
(
output
=
pylint_output
)
# Run Pylint
pylint
.
lint
.
Run
(
pylint_options
,
reporter
=
reporter
,
exit
=
True
)
# Get the output
output
=
pylint_output
.
getvalue
()
# Parse and display the results
results
=
json
.
loads
(
output
)
print
(
json
.
dumps
(
results
,
indent
=
2
))
```
...
...
This diff is collapsed.
Click to expand it.
pyproject.toml
+
10
−
0
View file @
bd06a59a
...
...
@@ -67,3 +67,13 @@ disable = [
[tool.pylint.MASTER]
extension-pkg-allow-list
=
"myproj.simulation"
[tool.ruff.lint]
select
=
[
"E"
,
# pycodestyle
"F"
,
# Pyflakes
"UP"
,
# pyupgrade
"B"
,
# flake8-bugbear
"SIM"
,
# flake8-simplify
"I"
,
# isort
]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment