Skip to content

Commit

Permalink
Clean up code and update contributor docs (#556)
Browse files Browse the repository at this point in the history
  • Loading branch information
parasj authored Sep 18, 2022
1 parent c20eee5 commit c124adf
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 27 deletions.
29 changes: 19 additions & 10 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,29 @@ Submitting pull requests
Before you submit a pull request, make sure to complete the following steps:


#. Fork the Skyplane repository to create a copy of the project in your own account.
#. Set up a developer environment as described in the `Development Guide <development_guide.md>`_.
#. Create a development branch (\ ``git checkout -b feature_name``\ )
#. Test your changes manually using ``skyplane cp`` and with the unit test suite:
.. code-block:: bash
1. Fork the Skyplane repository to create a copy of the project in your own account.
2. Set up a developer environment as described in the `Development Guide <development_guide.md>`_.
3. Create a development branch (\ ``git checkout -b feature_name``\ )
4. Test your changes manually using ``skyplane cp`` and with the unit test suite:

.. code-block:: console
$ pytest tests/unit_nocloud/
5. Ensure your code is autoformatted and passes type checks:

#. Ensure your code is autoformatted and passes type checks:
.. code-block:: bash
.. code-block:: console
$ pip install black pytype
$ pip install black pytype autoflake
$ black -l 140 .
$ pytype --config .pytype.cfg skyplane
$ autoflake --in-place --remove-all-unused-imports --remove-unused-variables --recursive skyplane
6. If you updated documentation, test the docs:

.. code-block:: console
#. Commit your changes using a `descriptive commit message <https://cbea.ms/git-commit/>`_.
#. Create a pull request on the main Skyplane repo from your fork. Consult `Github Help <https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests>`_ for more details.
$ pip install sphinx-autobuild
$ cd docs
$ pip install -r requirements.txt
$ sphinx-autobuild -b html . /tmp/docs_build
7. Commit your changes using a `descriptive commit message <https://cbea.ms/git-commit/>`_.
8. Create a pull request on the main Skyplane repo from your fork. Consult `Github Help <https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests>`_ for more details.
1 change: 0 additions & 1 deletion skyplane/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
from pathlib import Path
import uuid

from skyplane.config import SkyplaneConfig
from skyplane.gateway_version import gateway_version
Expand Down
3 changes: 1 addition & 2 deletions skyplane/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import skyplane.cli.usage.client
from skyplane import GB
from skyplane.cli.usage.client import UsageClient, UsageStatsStatus
from skyplane.obj_store.s3_interface import S3Interface
from skyplane.replicate.replicator_client import ReplicatorClient

import typer
Expand All @@ -26,7 +25,7 @@
import skyplane.cli.cli_internal as cli_internal
import skyplane.cli.cli_solver
import skyplane.cli.experiments
from skyplane import config_path, exceptions, skyplane_root, cloud_config, tmp_log_dir
from skyplane import cloud_config, config_path, exceptions, skyplane_root
from skyplane.cli.common import print_header, console
from skyplane.cli.cli_impl.cp_replicate import (
enrich_dest_objs,
Expand Down
8 changes: 2 additions & 6 deletions skyplane/cli/cli_impl/cp_replicate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import json
import os
import pathlib
import signal
Expand All @@ -12,7 +11,7 @@
from skyplane import exceptions, GB, format_bytes, gateway_docker_image, skyplane_root, cloud_config
from skyplane.compute.cloud_providers import CloudProvider
from skyplane.obj_store.object_store_interface import ObjectStoreInterface, ObjectStoreObject
from skyplane.obj_store.s3_interface import S3Interface, S3Object
from skyplane.obj_store.s3_interface import S3Object
from skyplane.obj_store.gcs_interface import GCSObject
from skyplane.obj_store.azure_blob_interface import AzureBlobObject
from skyplane.replicate.replication_plan import ReplicationTopology, ReplicationJob
Expand All @@ -21,10 +20,7 @@
from skyplane.utils.timer import Timer
from skyplane.cli.common import console

import skyplane.cli
import skyplane.cli.usage.definitions
import skyplane.cli.usage.client
from skyplane.cli.usage.client import UsageClient, UsageStatsStatus
from skyplane.cli.usage.client import UsageClient


def generate_topology(
Expand Down
1 change: 0 additions & 1 deletion skyplane/compute/azure/azure_cloud_provider.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import json
import os
import re
import uuid
Expand Down
5 changes: 2 additions & 3 deletions skyplane/compute/azure/azure_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from skyplane import key_root
from skyplane.compute.azure.azure_auth import AzureAuthentication
from skyplane.compute.server import Server, ServerState
from skyplane.utils import logger
from skyplane.utils.cache import ignore_lru_cache
from skyplane.utils.fn import PathLike

Expand Down Expand Up @@ -147,8 +146,8 @@ def terminate_instance_impl(self):
compute_client = self.auth.get_compute_client()
network_client = self.auth.get_network_client()

auth_client = self.auth.get_authorization_client()
vm = self.get_virtual_machine()
self.auth.get_authorization_client()
self.get_virtual_machine()

vm_poller = compute_client.virtual_machines.begin_delete(AzureServer.resource_group_name, self.vm_name(self.name))
_ = vm_poller.result()
Expand Down
1 change: 0 additions & 1 deletion skyplane/gateway/gateway_obj_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from skyplane.chunk import ChunkRequest
from skyplane.gateway.chunk_store import ChunkStore
from skyplane.obj_store.object_store_interface import ObjectStoreInterface
from skyplane.obj_store.s3_interface import S3Interface
from skyplane.utils import logger
from skyplane.utils.retry import retry_backoff

Expand Down
2 changes: 0 additions & 2 deletions skyplane/obj_store/azure_blob_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
import hashlib
import os
from functools import lru_cache, partial
from socket import timeout
from typing import Iterator, List, Optional
import uuid

from azure.core.exceptions import ResourceExistsError, ResourceNotFoundError, HttpResponseError

Expand Down
1 change: 0 additions & 1 deletion skyplane/replicate/solver_ron.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import numpy as np
from skyplane import GB

from skyplane.replicate.solver import ThroughputSolver, ThroughputProblem, ThroughputSolution

Expand Down

0 comments on commit c124adf

Please sign in to comment.