Skip to content

Commit

Permalink
Fix typos and run spellcheck in CI (#2074)
Browse files Browse the repository at this point in the history
* Fix typos and run spellcheck in CI

Signed-off-by: Eduardo Apolinario <[email protected]>

* Remove --interactive

Signed-off-by: Eduardo Apolinario <[email protected]>

* Remove CI check since it's run in pre-commit checks (lint make target)

Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>

* Fix typo in accelerators.py

Signed-off-by: Eduardo Apolinario <[email protected]>

---------

Signed-off-by: Eduardo Apolinario <[email protected]>
Co-authored-by: Eduardo Apolinario <[email protected]>
  • Loading branch information
eapolinario and eapolinario authored Jan 18, 2024
1 parent 7996c2e commit aaf69f8
Show file tree
Hide file tree
Showing 31 changed files with 49 additions and 38 deletions.
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ repos:
rev: 0.0.9
hooks:
- id: check_pdb_hook
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
additional_dependencies:
- tomli
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ lint: ## Run linters

.PHONY: spellcheck
spellcheck: ## Runs a spellchecker over all code and documentation
codespell -L "te,raison,fo" --skip="./docs/build,./.git"
# Configuration is in pyproject.toml
codespell

.PHONY: test
test: lint unit_test
Expand Down
2 changes: 1 addition & 1 deletion docs/source/design/control_plane.rst
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ Additional arguments include:
* ``project``: the project on which to execute the entity.
* ``domain``: the domain on which to execute the entity.
* ``type_hints``: a dictionary mapping Python types to their corresponding Flyte types.
* ``options``: options can be configured for a launch plan during registration or overriden during execution. Refer to :py:class:`~flytekit.remote.remote.Options` to know all the acceptable parameters.
* ``options``: options can be configured for a launch plan during registration or overridden during execution. Refer to :py:class:`~flytekit.remote.remote.Options` to know all the acceptable parameters.

The following is an example demonstrating how to use the :py:class:`~flytekit.remote.remote.Options` class to configure a Flyte entity:

Expand Down
2 changes: 1 addition & 1 deletion flytekit/clients/auth/auth_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def __call__(cls, *args, **kwargs):
class AuthorizationClient(metaclass=_SingletonPerEndpoint):
"""
Authorization client that stores the credentials in keyring and uses oauth2 standard flow to retrieve the
credentials. NOTE: This will open an web browser to retreive the credentials.
credentials. NOTE: This will open an web browser to retrieve the credentials.
"""

def __init__(
Expand Down
4 changes: 2 additions & 2 deletions flytekit/clients/auth/authenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def refresh_credentials(self):

class CommandAuthenticator(Authenticator):
"""
This Authenticator retreives access_token using the provided command
This Authenticator retrieves access_token using the provided command
"""

def __init__(self, command: typing.List[str], header_key: str = None):
Expand Down Expand Up @@ -305,7 +305,7 @@ def refresh_credentials(self):
text = f"To Authenticate, navigate in a browser to the following URL: {click.style(resp.verification_uri, fg='blue', underline=True)} and enter code: {click.style(resp.user_code, fg='blue')}"
click.secho(text)
try:
# Currently the refresh token is not retreived. We may want to add support for refreshTokens so that
# Currently the refresh token is not retrieved. We may want to add support for refreshTokens so that
# access tokens can be refreshed for once authenticated machines
token, expires_in = token_client.poll_token_endpoint(
resp,
Expand Down
4 changes: 2 additions & 2 deletions flytekit/clients/auth_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def get_proxy_authenticator(cfg: PlatformConfig) -> Authenticator:

def upgrade_channel_to_proxy_authenticated(cfg: PlatformConfig, in_channel: grpc.Channel) -> grpc.Channel:
"""
If activated in the platform config, given a grpc.Channel, preferrably a secure channel, it returns a composed
If activated in the platform config, given a grpc.Channel, preferably a secure channel, it returns a composed
channel that uses Interceptor to perform authentication with a proxy infront of Flyte
:param cfg: PlatformConfig
:param in_channel: grpc.Channel Precreated channel
Expand All @@ -131,7 +131,7 @@ def upgrade_channel_to_proxy_authenticated(cfg: PlatformConfig, in_channel: grpc

def upgrade_channel_to_authenticated(cfg: PlatformConfig, in_channel: grpc.Channel) -> grpc.Channel:
"""
Given a grpc.Channel, preferrably a secure channel, it returns a composed channel that uses Interceptor to
Given a grpc.Channel, preferably a secure channel, it returns a composed channel that uses Interceptor to
perform an Oauth2.0 Auth flow
:param cfg: PlatformConfig
:param in_channel: grpc.Channel Precreated channel
Expand Down
4 changes: 2 additions & 2 deletions flytekit/clis/flyte_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ def update_launch_plan(state, host, insecure, urn=None):
else:
# If the commandline parameter urn is not supplied, and neither
# the input comes from a pipe, it means the user is not using
# this command approperiately
# this command appropriately
raise _click.UsageError('Missing option "-u" / "--urn" or missing pipe inputs')
except KeyboardInterrupt:
_sys.stdout.flush()
Expand Down Expand Up @@ -1185,7 +1185,7 @@ def terminate_execution(host, insecure, cause, urn=None):
def list_executions(project, domain, host, insecure, token, limit, show_all, filter, sort_by, urns_only):
"""
List the key information of all the executions under the scope specified by {project, domain}.
Users can supply additional filter arguments to show only the desired exeuctions.
Users can supply additional filter arguments to show only the desired executions.
Note that, when the ``--urns-only`` flag is not set, this command prints out the complete tabular
output with key pieces of information such as the URN, the Name and the Status of the executions;
Expand Down
2 changes: 1 addition & 1 deletion flytekit/clis/sdk_in_container/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"--recursive",
"-r",
is_flag=True,
help="Fetch recursively, all variables in the URI. This is not needed for directrories as they"
help="Fetch recursively, all variables in the URI. This is not needed for directories as they"
" are automatically recursively downloaded.",
)
@click.argument("flyte-data-uri", type=str, required=True, metavar="FLYTE-DATA-URI (format flyte://...)")
Expand Down
2 changes: 1 addition & 1 deletion flytekit/configuration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ def with_serialized_context(self) -> SerializationSettings:
"""
Use this method to create a new SerializationSettings that has an environment variable set with the SerializedContext
This is useful in transporting SerializedContext to serialized and registered tasks.
The setting will be availabe in the `env` field with the key `SERIALIZED_CONTEXT_ENV_VAR`
The setting will be available in the `env` field with the key `SERIALIZED_CONTEXT_ENV_VAR`
:return: A newly constructed SerializationSettings, or self, if it already has the serializationSettings
"""
if self._has_serialized_context():
Expand Down
2 changes: 1 addition & 1 deletion flytekit/core/context_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ def get_deck(self) -> typing.Union[str, "IPython.core.display.HTML"]: # type:ig
my_task(...)
ctx.get_deck()
OR if you wish to explicity display
OR if you wish to explicitly display
.. code-block:: python
Expand Down
2 changes: 1 addition & 1 deletion flytekit/core/promise.py
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ def create_and_link_node_from_remote(
:param entity: RemoteEntity
:param _inputs_not_allowed: Set of all variable names that should not be provided when using this entity.
Useful for Launchplans with `fixed` inputs
:param _ignorable_inputs: Set of all variable names that are optional, but if provided will be overriden. Useful
:param _ignorable_inputs: Set of all variable names that are optional, but if provided will be overridden. Useful
for launchplans with `default` inputs
:param kwargs: Dict[str, Any] default inputs passed from the user to this entity. Can be promises.
:return: Optional[Union[Tuple[Promise], Promise, VoidPromise]]
Expand Down
2 changes: 1 addition & 1 deletion flytekit/core/type_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -1848,7 +1848,7 @@ def _check_and_covert_float(lv: Literal) -> float:

def _check_and_convert_void(lv: Literal) -> None:
if lv.scalar.none_type is None:
raise TypeTransformerFailedError(f"Cannot conver literal {lv} to None")
raise TypeTransformerFailedError(f"Cannot convert literal {lv} to None")
return None


Expand Down
2 changes: 1 addition & 1 deletion flytekit/extras/accelerators.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class _A100_Base(MultiInstanceGPUAccelerator):
class _A100(_A100_Base):
"""
Class that represents an `NVIDIA A100 GPU <https://www.nvidia.com/en-us/data-center/a100/>`_. It is possible
to specify a partition of an A100 GPU by using the provided paritions on the class. For example, to specify a
to specify a partition of an A100 GPU by using the provided partitions on the class. For example, to specify a
10GB partition, use ``A100.partition_2g_10gb``.
Refer to `Partitioned GPUs <https://docs.nvidia.com/datacenter/tesla/mig-user-guide/index.html#partitioning>`_
"""
Expand Down
2 changes: 1 addition & 1 deletion flytekit/remote/backfill.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def create_backfill_workflow(
:param start_date: datetime generate a backfill starting at this datetime (exclusive)
:param end_date: datetime generate a backfill ending at this datetime (inclusive)
:param for_lp: typing.Union[LaunchPlan, FlyteLaunchPlan] the backfill is generatd for this launchplan
:param for_lp: typing.Union[LaunchPlan, FlyteLaunchPlan] the backfill is generated for this launchplan
:param parallel: if the backfill should be run in parallel. False (default) will run each bacfill sequentially
:param per_node_timeout: timedelta Timeout to use per node
:param per_node_retries: int Retries to user per node
Expand Down
2 changes: 1 addition & 1 deletion flytekit/remote/lazy_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class LazyEntity(RemoteEntity, typing.Generic[T]):
"""
Fetches the entity when the entity is called or when the entity is retrieved.
The entity is derived from RemoteEntity so that it behaves exactly like the mimiced entity.
The entity is derived from RemoteEntity so that it behaves exactly like the mimicked entity.
"""

def __init__(self, name: str, getter: typing.Callable[[], T], *args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion flytekit/remote/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ def _resolve_identifier_kwargs(
if not (ident.project and ident.domain and ident.name):
raise ValueError(
f"Cannot launch an execution with missing project/domain/name {ident} for entity type {type(entity)}."
f" Specify them in the execute method or when intializing FlyteRemote"
f" Specify them in the execute method or when initializing FlyteRemote"
)
return ident

Expand Down
2 changes: 1 addition & 1 deletion flytekit/tools/fast_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def download_distribution(additional_distribution: str, destination: str):
"""
if not os.path.isdir(destination):
raise ValueError("Destination path is required to download distribution and it should be a directory")
# NOTE the os.path.join(destination, ''). This is to ensure that the given path is infact a directory and all
# NOTE the os.path.join(destination, ''). This is to ensure that the given path is in fact a directory and all
# downloaded data should be copied into this directory. We do this to account for a difference in behavior in
# fsspec, which requires a trailing slash in case of pre-existing directory.
FlyteContextManager.current_context().file_access.get_data(additional_distribution, os.path.join(destination, ""))
Expand Down
2 changes: 1 addition & 1 deletion flytekit/tools/script_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def copy_module_to_destination(

# Takes in a TarInfo and returns the modified TarInfo:
# https://docs.python.org/3/library/tarfile.html#tarinfo-objects
# intented to be passed as a filter to tarfile.add
# intended to be passed as a filter to tarfile.add
# https://docs.python.org/3/library/tarfile.html#tarfile.TarFile.add
def tar_strip_file_attributes(tar_info: tarfile.TarInfo) -> tarfile.TarInfo:
# set time to epoch timestamp 0, aka 00:00:00 UTC on 1 January 1970
Expand Down
2 changes: 1 addition & 1 deletion flytekit/tools/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ def gather_dependent_entities(
The ``get_serializable`` function above takes in an ``OrderedDict`` that helps keep track of dependent entities.
For example, when serializing a workflow, all its tasks are also serialized. The ordered dict will also contain
serialized entities that aren't as useful though, like nodes and branches. This is just a small helper function
that will pull out the serialzed tasks, workflows, and launch plans. This function is primarily used for testing.
that will pull out the serialized tasks, workflows, and launch plans. This function is primarily used for testing.
:param serialized: This should be the filled in OrderedDict used in the get_serializable function above.
:return:
Expand Down
2 changes: 1 addition & 1 deletion flytekit/types/structured/structured_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def __init__(self, python_type: Type[T], protocol: Optional[str] = None, support
is capable of handling.
:param supported_format: Arbitrary string representing the format. If not supplied then an empty string
will be used. An empty string implies that the encoder works with any format. If the format being asked
for does not exist, the transformer enginer will look for the "" endcoder instead and write a warning.
for does not exist, the transformer enginer will look for the "" encoder instead and write a warning.
"""
self._python_type = python_type
self._protocol = protocol.replace("://", "") if protocol else None
Expand Down
8 changes: 4 additions & 4 deletions plugins/flytekit-identity-aware-proxy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ This flytekit plugin allows users to generate ID tokens via an external command
--project < fill in the gcp project id where the secret was saved >
```

A browser window should open, asking you to login with your GCP account. Then, a succesful log in should be confirmed with *"Successfully logged into accounts.google.com"*.
A browser window should open, asking you to login with your GCP account. Then, a successful log in should be confirmed with *"Successfully logged into accounts.google.com"*.

Finally, the token beginning with `eyJhbG..."` should be printed to the console.

Expand Down Expand Up @@ -97,7 +97,7 @@ Flyte is then deployed behind the Istio ingress gateway and does not need to be

### Deployment

1. If not already done, deploy the flyte-core helm chart, [activating auth](https://docs.flyte.org/en/latest/deployment/configuration/auth_setup.html#apply-oidc-configuration). Re-use the web app client id created for IAP (see section above). Disable the default ingress in the helm values by setting `common.ingress.enabled` to `false` in the helm values file.
1. If not already done, deploy the flyte-core helm chart, [activating auth](https://docs.flyte.org/en/latest/deployment/configuration/auth_setup.html#apply-oidc-configuration). Reuse the web app client id created for IAP (see section above). Disable the default ingress in the helm values by setting `common.ingress.enabled` to `false` in the helm values file.


2. Deployment of Istio and the Istio ingress gateway ([docs](https://istio.io/latest/docs/setup/install/helm/))
Expand Down Expand Up @@ -288,7 +288,7 @@ Flyte is then deployed behind the Istio ingress gateway and does not need to be

7. Connect flyteadmin and flyteconsole to the istio ingress gateway:

So far, we created a GCE ingress (which creates a GCP load balancer). The load balancer is configured to forward all requests to the istio ingress gatway at the edge of the service mesh via http2 and TLS.
So far, we created a GCE ingress (which creates a GCP load balancer). The load balancer is configured to forward all requests to the istio ingress gateway at the edge of the service mesh via http2 and TLS.

Next, we configure the Istio service mesh to route requests from the Istio ingress gateway to flyteadmin and flyteconsole.

Expand Down Expand Up @@ -387,7 +387,7 @@ Flyte is then deployed behind the Istio ingress gateway and does not need to be
print(remote.recent_executions())
```

A browser window should open and ask you to login with your Google account. You should then see confirmation that you *"Successfully logged into accounts.google.com"* (this was for the IAP), finally followd by confirmation that you *"Successfully logged into 'your flyte domain'"* (this was for Flyte itself).
A browser window should open and ask you to login with your Google account. You should then see confirmation that you *"Successfully logged into accounts.google.com"* (this was for the IAP), finally followed by confirmation that you *"Successfully logged into 'your flyte domain'"* (this was for Flyte itself).



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def _execute(self, **kwargs) -> Any:
inherits from `FlyteRecoverableException`.
RuntimeError: If the first exception raised in the local worker group is not and does not
inherit from `FlyteRecoverableException`.
IgnoreOutputs: Raised when the task is succesfull in any worker group with index > 0.
IgnoreOutputs: Raised when the task is successful in any worker group with index > 0.
"""
try:
from torch.distributed.launcher.api import LaunchConfig, elastic_launch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PyTorch2ONNXConfig(DataClassJsonMixin):
do_constant_folding: Whether to apply constant folding for optimization.
dynamic_axes: Specify axes of tensors as dynamic.
keep_initializers_as_inputs: Whether to add the initializers as inputs to the graph.
custom_opsets: A dictionary of opset doman name and version.
custom_opsets: A dictionary of opset domain name and version.
export_modules_as_functions: Whether to export modules as functions.
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class PydanticDeserializationLiteralStore:
placeholders that it is trying to deserialize.
"""

literal_store: Optional[serialization.LiteralStore] = None # attachement point for the literal map
literal_store: Optional[serialization.LiteralStore] = None # attachment point for the literal map

def __init__(self) -> None:
raise Exception("This class should not be instantiated")
Expand Down
4 changes: 2 additions & 2 deletions plugins/flytekit-whylogs/flytekitplugins/whylogs/renderer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from flytekit import lazy_module

why = lazy_module("whylogs")
constaints = lazy_module("whylogs.core.constraints")
constraints = lazy_module("whylogs.core.constraints")
pd = lazy_module("pandas")


Expand Down Expand Up @@ -60,7 +60,7 @@ class WhylogsConstraintsRenderer:
"""

@staticmethod
def to_html(constraints: constaints.Constraints) -> str:
def to_html(constraints: constraints.Constraints) -> str:
viz = why.viz.NotebookProfileVisualizer()
report = viz.constraints_report(constraints=constraints)
return report.data
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,7 @@ ignore = [
# unused-import
"F401",
]

[tool.codespell]
ignore-words-list="ot,te,raison,fo,lits"
skip="./docs/build,./.git,*.txt"
2 changes: 1 addition & 1 deletion tests/flytekit/integration/remote/test_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def test_monitor_workflow_execution(register):
execution = remote.sync_execution(execution, sync_nodes=True)

if execution.node_executions:
assert execution.node_executions["start-node"].closure.phase == 3 # SUCCEEEDED
assert execution.node_executions["start-node"].closure.phase == 3 # SUCCEEDED

for key in execution.node_executions:
assert execution.node_executions[key].closure.phase == 3
Expand Down
4 changes: 2 additions & 2 deletions tests/flytekit/unit/core/test_promise.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def wf(i: int, j: int):
# Even if j is not provided it will default
create_and_link_node_from_remote(ctx, lp, _inputs_not_allowed={"i"}, _ignorable_inputs={"j"})

# value of `i` cannot be overriden
# value of `i` cannot be overridden
with pytest.raises(
FlyteAssertion, match="ixed inputs cannot be specified. Please remove the following inputs - {'i'}"
):
Expand Down Expand Up @@ -195,7 +195,7 @@ def my_workflow() -> (str, str, str):
o3 = t2(a=f.a)
return o1, o2, o3

# Run a local execution with promises having atrribute path
# Run a local execution with promises having attribute path
o1, o2, o3 = my_workflow()
assert o1 == "a"
assert o2 == "b"
Expand Down
2 changes: 1 addition & 1 deletion tests/flytekit/unit/core/test_python_function_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def foo(i: str):
assert foo_metadata.cache_serialize is True
assert foo_metadata.cache_version == "1.0"

# test cache, cache_serialize, and cache_version at no unecessarily set
# test cache, cache_serialize, and cache_version at no unnecessarily set
@task()
def bar(i: str):
print(f"{i}")
Expand Down
Loading

0 comments on commit aaf69f8

Please sign in to comment.