Skip to content

Commit 8eb1564

Browse files
author
Ryan
committed
First commit
0 parents  commit 8eb1564

File tree

91 files changed

+302913
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+302913
-0
lines changed

.gitignore

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# poetry
98+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102+
#poetry.lock
103+
104+
# pdm
105+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106+
#pdm.lock
107+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108+
# in version control.
109+
# https://pdm.fming.dev/#use-with-ide
110+
.pdm.toml
111+
112+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113+
__pypackages__/
114+
115+
# Celery stuff
116+
celerybeat-schedule
117+
celerybeat.pid
118+
119+
# SageMath parsed files
120+
*.sage.py
121+
122+
# Environments
123+
.env
124+
.venv
125+
env/
126+
venv/
127+
ENV/
128+
env.bak/
129+
venv.bak/
130+
131+
# Spyder project settings
132+
.spyderproject
133+
.spyproject
134+
135+
# Rope project settings
136+
.ropeproject
137+
138+
# mkdocs documentation
139+
/site
140+
141+
# mypy
142+
.mypy_cache/
143+
.dmypy.json
144+
dmypy.json
145+
146+
# Pyre type checker
147+
.pyre/
148+
149+
# pytype static type analyzer
150+
.pytype/
151+
152+
# Cython debug symbols
153+
cython_debug/
154+
155+
# PyCharm
156+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158+
# and can be added to the global gitignore or merged into this file. For a more nuclear
159+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160+
.idea/
161+
162+
.vscode/*
163+
!.vscode/settings.json
164+
!.vscode/tasks.json
165+
!.vscode/launch.json
166+
!.vscode/extensions.json
167+
!.vscode/*.code-snippets
168+
169+
# Local History for Visual Studio Code
170+
.history/
171+
172+
# Built Visual Studio Code Extensions
173+
*.vsix

.pre-commit-config.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.0.1
4+
hooks:
5+
- id: check-yaml
6+
- id: trailing-whitespace
7+
- id: check-added-large-files
8+
- id: check-json
9+
- id: pretty-format-json
10+
args: [--autofix]
11+
- id: check-toml
12+
- id: check-symlinks
13+
- id: check-xml
14+
- id: check-yaml
15+
- id: detect-private-key
16+
- id: mixed-line-ending
17+
args: [--fix=lf]
18+
- repo: https://github.com/ambv/black
19+
rev: 22.3.0
20+
hooks:
21+
- id: black
22+
- repo: https://github.com/pycqa/flake8
23+
rev: '3.9.2'
24+
hooks:
25+
- id: flake8

README.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# Python_Cloud_Client
2+
A python module which will allow a user to access the onscale cloud functionality via a python interface
3+
4+
## Contents
5+
* [Installation](#install)
6+
* [Dev Setup](#setup)
7+
* [Configuration](#config)
8+
* [Publishing the Python Libraries](#publish)
9+
* [Code Standards](#codestd)
10+
* [Linting and Unit Test](#lint)
11+
* [Doc Generation](#docs)
12+
13+
14+
<a name="install"></a>
15+
## Installation
16+
17+
These instructions are for end user installation. For editable development installs from source, see the [Dev Setup](#setup) section.
18+
19+
Installs can be done through the python package manager `pip`; just include the url for the onscale private PyPI server.
20+
21+
* Install `onscale_client` (Cloud Client) library:
22+
```
23+
pip install --extra-index-url https://pypi.portal.onscale.com onscale_client
24+
```
25+
26+
* To update a library to the latest version (example `onscale_client`):
27+
```
28+
pip install --upgrade --extra-index-url https://pypi.portal.onscale.com onscale_client
29+
```
30+
31+
32+
<a name="setup"></a>
33+
## Dev Setup
34+
35+
To develop in this repository found in `packages/`, a few tools to install:
36+
* Python 3.7+ with `pip`
37+
38+
# Generating REST API Data Model
39+
To update the REST API data model found in `onscale_client/api/datamodel.py`, run:
40+
```
41+
./scripts/generate_api.sh
42+
```
43+
44+
This script will generate the data model based upon the `/scripts/swagger.json` file which can be downloaded from `portal.onscale.com/doc/`.
45+
46+
The cloud client can be installed in "editable" mode for development:
47+
```
48+
pip install -e "packages/cloud_client[dev]"
49+
```
50+
51+
### Python
52+
You're free to install Python however you choose. I wrote a [quick guide here](https://gist.github.com/kykosic/954a59dc8a3544c0cf969b792ce1bc62) on how to setup Python development environments via `conda` if you don't know how to properly do this.
53+
54+
55+
### Python Libraries
56+
Each library can be installed via pip in Python 3.7. For example, to install `onscale_client`:
57+
```
58+
pip install packages/cloud_client
59+
```
60+
To install in inplace for development and include dev dependencies:
61+
```
62+
pip install -e 'packages/cloud_client[dev]'
63+
```
64+
65+
66+
<a name="config"></a>
67+
## Configuration
68+
69+
Once installed, a user profile and developer token will need to be created using OnScale login credentials. This can be done using the configure process within the onscale_client module for the desired portal.
70+
```
71+
import onscale_client as cloud
72+
cloud.configure(portal_target='dev')
73+
```
74+
75+
76+
<a name="publish"></a>
77+
78+
## Publishing the Python Libraries
79+
80+
Please see the `Simulation_API` repository `README.md` file for full details on publishing the python libraries.
81+
82+
83+
<a name="codestd"></a>
84+
## Code Standards
85+
General philosophy for development on this project should be:
86+
* Intuitive user experience
87+
* Concise "Pythonic" syntax
88+
* Consistency with open-source libraries, particularly NumFOCUS
89+
90+
For more information on development best practices and code style in this repository, see [the Style Guide](StyleGuide.md).
91+
92+
#### Syntax RFC
93+
Large additions and changes to the Python syntax should go through an open RFC discussion prior to implementation, see [the Syntax RFC Process](SyntaxRFCProcess.md).
94+
95+
96+
<a name="lint"></a>
97+
### Linting and Unit Tests
98+
Linting can be run via `flake8` using the script:
99+
```
100+
./scripts/lint.sh
101+
```
102+
103+
104+
<a name="docs"></a>
105+
## Doc Generation
106+
Python API documentation is auto-generated from function type annotations and docstrings. The classes and methods which are documented are configured in the `./doc/source` directory. The documents can be generated with `sphinx` with:
107+
```
108+
cd packages/cloud_client/doc/
109+
make html
110+
```
111+
This will output the HTML static documentation to `doc/build/html/index.html`.

__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# flake8: noqa

doc/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

doc/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
if "%1" == "" goto help
14+
15+
%SPHINXBUILD% >NUL 2>NUL
16+
if errorlevel 9009 (
17+
echo.
18+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19+
echo.installed, then set the SPHINXBUILD environment variable to point
20+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
21+
echo.may add the Sphinx directory to PATH.
22+
echo.
23+
echo.If you don't have Sphinx installed, grab it from
24+
echo.http://sphinx-doc.org/
25+
exit /b 1
26+
)
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

0 commit comments

Comments
 (0)