Skip to content

Commit 8938c3e

Browse files
Bye bye nucleus (#2)
* initial python package * change lib to launch * add dev dep * add linter config files * + pylint * fix nucleus * fix setuptools * fix test * fix isort * black * add pre-commit * add coverage * dont parallel tests * add dummy test * clenup from nucleus * fix requests * fork lib from nucleus * ignore mypy error * rm nucleus name * deploy to launch * update README
1 parent f012b05 commit 8938c3e

25 files changed

+2513
-12
lines changed

.circleci/config.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,46 @@ jobs:
3535
pip install poetry
3636
poetry install
3737
38+
- run:
39+
name: Black Formatting Check # Only validation, without re-formatting
40+
command: |
41+
poetry run black --check -t py36 .
42+
- run:
43+
name: Flake8 Lint Check # Uses setup.cfg for configuration
44+
command: |
45+
poetry run flake8 . --count --statistics
46+
- run:
47+
name: Pylint Lint Check # Uses .pylintrc for configuration
48+
command: |
49+
poetry run pylint launch
50+
- run :
51+
name: MyPy typing check
52+
command: |
53+
poetry run mypy --ignore-missing-imports launch
54+
- run :
55+
name: Isort Import Formatting Check # Only validation, without re-formatting
56+
command: |
57+
poetry run isort --check-only .
58+
- run:
59+
name: Pytest Test Cases
60+
command: |
61+
mkdir test_results
62+
set -e
63+
TEST_FILES=$(circleci tests glob "tests/**/test_*.py")
64+
poetry run coverage run --include=launch/* -m pytest $TEST_FILES
65+
poetry run coverage report
66+
poetry run coverage html
67+
- store_test_results:
68+
path: htmlcov
69+
- store_test_results:
70+
path: test_results
71+
- store_artifacts:
72+
path: test_results
73+
3874
# Invoke jobs via workflows
3975
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
4076
workflows:
41-
sample: # This is the name of the workflow, feel free to change it to better match your workflow.
77+
build_and_test: # This is the name of the workflow, feel free to change it to better match your workflow.
4278
# Inside the workflow, you define the jobs you want to run.
4379
jobs:
4480
- build-and-test

.flake8

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
[flake8]
2+
ignore = E203, E266, E501, W503, F403, F401
3+
max-line-length = 79
4+
max-complexity = 18
5+
select = B,C,E,F,W,T4,B9
6+
exclude =
7+
# All of these excludes should mirror something in .gitignore
8+
.git,
9+
__pychache__,
10+
# Virtual env stuff
11+
./venv,
12+
.env,
13+
.venv,
14+
env/,
15+
venv/,
16+
ENV/,
17+
env.bak/,
18+
venv.bak/,
19+
# Distribution / packaging
20+
.Python,
21+
build/,
22+
develop-eggs/,
23+
dist/,
24+
downloads/,
25+
eggs/,
26+
.eggs/,
27+
lib/,
28+
lib64/,
29+
parts/,
30+
sdist/,
31+
var/,
32+
wheels/,
33+
pip-wheel-metadata/,
34+
share/python-wheels/,
35+
*.egg-info/,
36+
.installed.cfg,
37+
*.egg,
38+
MANIFEST

.isort.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[settings]
2+
profile=black
3+
# Enforced in .flake8
4+
line_length=79

.pre-commit-config.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
fail_fast: true
2+
repos:
3+
- repo: local
4+
hooks:
5+
- id: system
6+
name: Black
7+
entry: poetry run black .
8+
pass_filenames: false
9+
language: system
10+
11+
- repo: local
12+
hooks:
13+
- id: system
14+
name: flake8
15+
entry: poetry run flake8 launch tests
16+
pass_filenames: false
17+
language: system
18+
19+
- repo: local
20+
hooks:
21+
- id: system
22+
name: isort
23+
entry: poetry run isort .
24+
pass_filenames: false
25+
language: system
26+
27+
- repo: local
28+
hooks:
29+
- id: system
30+
name: pylint
31+
entry: poetry run pylint launch
32+
pass_filenames: false
33+
language: system
34+
35+
- repo: local
36+
hooks:
37+
- id: system
38+
name: mypy
39+
entry: poetry run mypy --ignore-missing-imports launch
40+
pass_filenames: false
41+
language: system

.pylintrc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[tool.pylint.MESSAGE_CONTROL]
2+
disable=
3+
bad-continuation,
4+
no-else-return,
5+
too-few-public-methods,
6+
line-too-long,
7+
duplicate-code,
8+
import-error,
9+
unused-argument,
10+
no-self-use,
11+
import-outside-toplevel,
12+
too-many-instance-attributes,
13+
no-member,
14+
W0511,
15+
R0914,
16+
R0913,
17+
C0114,
18+
C0111,
19+
C0103,
20+
R0904
21+
22+
[tool.pylint.REPORTS]
23+
reports=no
24+
25+
[tool.pylint.FORMAT]
26+
max-line-length=79

README.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# launch-python-client
1+
# Launch Python Client
22
```
33
██╗ █████╗ ██╗ ██╗███╗ ██╗ ██████╗██╗ ██╗
44
██║ ██╔══██╗██║ ██║████╗ ██║██╔════╝██║ ██║
@@ -7,3 +7,45 @@
77
███████╗██║ ██║╚██████╔╝██║ ╚████║╚██████╗██║ ██║
88
╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝╚═╝ ╚═╝
99
```
10+
11+
Moving an ML model from experiment to production requires significant engineering lift.
12+
Scale Launch provides ML engineers a simple Python interface for turning a local code snippet into a production service.
13+
A ML engineer needs to call a few functions from Scale's SDK, which quickly spins up a production-ready service.
14+
The service efficiently utilizes compute resources and automatically scales according to traffic.
15+
16+
## Deploying your model via Scale Launch
17+
18+
Central to Scale Launch are the notions of a `ModelBundle` and a `ModelEndpoint`.
19+
A `ModelBundle` consists of a trained model as well as the surrounding preprocessing and postprocessing code.
20+
A `ModelEndpoint` is the compute layer that takes in a `ModelBundle`, and is able to carry out inference requests
21+
by using the `ModelBundle` to carry out predictions. The `ModelEndpoint` also knows infrastructure-level details,
22+
such as how many GPUs are needed, what type they are, how much memory, etc. The `ModelEndpoint` automatically handles
23+
infrastructure level details such as autoscaling and task queueing.
24+
25+
Steps to deploy your model via Scale Launch:
26+
27+
1. First, you create and upload a `ModelBundle`.
28+
29+
2. Then, you create a `ModelEndpoint`.
30+
31+
3. Lastly, you make requests to the `ModelEndpoint`.
32+
33+
TODO: link some example colab notebook
34+
35+
36+
## For Developers
37+
38+
Clone from github and install as editable
39+
40+
```
41+
git clone git@github.com:scaleapi/launch-python-client.git
42+
cd launch-python-client
43+
pip3 install poetry
44+
poetry install
45+
```
46+
47+
Please install the pre-commit hooks by running the following command:
48+
49+
```python
50+
poetry run pre-commit install
51+
```

docs/images/model_bundle.png

40.4 KB
Loading

docs/images/model_endpoint.png

64 KB
Loading

docs/images/request_lifecycle.png

109 KB
Loading

launch/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Scale Launch
2+
3+
Currently, Scale Launch is still being built out, so the contents of this library are subject to change.

0 commit comments

Comments
 (0)