Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Pyright #37

Merged
merged 7 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,38 @@
"kevinrose.vsc-python-indent",
"mosapride.zenkaku",
"ms-azuretools.vscode-docker",
"ms-pyright.pyright",
"ms-python.python",
"njpwerner.autodocstring",
"oderwat.indent-rainbow",
"pkief.material-icon-theme",
"shardulm94.trailing-spaces",
"tamasfe.even-better-toml",
"usernamehw.errorlens",
"yzhang.markdown-all-in-one"
],
"settings": {
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"python.defaultInterpreterPath": "/root/.local/share/uv/python",
"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/bin/zsh"
}
},
"[toml]": {
"editor.defaultFormatter": "tamasfe.even-better-toml",
"editor.formatOnSave": true,
"editor.insertSpaces": true
},
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.codeActionsOnSave": {
"source.fixAll.ruff": "explicit",
"source.organizeImports.ruff": "explicit"
},
"editor.formatOnSave": true
},
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/bin/zsh"
}
}
}
}
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/pyright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Pyright

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
type-check:
runs-on: ubuntu-latest

steps:
- uses: jakebailey/pyright-action@v1
21 changes: 14 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@ repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.5
hooks:
- id: ruff
name: Ruff check
description: "Run 'ruff check' for extremely fast Python linting"
args: [ --fix ]
- id: ruff
name: Ruff check
description: "Run 'ruff check' for extremely fast Python linting"
args: [ --fix ]

- id: ruff-format
name: Ruff format
description: "Run 'ruff format' for extremely fast Python formatting"
- id: ruff-format
name: Ruff format
description: "Run 'ruff format' for extremely fast Python formatting"

- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.383
hooks:
- id: pyright
name: Pyright type check
description: "Type Check by Pyright"

- repo: https://github.com/hadolint/hadolint
rev: v2.12.0
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.12.3
3.12.6
2 changes: 2 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
"kevinrose.vsc-python-indent",
"mosapride.zenkaku",
"ms-azuretools.vscode-docker",
"ms-pyright.pyright",
"ms-python.python",
"ms-vscode-remote.remote-containers",
"njpwerner.autodocstring",
"oderwat.indent-rainbow",
"pkief.material-icon-theme",
"shardulm94.trailing-spaces",
"tamasfe.even-better-toml",
"usernamehw.errorlens",
"yzhang.markdown-all-in-one",
]
Expand Down
9 changes: 7 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
{
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"[python]": {
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
},
"editor.formatOnSave": true,
},
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true
"[toml]": {
"editor.defaultFormatter": "tamasfe.even-better-toml",
"editor.formatOnSave": true,
"editor.insertSpaces": true,
}
}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,18 @@ Specifically, you can solve this problem by following the steps below.
- [mosapride.zenkaku](https://marketplace.visualstudio.com/items?itemName=mosapride.zenkaku)
- [ms-azuretools.vscode-docker](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker)
- [ms-python.python](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
- [ms-pyright.pyright](https://marketplace.visualstudio.com/items?itemName=ms-pyright.pyright)
- [njpwerner.autodocstring](https://marketplace.visualstudio.com/items?itemName=njpwerner.autodocstring)
- [oderwat.indent-rainbow](https://marketplace.visualstudio.com/items?itemName=oderwat.indent-rainbow)
- [pkief.material-icon-theme](https://marketplace.visualstudio.com/items?itemName=pkief.material-icon-theme)
- [shardulm94.trailing-spaces](https://marketplace.visualstudio.com/items?itemName=shardulm94.trailing-spaces)
- [tamasfe.even-better-toml](https://marketplace.visualstudio.com/items?itemName=tamasfe.even-better-toml)
- [usernamehw.errorlens](https://marketplace.visualstudio.com/items?itemName=usernamehw.errorlens)
- [yzhang.markdown-all-in-one](https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one)
- `Dockerfile`
- Only Dev dependencies
- `pre-commit`
- `pyright`
- `pytest`
- `ruff`

Expand Down
20 changes: 10 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
name = "default"
version = "0.1.0"
description = "This repository contains configurations to set up a Python development environment using VSCode's Dev Container feature. The environment includes uv and Ruff."
authors = [
{name = "a5chin", email = "a5chin.origin+contact@gmail.com"}
]
maintainers = [
{name = "a5chin", email = "a5chin.origin+contact@gmail.com"}
]

authors = [{ name = "a5chin", email = "a5chin.origin+contact@gmail.com" }]
maintainers = [{ name = "a5chin", email = "a5chin.origin+contact@gmail.com" }]

requires-python = ">=3.9"
readme = "README.md"
license = {file = "LICENSE"}
license = { file = "LICENSE" }

dependencies = []

[tool.uv]
dev-dependencies = [
"pytest>=8.3.2",
"pre-commit>=3.8.0",
"ruff>=0.6.3",
"pre-commit>=4.0.0",
"pyright>=1.1.383",
"pytest>=8.3.3",
"ruff>=0.6.9",
]
16 changes: 16 additions & 0 deletions pyrightconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"pythonVersion": "3.12",
"pythonPlatform": "All",
"venvPath": "./",
"venv": ".venv",

"include": [
],

"exclude": [
"**/__pycache__",
".pytest_cache",
".ruff_cache",
".venv"
],
}
20 changes: 15 additions & 5 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,21 @@ target-version = "py312"
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
select = ["ALL"]
ignore = [
"COM812", "COM819",
"D100", "D203", "D213", "D300",
"E111", "E114", "E117",
"ISC001", "ISC002",
"Q000", "Q001", "Q002", "Q003",
"COM812",
"COM819",
"D100",
"D203",
"D213",
"D300",
"E111",
"E114",
"E117",
"ISC001",
"ISC002",
"Q000",
"Q001",
"Q002",
"Q003",
"W191",
]

Expand Down
Loading
Loading