Skip to content

Commit dbad09c

Browse files
authored
Merge pull request #14 from Exabyte-io/dev
Python 3 migration, plus top-level-module reorganization
2 parents 6db02eb + 8beb54e commit dbad09c

Some content is hidden

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

45 files changed

+381
-74
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Python package integration tests
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
build:
13+
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
python-version: [3.8]
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v2
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip setuptools wheel
30+
pip install -r requirements-dev.txt --no-deps
31+
32+
- name: Integration tests
33+
run: |
34+
python -m unittest discover --verbose --catch --start-directory tests/integration
35+
env:
36+
TEST_HOST: platform.exabyte.io
37+
TEST_PORT: 443
38+
TEST_ACCOUNT_ID: ${{ secrets.DEMO_ACCOUNT_ID }}
39+
TEST_AUTH_TOKEN: ${{ secrets.DEMO_AUTH_TOKEN }}
40+
TEST_SECURE: true
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Python package unit tests
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: [3.6, 3.7, 3.8, 3.9]
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
16+
- name: Set up Python ${{ matrix.python-version }}
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip setuptools wheel
24+
pip install -r requirements-dev.txt --no-deps
25+
26+
- name: Unit tests
27+
run: |
28+
python -m unittest discover --verbose --catch --start-directory tests/unit
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Upload Python Package
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
deploy:
9+
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v2
17+
with:
18+
python-version: '3.x'
19+
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install setuptools wheel twine
24+
25+
- name: Build and publish
26+
env:
27+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
28+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
29+
run: |
30+
python setup.py sdist bdist_wheel
31+
twine upload dist/*

.gitignore

Lines changed: 135 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,139 @@
1-
.idea
2-
*.pyc
1+
### See: https://raw.githubusercontent.com/github/gitignore/master/Python.gitignore
2+
# Byte-compiled / optimized / DLL files
3+
__pycache__/
4+
*.py[cod]
5+
*$py.class
6+
7+
# C extensions
8+
*.so
9+
10+
# Distribution / packaging
11+
.Python
312
build/
13+
develop-eggs/
414
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
523
wheels/
24+
share/python-wheels/
625
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
cover/
54+
55+
# Translations
56+
*.mo
57+
*.pot
58+
59+
# Django stuff:
60+
*.log
61+
local_settings.py
62+
db.sqlite3
63+
db.sqlite3-journal
64+
65+
# Flask stuff:
66+
instance/
67+
.webassets-cache
68+
69+
# Scrapy stuff:
70+
.scrapy
71+
72+
# Sphinx documentation
73+
docs/_build/
74+
75+
# PyBuilder
76+
.pybuilder/
77+
target/
78+
79+
# Jupyter Notebook
80+
.ipynb_checkpoints
81+
82+
# IPython
83+
profile_default/
84+
ipython_config.py
85+
86+
# pyenv
87+
# For a library or package, you might want to ignore these files since the code is
88+
# intended to run in multiple environments; otherwise, check them in:
89+
# .python-version
90+
91+
# pipenv
92+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
94+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
95+
# install all needed dependencies.
96+
#Pipfile.lock
97+
98+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
99+
__pypackages__/
100+
101+
# Celery stuff
102+
celerybeat-schedule
103+
celerybeat.pid
104+
105+
# SageMath parsed files
106+
*.sage.py
107+
108+
# Environments
109+
.env
110+
.venv
111+
env/
112+
venv/
113+
ENV/
114+
env.bak/
115+
venv.bak/
116+
117+
# Spyder project settings
118+
.spyderproject
119+
.spyproject
120+
121+
# Rope project settings
122+
.ropeproject
123+
124+
# mkdocs documentation
125+
/site
126+
127+
# mypy
128+
.mypy_cache/
129+
.dmypy.json
130+
dmypy.json
131+
132+
# Pyre type checker
133+
.pyre/
134+
135+
# pytype static type analyzer
136+
.pytype/
137+
138+
# Cython debug symbols
139+
cython_debug/

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,20 @@ pip install -e .
2929

3030
[exabyte-api-examples](https://github.com/Exabyte-io/exabyte-api-examples) repository contains examples for performing most-common tasks in the Exabyte.io platform through its RESTful API in Jupyter Notebook format.
3131

32+
# Testing
33+
A Virtualenv environment can be created and the tests run with the included `run-tests.sh` script.
34+
To run the unit tests in Python 3, you can:
35+
```
36+
./run-tests -t=unit
37+
```
38+
39+
To run the integration tests in Python 2, you can:
40+
```
41+
./run-tests -p=python3 -t=integration
42+
```
43+
(assuming you have a `python3` binary in your PATH environment).
44+
45+
Note that the integration tests require a web service against which you can direct the live tests. See `tests/integration/__init__.py` for the environment variable details you need to set up for the integration tests.
46+
47+
3248
© 2018 Exabyte Inc.
File renamed without changes.

endpoints/__init__.py renamed to exabyte_api_client/endpoints/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import json
22

3-
from lib.http_base import Connection
3+
from ..utils.http import Connection
44

55

66
class BaseEndpoint(object):

endpoints/bank_entity.py renamed to exabyte_api_client/endpoints/bank_entity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from endpoints.entity import EntityEndpoint
2-
from endpoints.enums import DEFAULT_API_VERSION, SECURE
1+
from .entity import EntityEndpoint
2+
from .enums import DEFAULT_API_VERSION, SECURE
33

44

55
class BankEntityEndpoints(EntityEndpoint):

endpoints/bank_materials.py renamed to exabyte_api_client/endpoints/bank_materials.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from endpoints.bank_entity import BankEntityEndpoints
2-
from endpoints.enums import DEFAULT_API_VERSION, SECURE
1+
from .bank_entity import BankEntityEndpoints
2+
from .enums import DEFAULT_API_VERSION, SECURE
33

44

55
class BankMaterialEndpoints(BankEntityEndpoints):

endpoints/bank_workflows.py renamed to exabyte_api_client/endpoints/bank_workflows.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from endpoints.bank_entity import BankEntityEndpoints
2-
from endpoints.enums import DEFAULT_API_VERSION, SECURE
1+
from .bank_entity import BankEntityEndpoints
2+
from .enums import DEFAULT_API_VERSION, SECURE
33

44

55
class BankWorkflowEndpoints(BankEntityEndpoints):

0 commit comments

Comments
 (0)