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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove pylint #11183
Remove pylint #11183
Conversation
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
Documentation preview for a6dcdba will be available when this CircleCI job More info
|
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
dev/clint/pyproject.toml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linting all files takes 0.6 ~ 0.7 sec on my machine:
% time clint $(git ls-files '*.py')
clint $(git ls-files '*.py') 4.93s user 0.59s system 815% cpu 0.677 total
% time clint $(git ls-files '*.py')
clint $(git ls-files '*.py') 4.75s user 0.59s system 823% cpu 0.649 total
% time clint $(git ls-files '*.py')
clint $(git ls-files '*.py') 4.70s user 0.58s system 805% cpu 0.655 total
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pylint
% time pylint $(git ls-files '*.py')
--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
pylint $(git ls-files '*.py') 192.85s user 38.47s system 794% cpu 29.106 total
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THIS IS LIFE CHANGING!!
dev/clint/README.md
Outdated
# Integrating with Visual Studio Code | ||
|
||
1. Install [the Pylint extension](https://marketplace.visualstudio.com/items?itemName=ms-python.pylint) | ||
2. Add the following setting in your `settings.json` file: | ||
|
||
```json | ||
{ | ||
"pylint.path": ["${interpreter}", "-m", "clint"] | ||
} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clint behaves like pylint and can be used with the pylint extension.
echo "::add-matcher::.github/workflows/matchers/format.json" | ||
echo "::add-matcher::.github/workflows/matchers/ruff.json" | ||
- uses: ./.github/actions/cache-pip | ||
- name: Install dependencies | ||
run: | | ||
python -m venv .venv | ||
source .venv/bin/activate | ||
source ./dev/install-common-deps.sh --ml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pylint also checks class inheritance, so we needed to install ML packages mlflow depends on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The result looks truly amazing!! Overall looks good to me, just added a few minor commnets.
.pre-commit-config.yaml
Outdated
- id: disallow-rule-ids | ||
name: disallow-rule-ids | ||
entry: python ./dev/disallow_rule_ids.py | ||
- id: clint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we name the step a bit verbosely like "custom-python-lint", so that external contributors can easily tell what this step is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good!
dev/clint/README.md
Outdated
@@ -0,0 +1,22 @@ | |||
# Installation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: a quick description of what this linter is for will be helpful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure!
dev/clint/pyproject.toml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THIS IS LIFE CHANGING!!
def __str__(self): | ||
return f"{self.path}:{self.lineno}:{self.col_offset}: {self.rule.id}: {self.rule.message}" | ||
|
||
def json(self) -> dict[str, str | int | None]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this JSON serialization used for? Perhaps VSCode integration? (just curious about the difference from pylint plugins' implementation)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's used by the pylint extension :) The pylint extension (written in typescript) runs pylint in a subprocess and parse stdout as JSON to collect lint errors.
|
||
def visit_ClassDef(self, node: ast.ClassDef) -> None: | ||
self.stack.append(node) | ||
self._no_rst(node) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is more about future extension, but is it possible to define those rules pluggable like pylint (or perhaps declarative)? Currently when we want to add/remove rules for clint, we need to directly edit the single node traversal class, which might be a bit error-prone. Of course it doesn't need to be in this PR but sth we can think of in long-term.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible to define a visitor for each rule like pylint but it has a con. That's slow because each visitor needs to traverse the code. I'd consider making this pluggable if we had more (> 5) rules.
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> Signed-off-by: Arthur Jenoudet <arthur.jenoudet@databricks.com>
馃洜 DevTools 馃洜
Install mlflow from this PR
Checkout with GitHub CLI
Related Issues/PRs
#xxxWhat changes are proposed in this pull request?
no-rst
andlazy-builtin-import
) have been migrated to a simple linter using theast
module, which is much faster than pylint.Follow-up tasks
How is this PR tested?
Does this PR require documentation update?
Release Notes
Is this a user-facing change?
What component(s), interfaces, languages, and integrations does this PR affect?
Components
area/artifacts
: Artifact stores and artifact loggingarea/build
: Build and test infrastructure for MLflowarea/deployments
: MLflow Deployments client APIs, server, and third-party Deployments integrationsarea/docs
: MLflow documentation pagesarea/examples
: Example codearea/model-registry
: Model Registry service, APIs, and the fluent client calls for Model Registryarea/models
: MLmodel format, model serialization/deserialization, flavorsarea/recipes
: Recipes, Recipe APIs, Recipe configs, Recipe Templatesarea/projects
: MLproject format, project running backendsarea/scoring
: MLflow Model server, model deployment tools, Spark UDFsarea/server-infra
: MLflow Tracking server backendarea/tracking
: Tracking Service, tracking client APIs, autologgingInterface
area/uiux
: Front-end, user experience, plotting, JavaScript, JavaScript dev serverarea/docker
: Docker use across MLflow's components, such as MLflow Projects and MLflow Modelsarea/sqlalchemy
: Use of SQLAlchemy in the Tracking Service or Model Registryarea/windows
: Windows supportLanguage
language/r
: R APIs and clientslanguage/java
: Java APIs and clientslanguage/new
: Proposals for new client languagesIntegrations
integrations/azure
: Azure and Azure ML integrationsintegrations/sagemaker
: SageMaker integrationsintegrations/databricks
: Databricks integrationsHow should the PR be classified in the release notes? Choose one:
rn/none
- No description will be included. The PR will be mentioned only by the PR number in the "Small Bugfixes and Documentation Updates" sectionrn/breaking-change
- The PR will be mentioned in the "Breaking Changes" sectionrn/feature
- A new user-facing feature worth mentioning in the release notesrn/bug-fix
- A user-facing bug fix worth mentioning in the release notesrn/documentation
- A user-facing documentation change worth mentioning in the release notes