diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ff608e46e..f907ce2ba 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,6 +27,12 @@ repos: - id: flake8 entry: pflake8 additional_dependencies: [pyproject-flake8] + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.4.1 + hooks: + - id: mypy + args: [ --config-file, pyproject.toml ] + pass_filenames: false exclude: | (?x)( ^tests/unit/data/| diff --git a/pyproject.toml b/pyproject.toml index dd16cbe3d..a9f931839 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,6 +58,7 @@ tensorflow = { version = "*", optional = true } torch = { version = "*", optional = true } vega_datasets = { version = "*", optional = true } Faker = { version = "*", optional = true } +mypy = { version = "*", optional = true } # e2e optuna = { version = "*", optional = true } @@ -122,6 +123,7 @@ dev = [ "tensorflow", "torch", "vega_datasets", + "mypy", ] e2e = [ # Integrations @@ -202,3 +204,238 @@ force_grid_wrap = 2 [tool.flake8] max-line-length = 120 extend-ignore = "E203" + +[tool.mypy] +files = 'src/neptune' +mypy_path = "stubs" +install_types = "True" +non_interactive = "True" +disallow_untyped_defs = "True" +disallow_any_unimported = "True" +no_implicit_optional = "True" +check_untyped_defs = "True" +warn_return_any = "True" +show_error_codes = "True" +warn_unused_ignores = "True" + +[[tool.mypy.overrides]] +module = [ + "neptune.api.exceptions_utils", + "neptune.metadata_containers.abstract", + "neptune.types.value_copy", + "neptune.types.namespace", + "neptune.types.file_set", + "neptune.types.mode", + "neptune.types.series.series_value", + "neptune.types.atoms.file", + "neptune.types.atoms.datetime", + "neptune.types.atoms.boolean", + "neptune.types.atoms.float", + "neptune.types.atoms.integer", + "neptune.types.atoms.string", + "neptune.types.atoms.artifact", + "neptune.types.series.float_series", + "neptune.types.series.string_series", + "neptune.types.series.file_series", + "neptune.types.series.series", + "neptune.types.sets.string_set", + "neptune.attributes.atoms.artifact", + "neptune.attributes.atoms.boolean", + "neptune.attributes.atoms.copiable_atom", + "neptune.attributes.atoms.datetime", + "neptune.attributes.atoms.file", + "neptune.attributes.atoms.float", + "neptune.attributes.atoms.integer", + "neptune.attributes.atoms.string", + "neptune.attributes.attribute", + "neptune.attributes.file_set", + "neptune.attributes.namespace", + "neptune.attributes.series.fetchable_series", + "neptune.attributes.series.file_series", + "neptune.attributes.series.float_series", + "neptune.attributes.series.series", + "neptune.attributes.series.string_series", + "neptune.attributes.sets.string_set", + "neptune.attributes.utils", + "neptune.cli.__main__", + "neptune.cli.clear", + "neptune.cli.commands", + "neptune.cli.container_manager", + "neptune.cli.path_option", + "neptune.cli.status", + "neptune.cli.sync", + "neptune.cli.utils", + "neptune.common.backends.utils", + "neptune.common.exceptions", + "neptune.common.git_info", + "neptune.common.hardware.cgroup.cgroup_filesystem_reader", + "neptune.common.hardware.cgroup.cgroup_monitor", + "neptune.common.hardware.gauges.cpu", + "neptune.common.hardware.gauges.gauge", + "neptune.common.hardware.gauges.gauge_factory", + "neptune.common.hardware.gauges.gpu", + "neptune.common.hardware.gauges.memory", + "neptune.common.hardware.gpu.gpu_monitor", + "neptune.common.hardware.metrics.metric", + "neptune.common.hardware.metrics.metrics_container", + "neptune.common.hardware.metrics.metrics_factory", + "neptune.common.hardware.metrics.reports.metric_reporter", + "neptune.common.hardware.metrics.reports.metric_reporter_factory", + "neptune.common.hardware.metrics.service.metric_service", + "neptune.common.hardware.metrics.service.metric_service_factory", + "neptune.common.hardware.resources.gpu_card_indices_provider", + "neptune.common.hardware.resources.system_resource_info", + "neptune.common.hardware.resources.system_resource_info_factory", + "neptune.common.hardware.system.system_monitor", + "neptune.common.oauth", + "neptune.common.patches.bravado", + "neptune.common.storage.datastream", + "neptune.common.storage.storage_utils", + "neptune.common.utils", + "neptune.common.warnings", + "neptune.common.websockets.reconnecting_websocket", + "neptune.common.websockets.websocket_client_adapter", + "neptune.exceptions", + "neptune.handler", + "neptune.integrations.python_logger", + "neptune.integrations.utils", + "neptune.internal.types.stringify_value", + "neptune.internal.types.file_types", + "neptune.internal.artifacts.drivers.local", + "neptune.internal.artifacts.drivers.s3", + "neptune.internal.artifacts.file_hasher", + "neptune.internal.artifacts.local_file_hash_storage", + "neptune.internal.artifacts.types", + "neptune.internal.backends.api_model", + "neptune.internal.backends.hosted_artifact_operations", + "neptune.internal.backends.hosted_client", + "neptune.internal.backends.hosted_file_operations", + "neptune.internal.backends.hosted_neptune_backend", + "neptune.internal.backends.neptune_backend", + "neptune.internal.backends.neptune_backend_mock", + "neptune.internal.backends.offline_neptune_backend", + "neptune.internal.backends.operation_api_name_visitor", + "neptune.internal.backends.operation_api_object_converter", + "neptune.internal.backends.operations_preprocessor", + "neptune.internal.backends.project_name_lookup", + "neptune.internal.backends.swagger_client_wrapper", + "neptune.internal.backends.utils", + "neptune.internal.backgroud_job_list", + "neptune.internal.background_job", + "neptune.internal.container_structure", + "neptune.internal.credentials", + "neptune.internal.disk_queue", + "neptune.internal.hardware.gpu.gpu_monitor", + "neptune.internal.hardware.hardware_metric_reporting_job", + "neptune.internal.id_formats", + "neptune.internal.init.model", + "neptune.internal.init.model_version", + "neptune.internal.init.project", + "neptune.internal.init.run", + "neptune.internal.notebooks.comm", + "neptune.internal.notebooks.notebooks", + "neptune.internal.operation", + "neptune.internal.operation_processors.async_operation_processor", + "neptune.internal.operation_processors.offline_operation_processor", + "neptune.internal.operation_processors.operation_processor", + "neptune.internal.operation_processors.operation_storage", + "neptune.internal.operation_processors.read_only_operation_processor", + "neptune.internal.operation_processors.sync_operation_processor", + "neptune.internal.streams.std_capture_background_job", + "neptune.internal.streams.std_stream_capture_logger", + "neptune.internal.threading.daemon", + "neptune.internal.utils.deprecation", + "neptune.internal.utils.generic_attribute_mapper", + "neptune.internal.utils.git", + "neptune.internal.utils.hashing", + "neptune.internal.utils.images", + "neptune.internal.utils.json_file_splitter", + "neptune.internal.utils.limits", + "neptune.internal.utils.logger", + "neptune.internal.utils.ping_background_job", + "neptune.internal.utils.process_killer", + "neptune.internal.utils.run_state", + "neptune.internal.utils.runningmode", + "neptune.internal.utils.s3", + "neptune.internal.utils.source_code", + "neptune.internal.utils.sync_offset_file", + "neptune.internal.utils.traceback_job", + "neptune.internal.utils.uncaught_exception_handler", + "neptune.internal.websockets.websocket_signals_background_job", + "neptune.internal.websockets.websockets_factory", + "neptune.legacy", + "neptune.legacy.api_exceptions", + "neptune.legacy.backend", + "neptune.legacy.checkpoint", + "neptune.legacy.exceptions", + "neptune.legacy.experiments", + "neptune.legacy.internal.abort", + "neptune.legacy.internal.api_clients.backend_factory", + "neptune.legacy.internal.api_clients.client_config", + "neptune.legacy.internal.api_clients.credentials", + "neptune.legacy.internal.api_clients.hosted_api_clients.hosted_alpha_leaderboard_api_client", + "neptune.legacy.internal.api_clients.hosted_api_clients.hosted_backend_api_client", + "neptune.legacy.internal.api_clients.hosted_api_clients.mixins", + "neptune.legacy.internal.api_clients.hosted_api_clients.utils", + "neptune.legacy.internal.api_clients.offline_backend", + "neptune.legacy.internal.channels.channels", + "neptune.legacy.internal.channels.channels_values_sender", + "neptune.legacy.internal.execution.execution_context", + "neptune.legacy.internal.notebooks.comm", + "neptune.legacy.internal.notebooks.notebooks", + "neptune.legacy.internal.streams.channel_writer", + "neptune.legacy.internal.streams.stdstream_uploader", + "neptune.legacy.internal.threads.aborting_thread", + "neptune.legacy.internal.threads.hardware_metric_reporting_thread", + "neptune.legacy.internal.threads.neptune_thread", + "neptune.legacy.internal.threads.ping_thread", + "neptune.legacy.internal.utils.alpha_integration", + "neptune.legacy.internal.utils.deprecation", + "neptune.legacy.internal.utils.http", + "neptune.legacy.internal.utils.http_utils", + "neptune.legacy.internal.utils.image", + "neptune.legacy.internal.utils.source_code", + "neptune.legacy.internal.websockets.message", + "neptune.legacy.internal.websockets.reconnecting_websocket_factory", + "neptune.legacy.internal.websockets.websocket_message_processor", + "neptune.legacy.model", + "neptune.legacy.notebook", + "neptune.legacy.projects", + "neptune.legacy.sessions", + "neptune.logging.logger", + "neptune.management.exceptions", + "neptune.management.internal.api", + "neptune.management.internal.dto", + "neptune.management.internal.utils", + "neptune.metadata_containers.metadata_container", + "neptune.metadata_containers.metadata_containers_table", + "neptune.metadata_containers.model", + "neptune.metadata_containers.model_version", + "neptune.metadata_containers.project", + "neptune.metadata_containers.run", + "neptune.new._compatibility", + "neptune.types.type_casting", + "neptune.vendor.pynvml", + "neptune.api.requests_utils", + "neptune.version", + "neptune.internal.container_type", + "neptune.new", + "neptune.common.patches", + "neptune.internal.utils", + "neptune.integrations.tensorboard", + "neptune.integrations.pytorch_lightning", + "neptune.integrations.pytorch", + "neptune.integrations.aws", + "neptune.integrations.detectron2", + "neptune.integrations.fastai", + "neptune.integrations.kedro", + "neptune.integrations.lightgbm", + "neptune.integrations.optuna", + "neptune.integrations.prophet", + "neptune.integrations.sacred", + "neptune.integrations.sklearn", + "neptune.integrations.tensorflow_keras", + "neptune.integrations.transformers", + "neptune.integrations.xgboost", +] +ignore_errors = "True"