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

darglint becomes pydoclint #3012

Open
wants to merge 32 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
08c2b9f
use pydoclint
strickvl Jul 15, 2024
899371b
add config for pydoclint
strickvl Jul 15, 2024
39333b8
update script definition
strickvl Jul 15, 2024
b777120
pydoclint fixes
strickvl Jul 15, 2024
be54ac9
Merge remote-tracking branch 'origin/develop' into feature/darglint-b…
strickvl Sep 8, 2024
3227cbe
bump to latest pydoclint
strickvl Sep 8, 2024
0cb95f4
docstring fixes
strickvl Sep 8, 2024
31ef6c9
docstring fixes
strickvl Sep 8, 2024
a593534
docstring fixes
strickvl Sep 8, 2024
6d6928e
docstring fixes
strickvl Sep 8, 2024
8695051
docstring fixes
strickvl Sep 8, 2024
e706ef0
docstring fixes
strickvl Sep 8, 2024
90c23e8
docstring fixes
strickvl Sep 8, 2024
59d4480
docstring fixes
strickvl Sep 8, 2024
ea5d72c
docstring fixes
strickvl Sep 8, 2024
08345e8
Merge remote-tracking branch 'origin/develop' into feature/darglint-b…
strickvl Sep 9, 2024
e13a0c5
fix text_utils
strickvl Sep 9, 2024
ca246ac
more fixes
strickvl Sep 9, 2024
c42aeff
Merge remote-tracking branch 'origin/develop' into feature/darglint-b…
strickvl Sep 13, 2024
b3702ba
docstring fixes
strickvl Sep 13, 2024
1fa30da
docstring fixes
strickvl Sep 13, 2024
3707189
docstring fixes
strickvl Sep 13, 2024
c1ba487
docstring fixes
strickvl Sep 13, 2024
7a4a07b
docstring fixes for integrations
strickvl Sep 13, 2024
9b3b254
docstring fixes
strickvl Sep 13, 2024
6ceefab
CI updates
strickvl Sep 13, 2024
80e5724
remove unused script
strickvl Sep 13, 2024
65e605a
docstring fixes
strickvl Sep 13, 2024
9393b3b
docstring fixes
strickvl Sep 13, 2024
28fc016
fix CI for docstring-parser
strickvl Sep 13, 2024
98e406d
show what's up in the CI
strickvl Sep 13, 2024
e5c3ade
add pip args
strickvl Sep 13, 2024
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
2 changes: 0 additions & 2 deletions .darglint

This file was deleted.

17 changes: 0 additions & 17 deletions .github/workflows/ci-fast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,6 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
docstring-check:
if: github.event.pull_request.draft == false
runs-on: arc-runner-set
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.10'
- name: Install darglint using uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.cargo/env
uv pip install --system darglint
- name: Check docstrings
run: bash scripts/docstring.sh
sqlite-db-migration-testing-random:
runs-on: arc-runner-set
env:
Expand Down
17 changes: 0 additions & 17 deletions .github/workflows/ci-slow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,6 @@ jobs:
run: |
echo "Please add the 'run-slow-ci' label to this PR before merging."
exit 1
docstring-check:
if: github.event.pull_request.draft == false
needs: run-slow-ci-label-is-set
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.10'
- name: Install current package as editable
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.cargo/env
uv pip install --system darglint
- name: Check docstrings
run: bash scripts/docstring.sh
mysql-db-migration-testing-full:
if: github.event.pull_request.draft == false
needs: run-slow-ci-label-is-set
Expand Down
12 changes: 10 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ pyment = { version = "^0.3.3", optional = true }
tox = { version = "^3.24.3", optional = true }
hypothesis = { version = "^6.43.1", optional = true }
typing-extensions = { version = ">=3.7.4", optional = true }
darglint = { version = "^1.8.1", optional = true }
pydoclint = { version = "^0.5.7", optional = true }
ruff = { version = ">=0.1.7", optional = true }
yamlfix = { version = "^1.16.0", optional = true }
maison = { version = "<2.0", optional = true }
Expand Down Expand Up @@ -225,7 +225,7 @@ dev = [
"tox",
"hypothesis",
"typing-extensions",
"darglint",
"pydoclint",
"pytest-randomly",
"pytest-mock",
"pytest-clarity",
Expand Down Expand Up @@ -374,6 +374,14 @@ max-complexity = 18
# Use Google-style docstrings.
convention = "google"

[tool.pydoclint]
style = 'google'
arg-type-hints-in-docstring = false
check-return-types = false
check-arg-order = false
allow-init-docstring = true
check-class-attributes = false

[tool.mypy]

plugins = ["pydantic.mypy"]
Expand Down
10 changes: 0 additions & 10 deletions scripts/docstring.sh

This file was deleted.

11 changes: 11 additions & 0 deletions scripts/install-zenml-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ install_integrations() {

uv pip install $PIP_ARGS -r integration-requirements.txt
rm integration-requirements.txt

# TODO: remove after testing this in the CI
# shows what is installing docstring-parser
uv pip install $PIP_ARGS pipdeptree
pipdeptree -r -p docstring-parser
uv pip uninstall $PIP_ARGS pipdeptree -y

# to avoid conflicts with the one installed
# by pydoclint (i.e. docstring-parser-fork)
uv pip uninstall docstring-parser -y

}

set -x
Expand Down
3 changes: 3 additions & 0 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,8 @@ ruff check $SRC --select F401,F841 --exclude "__init__.py" --exclude "*.ipynb" -

ruff format $SRC --check

# pydoclint docstring linter
pydoclint -q $SRC_NO_TESTS

# check type annotations
mypy $SRC_NO_TESTS
1 change: 0 additions & 1 deletion scripts/run-ci-checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ export ZENML_ANALYTICS_OPT_IN=false

scripts/lint.sh
scripts/check-spelling.sh
scripts/docstring.sh
2 changes: 2 additions & 0 deletions src/zenml/analytics/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ def __exit__(
value: The instance of the exception
traceback: The traceback of the exception

Returns:
None
"""
if traceback is not None:
self.metadata.update({"event_success": False})
Expand Down
8 changes: 0 additions & 8 deletions src/zenml/artifact_stores/base_artifact_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,6 @@ class _sanitize_paths:

Extra decoration layer is needed to pass in fixed artifact store root
path for static methods that are called on filesystems directly.

Args:
func: The function to decorate.
fixed_root_path: The fixed artifact store root path.
is_static: Whether the function is static or not.

Returns:
Function that calls the input function with sanitized path inputs.
"""

def __init__(self, func: Callable[..., Any], fixed_root_path: str) -> None:
Expand Down
5 changes: 2 additions & 3 deletions src/zenml/artifacts/external_artifact_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ def get_artifact_version_id(self) -> UUID:

Raises:
RuntimeError: If the artifact store of the referenced artifact
is not the same as the one in the active stack.
RuntimeError: If neither the ID nor the name of the artifact was
provided.
is not the same as the one in the active stack or if neither the
ID nor the name of the artifact was provided.
"""
from zenml.client import Client

Expand Down
2 changes: 1 addition & 1 deletion src/zenml/artifacts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ def _load_file_from_artifact_store(
Raises:
DoesNotExistException: If the file does not exist in the artifact store.
NotImplementedError: If the artifact store cannot open the file.
IOError: If the artifact store rejects the request.
e: If the artifact store rejects the request.
"""
try:
with artifact_store.open(uri, mode) as text_file:
Expand Down
2 changes: 1 addition & 1 deletion src/zenml/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(
name: The name of the group.
tag: The tag of the group.
commands: The commands of the group.
kwargs: Additional keyword arguments.
**kwargs: Additional keyword arguments.
"""
super(TagGroup, self).__init__(name, commands, **kwargs)
self.tag = tag or CliCategories.OTHER_COMMANDS
Expand Down
2 changes: 1 addition & 1 deletion src/zenml/cli/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def iter_rows(
col_count: The number of columns in the table.

Yields:
An iterator over the rows of the table.
Tuple[str, ...]: A row of the table, padded with empty strings if necessary.
"""
for row in rows:
yield row + ("",) * (col_count - len(row))
Expand Down
2 changes: 1 addition & 1 deletion src/zenml/cli/secret.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def list_secrets(**kwargs: Any) -> None:
"""List all secrets that fulfill the filter criteria.

Args:
kwargs: Keyword arguments to filter the secrets.
**kwargs: Keyword arguments to filter the secrets.
"""
client = Client()
with console.status("Listing secrets..."):
Expand Down
6 changes: 3 additions & 3 deletions src/zenml/cli/service_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,11 @@ def describe_service_account(service_account_name_or_id: str) -> None:
@list_options(ServiceAccountFilter)
@click.pass_context
def list_service_accounts(ctx: click.Context, **kwargs: Any) -> None:
"""List all users.
"""List service accounts.

Args:
ctx: The click context object
kwargs: Keyword arguments to filter the list of users.
ctx: The click context.
**kwargs: Keyword arguments to filter the service accounts.
"""
client = Client()
with console.status("Listing service accounts...\n"):
Expand Down
5 changes: 2 additions & 3 deletions src/zenml/cli/service_connectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ def list_service_connectors(
Args:
ctx: The click context object
labels: Labels to filter by.
kwargs: Keyword arguments to filter the components.
**kwargs: Keyword arguments to filter the components.
"""
client = Client()

Expand Down Expand Up @@ -1432,8 +1432,7 @@ def update_service_connector(
auth_method_spec = connector_type_spec.auth_method_dict[auth_method]

# If the authentication method has changed, we need to reconfigure
# the connector from scratch; otherwise, we ask the user if they
# want to update the existing configuration
# the connector or update the existing configuration
if auth_method != connector.auth_method:
confirm = True
else:
Expand Down
20 changes: 12 additions & 8 deletions src/zenml/cli/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from uuid import UUID

import click
from click import Abort, BadParameter
from rich.console import Console
from rich.markdown import Markdown
from rich.prompt import Confirm
Expand Down Expand Up @@ -960,12 +961,15 @@ def rename_stack(
@stack.command("list")
@list_options(StackFilter)
@click.pass_context
def list_stacks(ctx: click.Context, **kwargs: Any) -> None:
def list_stacks(
ctx: click.Context,
**kwargs: Any,
) -> None:
"""List all stacks that fulfill the filter requirements.

Args:
ctx: the Click context
kwargs: Keyword arguments to filter the stacks.
**kwargs: Keyword arguments to filter the stacks.
"""
client = Client()
with console.status("Listing stacks...\n"):
Expand Down Expand Up @@ -1604,12 +1608,12 @@ def validate_name(ctx: click.Context, param: str, value: str) -> str:
return value

if not re.match(r"^[a-zA-Z0-9-]*$", value):
raise click.BadParameter(
raise BadParameter(
"Stack name must contain only alphanumeric characters and hyphens."
)

if len(value) > 16:
raise click.BadParameter(
raise BadParameter(
"Stack name must have a maximum length of 16 characters."
)

Expand Down Expand Up @@ -1754,7 +1758,7 @@ def deploy(
f"automatically redirected to "
f"{deployment_config.deployment_url_text} in your browser.",
):
raise click.Abort()
raise Abort()

date_start = datetime.utcnow()

Expand Down Expand Up @@ -2130,8 +2134,9 @@ def deploy_mlstack(


@stack.command(
"destroy",
help="Destroy stack components created previously with "
"`zenml stack deploy`"
"`zenml stack deploy`",
)
@click.argument("stack_name", required=True)
@click.option(
Expand Down Expand Up @@ -2393,8 +2398,7 @@ def _get_stack_component_info(
The info model of the stack component.

Raises:
ValueError: If the cloud provider is not supported.
ValueError: If the component type is not supported.
ValueError: If the cloud provider or component type is not supported.
"""
from rich.prompt import Prompt

Expand Down
6 changes: 3 additions & 3 deletions src/zenml/cli/stack_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ def list_stack_components_command(
"""Prints a table of stack components.

Args:
ctx: The click context object
kwargs: Keyword arguments to filter the components.
ctx: The click context object.
**kwargs: Keyword arguments to filter the components.
"""
client = Client()
with console.status(f"Listing {component_type.plural}..."):
Expand Down Expand Up @@ -2019,7 +2019,7 @@ def connect_stack_component_with_service_connector(
f"'{component_model.name}' {display_name} in your "
f"workspace. {additional_info}You can create a new "
"connector using the 'zenml service-connector register' "
"command or list the compatible resources using the "
f"command or list the compatible resources using the "
f"'zenml service-connector list-resources{command_args}' "
"command."
)
Expand Down
10 changes: 5 additions & 5 deletions src/zenml/cli/text_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# permissions and limitations under the License.
"""Utilities for CLI output."""

from typing import List
from typing import Generator, List

from rich.console import Console, ConsoleOptions, RenderResult
from rich.markdown import Heading, Markdown
Expand Down Expand Up @@ -91,15 +91,15 @@ class OldSchoolMarkdownHeading(Heading):

def __rich_console__(
self, console: Console, options: ConsoleOptions
) -> RenderResult:
"""Render the heading.
) -> Generator[RenderResult, None, None]:
"""Render the heading to the console.

Args:
console: The console rendering the content.
console: The console to render to.
options: The console options.

Yields:
RenderResult: The rendered content.
RenderResult: The rendered heading.
"""
text = self.text
text.justify = "left"
Expand Down
2 changes: 1 addition & 1 deletion src/zenml/cli/user_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def list_users(ctx: click.Context, **kwargs: Any) -> None:

Args:
ctx: The click context object
kwargs: Keyword arguments to filter the list of users.
**kwargs: Keyword arguments to filter the list of users.
"""
client = Client()
with console.status("Listing stacks...\n"):
Expand Down
7 changes: 4 additions & 3 deletions src/zenml/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import click
import pkg_resources
import yaml
from click import ClickException
from pydantic import BaseModel, SecretStr
from rich import box, table
from rich.console import Console
Expand Down Expand Up @@ -163,7 +164,7 @@ def error(text: str) -> NoReturn:
Raises:
ClickException: when called.
"""
raise click.ClickException(message=click.style(text, fg="red", bold=True))
raise ClickException(message=click.style(text, fg="red", bold=True))


def warning(
Expand Down Expand Up @@ -222,7 +223,7 @@ def print_table(
obj: A List containing dictionaries.
title: Title of the table.
caption: Caption of the table.
columns: Optional column configurations to be used in the table.
**columns: Optional column configurations to be used in the table.
"""
column_keys = {key: None for dict_ in obj for key in dict_}
column_names = [columns.get(key, key.upper()) for key in column_keys]
Expand Down Expand Up @@ -2635,7 +2636,7 @@ def temporary_active_stack(
this contextmanager will not do anything.

Yields:
The active stack.
Stack: The active stack.
"""
from zenml.client import Client

Expand Down
Loading
Loading