Skip to content

Commit 9bbc84d

Browse files
cgfarmer4Andrew ChenChase Farmer
authored
Beta for release (plaid#306)
* Revert to non beta (plaid#296) * add back legacy token endpoints * update docs * Revert "Updated wrapper to work correctly in development environment (plaid#292)" This reverts commit b32cd61. * Revert "OpenAPI generated code at 12_04_20_14_11_13 (plaid#291)" This reverts commit d7ec2ee. * Revert "plaid-python 8.0.0-beta2 (plaid#275)" This reverts commit 1ab1c77. * Revert "updates for pypi (plaid#273)" This reverts commit 59a3639. * Revert "8.0.0-beta RC (plaid#272)" This reverts commit 1556f4d. * fix payment init test sort code * fix tests with correct code * transactions dates tests Co-authored-by: Andrew Chen <[email protected]> Co-authored-by: Chase Farmer <[email protected]> * OpenAPI generated code at 02_17_21_16_27_25 * tox version issues * comment * ignore + rm genned * fixes Co-authored-by: Andrew Chen <[email protected]> Co-authored-by: Chase Farmer <[email protected]>
1 parent b32cd61 commit 9bbc84d

File tree

333 files changed

+1555
-68036
lines changed

Some content is hidden

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

333 files changed

+1555
-68036
lines changed

.circleci/config.yml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
version: 2
22
jobs:
33
build:
4-
shell: /bin/bash --login
5-
environment:
6-
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
7-
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
8-
docker:
9-
- image: circleci/python:3.7.8
4+
machine: true
105
steps:
116
- checkout
12-
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
13-
- run: pip install --upgrade pip
14-
- run: pip install tox
15-
- run: tox
7+
- run:
8+
name: Download OpenAPI file via Curl from github
9+
command: make pull-openapi
10+
- run:
11+
name: Build generated code using docker cli openapigenerator
12+
command: make build-openapi
13+
- run:
14+
name: Build Docker image for running python tests
15+
command: docker build -t plaid-python .
16+
- run:
17+
name: Run python tests in Docker
18+
command: docker run --rm -e CLIENT_ID=$CLIENT_ID -e SECRET=$SECRET plaid-python
1619
- store_test_results:
17-
path: /tmp/circleci-test-results
18-
- store_artifacts:
19-
path: /tmp/circleci-artifacts
20-
- store_artifacts:
21-
path: /tmp/circleci-test-results
20+
path: /tmp/circleci-test-results

.dockerignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
__pycache__
2+
*.pyc
3+
*.pyo
4+
*.pyd
5+
.Python
6+
env
7+
pip-log.txt
8+
pip-delete-this-directory.txt
9+
.tox
10+
.coverage
11+
.coverage.*
12+
.cache
13+
nosetests.xml
14+
coverage.xml
15+
*,cover
16+
*.log
17+
.git

.env.example

Lines changed: 0 additions & 4 deletions
This file was deleted.

.github/workflows/add_to_project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ jobs:
1818
if: github.event.action == 'opened'
1919
with:
2020
project: 'https://github.com/orgs/plaid/projects/1'
21-
column_name: 'Needs Investigation'
21+
column_name: 'Needs Investigation'

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ docs/.doctrees
1717
docs/objects.inv
1818

1919
dist
20+
21+
plaid/**
22+
docs

.openapi-generator-ignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
requirements.txt
2+
setup.py
3+
README.md
4+
tox.ini
5+
test-requirements.txt
6+
setup.cfg
7+
git_push.sh
8+
.travis.yml
9+
.gitlab-ci.yml
10+
.gitignore
11+
docs/**

CHANGELOG.md

Lines changed: 92 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,94 @@
1-
## 8.0.0b4
2-
Fix a regression with `warnings` not being imported, which is required for `Client` initialization in the development environment.
3-
4-
## 8.0.0b3
5-
`request_id` added back to link token.
6-
`bank_transfers` fixes.
7-
`/processor/auth/get` fix nested type return object.
8-
`/link/token/create` fix nested type return object.
9-
10-
## 8.0.0b2
11-
Fix a regression in sending the `User-Agent` header.
12-
13-
## 8.0.0b1
14-
This version represents a transition in how we maintain our external client libraries. We are now using an API spec written in `OpenAPI 3.0.0` and are running our definition file through [OpenAPITool's `python` generator](https://github.com/OpenAPITools/openapi-generator).
15-
16-
As part of this transition, we have created a wrapper around existing APIs to ease the burden of migrating to the new API client. The completely unwrapped version will be available next year as we have a few internal changes left to fully support it.
17-
18-
The `OpenAPI` file will be actively maintained and published (coming soon) whenever changes are made to any of our external HTTP API surfaces. This client library is now pinned to Python `3.7.x` with tests running on Python `3.7.8`.
19-
20-
- Added the `BankTransfer` product.
21-
- This also adds the endpoint `Sandbox.bank_transfer.simulate`.
22-
- Exposed optional parameters for multiple endpoints:
23-
- `Holdings.get`
24-
- `Institutions.get`
25-
- `Institutions.get_by_id`
26-
- `Institutions.search`
27-
- `Item.import_item`
28-
- `PaymentInitiation.list_payments`
29-
- Added new optional parameter `schedule` to `PaymentInitiation.create_payment`
30-
- Added new `Processor` endpoints:
31-
- `auth_get`, `balance_get`, `identity_get`
32-
33-
BREAKING CHANGES:
34-
35-
- Removed the `CreditDetails` and `Income` products.
36-
- Removed ability to specify `api_version`, `timeout`, and `suppress_warnings`.
37-
- The API Version is pinned as of `7.0.0`, so `api_version` shouldn't be here anymore
38-
- `timeout` and `suppress_warnings` aren't parameters that are configurable in the output generated code. For things that could be configured once the generated code is unwrapped, check out `generated_plaid.Configuration`.
39-
- Made `products` non-optional for `Institutions.search`.
40-
- Renamed all `Processor` endpoints from `camelCase` to `snake_case`.
41-
42-
Other Deprecations:
43-
44-
- Removed all in-code documentation. Refer to our new [docs](https://plaid.com/docs), which are generated from the same OpenAPI schema!
1+
## 8.0.0b9
2+
This version represents a transition in how we maintain our external client libraries. We are now using an [API spec](https://github.com/plaid/plaid-openapi) written in `OpenAPI 3.0.0` and running our definition file through [OpenAPITool's `python` generator](https://github.com/OpenAPITools/openapi-generator).
3+
4+
**Python Migration Guide:**
5+
6+
### Client initialization
7+
From:
8+
```python
9+
from plaid import Client
10+
Client(
11+
client_id=os.environ['CLIENT_ID'],
12+
secret=os.environ['SECRET'],
13+
environment='sandbox',
14+
api_version="2020-09-14",
15+
client_app="plaid-python-unit-tests"
16+
)
17+
```
18+
19+
To:
20+
```python
21+
import plaid
22+
from plaid.api import plaid_api
23+
configuration = plaid.Configuration(
24+
host=plaid.Environment.Sandbox,
25+
api_key={
26+
'clientId': client_id,
27+
'secret': secret,
28+
'plaidVersion': '2020-09-14'
29+
}
30+
)
31+
api_client = plaid.ApiClient(configuration)
32+
client = plaid_api.PlaidApi(api_client)
33+
```
34+
35+
### Endpoints
36+
All endpoint requests now take a request model and the functions have been renamed to include `_`.
37+
38+
From:
39+
```python
40+
response = client.Auth.get(access_token)
41+
```
42+
43+
To:
44+
```python
45+
import plaid
46+
from plaid.model.auth_get_request import AuthGetRequest
47+
from plaid.model.auth_get_request_options import AuthGetRequestOptions
48+
49+
ag_request = AuthGetRequest(
50+
access_token=access_token
51+
)
52+
53+
response = client.auth_get(ag_request)
54+
```
55+
56+
### Errors
57+
58+
From:
59+
```python
60+
try:
61+
client.Auth.get(access_token)
62+
except ItemError as e:
63+
if e.code == 'ITEM_LOGIN_REQUIRED':
64+
else:
65+
...
66+
except APIError as e:
67+
if e.code == 'PLANNED_MAINTENANCE':
68+
# inform user
69+
else:
70+
...
71+
```
72+
73+
To:
74+
```python
75+
try:
76+
request = AssetReportGetRequest(
77+
asset_report_token=asset_report_token,
78+
)
79+
return client.asset_report_get(request)
80+
except plaid.ApiException as e:
81+
response = json.loads(e.body)
82+
if response['error_code'] == 'ITEM_LOGIN_REQUIRED':
83+
else:
84+
```
85+
86+
## 7.2.0
87+
- The legacy `/item/public_token/create` endpoint is added back. This endpoint should only be used if you
88+
have your public_key enabled and are not yet migrated to link_tokens. It is marked deprecated.
89+
- The legacy `/payment_initiation/payment/token/create` endpoint is added back. This endpoint should
90+
only be used if you have your public_key enabled and are not yet migrated to link_tokens. It is
91+
marked deprecated.
4592

4693
## 7.1.0
4794

@@ -194,4 +241,4 @@ BREAKING CHANGES:
194241

195242
- Add support for [version `2018-05-22`](https://plaid.com/docs/api-upgrades/) of the Plaid API
196243

197-
[docs-sandbox-item-fire-webhook]: https://plaid.com/docs/#firing-webhooks
244+
[docs-sandbox-item-fire-webhook]: https://plaid.com/docs/#firing-webhooks

CONTRIBUTING.md

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,23 @@
11
# Contributing
22

3-
## Setup
4-
5-
1. From the `plaid-python` directory, create the `.env` file, which will be used to configure the Plaid client.
6-
7-
```
8-
cp .env.example .env
9-
```
3+
Instructions for contributing to [plaid-python][1]. A python client library for the [Plaid API][2]. This library is fully generated from the [Plaid OpenAPI spec](3).
104

11-
2. Go to the [Plaid Dashboard](https://dashboard.plaid.com/) and copy and paste your `client_id`, and `secret` into `.env` using a text editor of your choice. Your account must be enabled for sandbox access.
5+
## Setup
126

13-
3. Install the necessary dependencies.
7+
1. Run `make pull-openapi`.
8+
2. Install [Docker](https://docs.docker.com/desktop/) if you do not have it on your machine, this helps to isolate any dependency issues.
9+
3. Run `make build-openapi` after you have finished your Docker setup. This generates all the code necessary to run the library.
1410

15-
```
16-
make setup
17-
```
11+
If you find an issue, please investigate whether it is a type problem with [OpenAPI](3) or a problem with the [python](https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/python.md) generator. Then open an issue and Plaid will investigate further.
1812

1913
## Running Tests
2014

21-
Please lint (with `flake8`) and test your pull requests:
22-
23-
```console
24-
$ make lint
25-
$ ./.env make test
26-
```
27-
28-
## Updating Documentation
15+
1. To build the docker image for the client tests, run `docker build -t plaid-python .`.
16+
2. Go to the [Plaid Dashboard](https://dashboard.plaid.com/) and copy and paste your `client_id` and sandbox `secret` into the following command.
17+
3. Run `docker run --rm -e CLIENT_ID=$CLIENT_ID -e SECRET=$SECRET plaid-python`.
2918

30-
The generated HTML documentation is served directly from the `master` branch
31-
of the repository. To update the generated documentation:
19+
If you wish to run a single test, edit the `tox.ini` file and rebuild the docker image using the command from step 1.
3220

33-
```console
34-
$ make docs
35-
```
21+
[1]: https://github.com/plaid/plaid-python
22+
[2]: https://plaid.com
23+
[3]: https://github.com/plaid/plaid-openapi

Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
FROM python:3.7
3+
4+
# Create app directory
5+
WORKDIR /usr/src/app
6+
7+
# Copy app to directory
8+
COPY . /usr/src/app
9+
10+
# newer versions of tox fail on circleci for some reason
11+
# https://discuss.circleci.com/t/python-tox-doesnt-build-anymore/35059
12+
RUN pip install tox==3.15.0
13+
RUN pip install -r requirements.txt
14+
15+
CMD ["make", "test"]
16+

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
1717
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
1818
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
1919
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Makefile

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
#!make
2-
3-
.PHONY: lint
4-
lint:
5-
flake8 plaid
2+
CURRENT_DIR:=$(shell pwd)
3+
OPENAPI_VERSION:=1.5.4-beta
4+
OPENAPI_FILE:=2020-09-14.yml
5+
PYTHON_PACKAGE_VERSION=$(shell cat setup.py | grep VERSION | head -1 | sed -e "s/^VERSION=//" -e "s/'//" -e "s/'//")
6+
OPENAPI_GENERATOR:=docker run --rm -v $(CURRENT_DIR):/local openapitools/openapi-generator-cli:v5.0.1 generate
67

78
# Requires tox to be installed and in the executable path
89
.PHONY: test
9-
test: lint
10-
./.env tox
10+
test:
11+
CLIENT_ID=$(CLIENT_ID) SECRET=$(SECRET) tox
1112

1213
# Setting up for local development
1314
.PHONY: setup
@@ -33,3 +34,16 @@ package-check:
3334
.PHONY: package-publish
3435
package-publish:
3536
twine upload dist/*
37+
38+
.PHONY: pull-openapi
39+
pull-openapi:
40+
curl https://raw.githubusercontent.com/plaid/plaid-openapi/$(OPENAPI_VERSION)/$(OPENAPI_FILE) --output $(CURRENT_DIR)/$(OPENAPI_FILE)
41+
42+
.PHONY: build-openapi
43+
build-openapi:
44+
$(OPENAPI_GENERATOR) -g python \
45+
-i local/$(OPENAPI_FILE) \
46+
-o local/ \
47+
-p packageName=plaid,packageVersion='$(PYTHON_PACKAGE_VERSION)' \
48+
--global-property apiTests=false,modelTests=false \
49+
-t local/templates/python

PUBLISH.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
Follow these steps sequentially to prepare a new release to Pypi:
88

9-
- Increment the library version in `plaid/version.py` by following [semantic versioning guidelines](https://semver.org/)
9+
- Increment the library version in `plaid/setup.py` by following [semantic versioning guidelines](https://semver.org/)
1010
- Update the `CHANGELOG.md` with the release version and relevant comments and changes
11-
- Build the updated docs with `make docs`
1211
- Commit the change, create a Pull Request, and obtain approval from a Plaid team member
1312
- Merge the commit into `master`, and pull down the latest changes locally from `master`
13+
- Run `make pull-openapi && make build-openapi` to build the generated dependencies
1414

1515
2. **Publish to Pypi**
1616

@@ -58,4 +58,4 @@ history at:
5858
https://pypi.org/project/plaid-python/#history.
5959
```
6060

61-
[1]: https://pypi.org/project/plaid-python/
61+
[1]: https://pypi.org/project/plaid-python/

0 commit comments

Comments
 (0)