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

feat(sage-monorepo): type check Python projects with Pyright CLI and VS Code extension #2840

Merged
1 change: 1 addition & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"mhutchie.git-graph",
"mongodb.mongodb-vscode",
"ms-playwright.playwright",
"ms-pyright.pyright",
"ms-python.black-formatter",
"ms-python.python",
"ms-toolsai.jupyter",
Expand Down
14 changes: 14 additions & 0 deletions apps/sandbox/py-app/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,27 @@
"cwd": "{projectRoot}"
}
},
"update": {
"executor": "nx:run-commands",
"options": {
"command": "poetry update",
"cwd": "{projectRoot}"
}
},
"lint": {
"executor": "@nxlv/python:flake8",
"outputs": ["{workspaceRoot}/reports/{projectRoot}/pylint.txt"],
"options": {
"outputFile": "reports/{projectRoot}/pylint.txt"
}
},
"type-check": {
"executor": "nx:run-commands",
"options": {
"command": "pyright",
"cwd": "{projectRoot}"
}
},
"test": {
"executor": "@nxlv/python:run-commands",
"outputs": [
Expand Down
7 changes: 7 additions & 0 deletions apps/sandbox/py-app/pyrightconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"include": ["sandbox_py_app"],
"exclude": ["tests"],
"venvPath": ".",
"venv": ".venv",
"pythonVersion": "3.10"
}
7 changes: 7 additions & 0 deletions libs/sandbox/py-lib/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@
"outputFile": "reports/{projectRoot}/pylint.txt"
}
},
"type-check": {
"executor": "nx:run-commands",
"options": {
"command": "pyright",
"cwd": "{projectRoot}"
}
},
"test": {
"executor": "@nxlv/python:run-commands",
"outputs": [
Expand Down
7 changes: 7 additions & 0 deletions libs/sandbox/py-lib/pyrightconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"include": ["sandbox_py_lib"],
"exclude": ["tests"],
"venvPath": ".",
"venv": ".venv",
"pythonVersion": "3.10"
}
2 changes: 2 additions & 0 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ module.exports = {
`poetry run black ${filenames.join(' ')}`,
// Lint the projects affected by the staged files
`nx affected --target=lint --files=${filenames.join(',')}`,
// Type check the projects affected by the staged files
`nx affected --target=type-check --files=${filenames.join(',')}`,
],

'**/*[dD]ockerfile*': (filenames) => [
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
"prettier-plugin-java": "2.6.4",
"primeicons": "7.0.0",
"primeng": "17.18.8",
"pyright": "1.1.381",
"serverless": "3.22.0",
"serverless-plugin-typescript": "2.1.4",
"smee-client": "1.2.3",
Expand Down
20 changes: 16 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading