Skip to content

Commit

Permalink
fix: update log
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanba committed Sep 2, 2024
1 parent f74ff08 commit 29e8f2d
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 85 deletions.
42 changes: 22 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
![Pyright](https://github.com/microsoft/pyright/blob/main/docs/img/PyrightLarge.png)
# Pylez

# Static Type Checker for Python
Pylez provide open and rich language support for python and notebook based on Pyright.

Pyright is a full-featured, standards-based static type checker for Python. It is designed for high performance and can be used with large Python source bases.
## Feature

Pyright includes both a [command-line tool](https://microsoft.github.io/pyright/#/command-line) and an [extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-pyright.pyright).
- [x] Notebook support
- [ ] Semantic highlight
- [ ] docstrings for built-in/standard library modules
- [ ] refactoring code actions

## Usage

## Pyright Playground
### VSCode extension

Try Pyright in your browser using the [Pyright Playground](https://pyright-play.net/?code=MQAgKgFglgziMEMC2AHANgUxAEw0g9gHYwAuATgiRnBPgO4gDG%2BSBhIGZZ%2BZcjC7AEZZcVRlWzwSlKPzRoAniEFKUCslADmEEgDoAUPtwAzEAmzYAFAA8AXCGNp8lADQgF9x85IBKW-pBAkDIMEgBXMnZrEABqd0NQAAUEGBgoQk0zKTIQdNIBRiwUkBIILBgMZkJJBDJNMKQMQhJg6jC0Ejh0rLIw5qhGjmtClBIoIgNzKwBGNwAiOZ99IA).
You can use Pylez on IDE like VSCode, Code – OSS(and all its fork), Theia, Opensumi etc.

- download from [vscode marketplace](https://marketplace.visualstudio.com/items?itemName=ryannz.pylez)
- download from [openvsx](https://open-vsx.org/extension/ryannz/pylez)

## Documentation
When you have python extension installed, you should add following setting to your `settings.json` file:
```json
{ "python.languageServer": "None"}
```

Refer to [the documentation](https://microsoft.github.io/pyright) for installation, configuration, and usage details.

### npm package

## Community
Do you have questions about Pyright or Python type annotations in general? Post your questions in [the discussion section](https://github.com/microsoft/pyright/discussions).
For other editor users, you can use the npm package to start LSP server.
In [Libro](https://github.com/difizen/libro), we use Pylez npm package with jupyter-lsp to procide LSP service.

If you would like to report a bug or request an enhancement, file a new issue in either the [pyright](https://github.com/microsoft/pyright/issues) or [pylance-release](https://github.com/microsoft/pylance-release/issues) issue tracker. In general, core type checking functionality is associated with Pyright while language service functionality is associated with Pylance, but the same contributors monitor both repos. For best results, provide the information requested in the issue template.


## Contributing

This project welcomes contributions and suggestions. For feature and complex bug fix contributions, it is recommended that you first discuss the proposed change with Pyright’s maintainers before submitting the pull request. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
```sh
npm i @difizen/pylez
```
86 changes: 44 additions & 42 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,46 @@
{
"name": "pyright-root",
"private": true,
"scripts": {
"postinstall": "node ./build/skipBootstrap.js || npm run install:others",
"clean": "lerna run --no-bail --stream clean",
"install:all": "npm install",
"install:others": "cross-env SKIP_LERNA_BOOTSTRAP=yes lerna exec --no-bail npm install",
"update:all": "node ./build/updateDeps.js",
"build:extension:dev": "cd packages/vscode-pylez && npm run webpack",
"build:cli:dev": "cd packages/pylez && npm run webpack",
"watch:extension": "cd packages/vscode-pylez && npm run webpack-dev",
"watch:testserver": "cd packages/pyright-internal && npm run webpack:testserver:watch",
"check": "npm run check:syncpack && npm run check:eslint && npm run check:prettier",
"check:syncpack": "syncpack list-mismatches",
"fix:syncpack": "syncpack fix-mismatches --indent \" \" && npm run install:all",
"check:eslint": "eslint .",
"fix:eslint": "eslint --fix .",
"check:prettier": "prettier -c .",
"fix:prettier": "prettier --write .",
"typecheck": "npx lerna exec --stream --no-bail --ignore=pyright -- tsc --noEmit"
},
"devDependencies": {
"@types/glob": "^7.2.0",
"@types/node": "^17.0.45",
"@types/yargs": "^16.0.9",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"cross-env": "^7.0.3",
"eslint": "^8.56.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"glob": "^7.2.3",
"jsonc-parser": "^3.2.1",
"lerna": "^7.4.2",
"npm-check-updates": "^16.14.14",
"p-queue": "^6.6.2",
"prettier": "2.8.8",
"syncpack": "~10.9.3",
"typescript": "~5.5.4",
"word-wrap": "1.2.5",
"yargs": "^16.2.0"
}
"name": "pyright-root",
"private": true,
"scripts": {
"postinstall": "node ./build/skipBootstrap.js || npm run install:others",
"clean": "lerna run --no-bail --stream clean",
"install:all": "npm install",
"install:others": "cross-env SKIP_LERNA_BOOTSTRAP=yes lerna exec --no-bail npm install",
"update:all": "node ./build/updateDeps.js",
"build:extension:dev": "cd packages/vscode-pylez && npm run webpack",
"build:extension": "cd packages/vscode-pylez && npm run package",
"build:cli:dev": "cd packages/pylez && npm run webpack",
"watch:extension": "cd packages/vscode-pylez && npm run webpack-dev",
"watch:testserver": "cd packages/pyright-internal && npm run webpack:testserver:watch",
"check": "npm run check:syncpack && npm run check:eslint && npm run check:prettier",
"check:syncpack": "syncpack list-mismatches",
"fix:syncpack": "syncpack fix-mismatches --indent \" \" && npm run install:all",
"check:eslint": "eslint .",
"fix:eslint": "eslint --fix .",
"check:prettier": "prettier -c .",
"fix:prettier": "prettier --write .",
"typecheck": "npx lerna exec --stream --no-bail --ignore=pyright -- tsc --noEmit"
},
"devDependencies": {
"@types/glob": "^7.2.0",
"@types/node": "^17.0.45",
"@types/yargs": "^16.0.9",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"cross-env": "^7.0.3",
"eslint": "^8.56.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"glob": "^7.2.3",
"jsonc-parser": "^3.2.1",
"lerna": "^7.4.2",
"npm-check-updates": "^16.14.14",
"p-queue": "^6.6.2",
"prettier": "2.8.8",
"syncpack": "~10.9.3",
"typescript": "~5.5.4",
"word-wrap": "1.2.5",
"yargs": "^16.2.0"
},
"repository": "[email protected]:difizen/pylez.git"
}
23 changes: 23 additions & 0 deletions packages/pylez/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Pylez

Pylez provide open and rich language support for python and notebook based on Pyright.

## Feature

- [x] Notebook support
- [ ] Semantic highlight
- [ ] docstrings for built-in/standard library modules
- [ ] refactoring code actions

## Usage

### npm package

```sh
npm i @difizen/pylez
```

### VSCode extension

- download from [vscode marketplace](https://marketplace.visualstudio.com/items?itemName=ryannz.pylez)
- download from [openvsx](https://open-vsx.org/extension/ryannz/pylez)
2 changes: 1 addition & 1 deletion packages/pylez/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"scripts": {
"build": "webpack --mode production --progress",
"clean": "shx rm -rf ./dist ./out README.md LICENSE.txt ./node_modules",
"clean": "shx rm -rf ./dist ./out README.md LICENSE.txt",
"prepack": "npm run clean && shx cp ../../README.md . && shx cp ../../LICENSE.txt . && npm run build",
"webpack": "webpack --mode development --progress"
},
Expand Down
8 changes: 7 additions & 1 deletion packages/pylez/src/pylez.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ export class Pylez extends LanguageServerBase {
supportedCommands: string[],
supportedCodeActions: string[]
): Promise<InitializeResult> {
this.console.log('[pylez] initialize');
const result = await super.initialize(params, supportedCommands, supportedCodeActions);
result.capabilities.notebookDocumentSync = {
notebookSelector: [
Expand All @@ -374,6 +375,7 @@ export class Pylez extends LanguageServerBase {

protected async onDidOpenNotebookDocument(params: DidOpenNotebookDocumentParams) {
const uri = this.convertLspUriStringToUri(params.notebookDocument.uri);
this.console.log(`[pylez] onDidOpenNotebookDocument: ${uri.toString()}`);
let doc = this.notebookDocuments.get(uri.key);
if (doc) {
// We shouldn't get an open notebook document request for an already-opened doc.
Expand All @@ -397,6 +399,7 @@ export class Pylez extends LanguageServerBase {
protected async onDidChangeNotebookDocument(params: DidChangeNotebookDocumentParams) {
this.recordUserInteractionTime();
const uri = this.convertLspUriStringToUri(params.notebookDocument.uri);
this.console.log(`[pylez] onDidChangeNotebookDocument: ${uri.toString()}`);
const notebookDocument = this.notebookDocuments.get(uri.key);
if (notebookDocument === undefined) {
// We shouldn't get a change notebook request for a closed doc.
Expand Down Expand Up @@ -464,9 +467,12 @@ export class Pylez extends LanguageServerBase {
}
}
}

protected onDidSaveNotebookDocument(params: DidSaveNotebookDocumentParams) {}

protected onDidCloseNotebookDocument(params: DidCloseNotebookDocumentParams) {
const uri = this.convertLspUriStringToUri(params.notebookDocument.uri);
this.console.log(`[pylez] onDidCloseNotebookDocument: ${uri.toString()}`);
const notebookDocument = this.notebookDocuments.get(uri.key);
if (notebookDocument === undefined) {
return;
Expand All @@ -483,7 +489,7 @@ export class Pylez extends LanguageServerBase {
chainedFileUri?: Uri
): Promise<void> {
const uri = this.convertLspUriStringToUri(params.textDocument.uri);

this.console.log(`[pylez] onDidOpenTextDocument: ${uri.toString()}`);
let doc = this.openFileMap.get(uri.key);
if (doc) {
// We shouldn't get an open text document request for an already-opened doc.
Expand Down
19 changes: 0 additions & 19 deletions packages/vscode-pylez/README.md

This file was deleted.

4 changes: 2 additions & 2 deletions packages/vscode-pylez/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-pylez",
"displayName": "Pylez",
"description": "VS Code static type checking for Python",
"version": "1.0.2",
"version": "1.0.3",
"private": true,
"license": "MIT",
"author": {
Expand Down Expand Up @@ -1569,7 +1569,7 @@
},
"scripts": {
"clean": "shx rm -rf ./dist ./out",
"prepackage": "node ./build/renamePackage.js pylez",
"prepackage": "node ./build/renamePackage.js pylez && shx cp ../../README.md . && shx cp ../../LICENSE.txt .",
"package": "vsce package",
"postpackage": "node ./build/renamePackage.js vscode-pylez",
"vscode:prepublish": "node ./build/checkPackage.js && npm run clean && webpack --mode production --progress",
Expand Down

0 comments on commit 29e8f2d

Please sign in to comment.