Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
29 changes: 14 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
version: 2
jobs:
build:
shell: /bin/bash --login
environment:
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
docker:
- image: circleci/python:3.7.8
machine: true
steps:
- checkout
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
- run: pip install --upgrade pip
- run: pip install tox
- run: tox
- run:
name: Download OpenAPI file via Curl from github
command: make pull-openapi
- run:
name: Build generated code using docker cli openapigenerator
command: make build-openapi
- run:
name: Build Docker image for running python tests
command: docker build -t plaid-python .
- run:
name: Run python tests in Docker
command: docker run --rm -e CLIENT_ID=$CLIENT_ID -e SECRET=$SECRET plaid-python
- store_test_results:
path: /tmp/circleci-test-results
- store_artifacts:
path: /tmp/circleci-artifacts
- store_artifacts:
path: /tmp/circleci-test-results
path: /tmp/circleci-test-results
17 changes: 17 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
__pycache__
*.pyc
*.pyo
*.pyd
.Python
env
pip-log.txt
pip-delete-this-directory.txt
.tox
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
*.log
.git
4 changes: 0 additions & 4 deletions .env.example

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/add_to_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
if: github.event.action == 'opened'
with:
project: 'https://github.com/orgs/plaid/projects/1'
column_name: 'Needs Investigation'
column_name: 'Needs Investigation'
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ docs/.doctrees
docs/objects.inv

dist

plaid/**
docs
11 changes: 11 additions & 0 deletions .openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
requirements.txt
setup.py
README.md
tox.ini
test-requirements.txt
setup.cfg
git_push.sh
.travis.yml
.gitlab-ci.yml
.gitignore
docs/**
137 changes: 92 additions & 45 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,94 @@
## 8.0.0b4
Fix a regression with `warnings` not being imported, which is required for `Client` initialization in the development environment.

## 8.0.0b3
`request_id` added back to link token.
`bank_transfers` fixes.
`/processor/auth/get` fix nested type return object.
`/link/token/create` fix nested type return object.

## 8.0.0b2
Fix a regression in sending the `User-Agent` header.

## 8.0.0b1
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).

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.

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`.

- Added the `BankTransfer` product.
- This also adds the endpoint `Sandbox.bank_transfer.simulate`.
- Exposed optional parameters for multiple endpoints:
- `Holdings.get`
- `Institutions.get`
- `Institutions.get_by_id`
- `Institutions.search`
- `Item.import_item`
- `PaymentInitiation.list_payments`
- Added new optional parameter `schedule` to `PaymentInitiation.create_payment`
- Added new `Processor` endpoints:
- `auth_get`, `balance_get`, `identity_get`

BREAKING CHANGES:

- Removed the `CreditDetails` and `Income` products.
- Removed ability to specify `api_version`, `timeout`, and `suppress_warnings`.
- The API Version is pinned as of `7.0.0`, so `api_version` shouldn't be here anymore
- `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`.
- Made `products` non-optional for `Institutions.search`.
- Renamed all `Processor` endpoints from `camelCase` to `snake_case`.

Other Deprecations:

- Removed all in-code documentation. Refer to our new [docs](https://plaid.com/docs), which are generated from the same OpenAPI schema!
## 8.0.0b9
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).

**Python Migration Guide:**

### Client initialization
From:
```python
from plaid import Client
Client(
client_id=os.environ['CLIENT_ID'],
secret=os.environ['SECRET'],
environment='sandbox',
api_version="2020-09-14",
client_app="plaid-python-unit-tests"
)
```

To:
```python
import plaid
from plaid.api import plaid_api
configuration = plaid.Configuration(
host=plaid.Environment.Sandbox,
api_key={
'clientId': client_id,
'secret': secret,
'plaidVersion': '2020-09-14'
}
)
api_client = plaid.ApiClient(configuration)
client = plaid_api.PlaidApi(api_client)
```

### Endpoints
All endpoint requests now take a request model and the functions have been renamed to include `_`.

From:
```python
response = client.Auth.get(access_token)
```

To:
```python
import plaid
from plaid.model.auth_get_request import AuthGetRequest
from plaid.model.auth_get_request_options import AuthGetRequestOptions

ag_request = AuthGetRequest(
access_token=access_token
)

response = client.auth_get(ag_request)
```

### Errors

From:
```python
try:
client.Auth.get(access_token)
except ItemError as e:
if e.code == 'ITEM_LOGIN_REQUIRED':
else:
...
except APIError as e:
if e.code == 'PLANNED_MAINTENANCE':
# inform user
else:
...
```

To:
```python
try:
request = AssetReportGetRequest(
asset_report_token=asset_report_token,
)
return client.asset_report_get(request)
except plaid.ApiException as e:
response = json.loads(e.body)
if response['error_code'] == 'ITEM_LOGIN_REQUIRED':
else:
```

## 7.2.0
- The legacy `/item/public_token/create` endpoint is added back. This endpoint should only be used if you
have your public_key enabled and are not yet migrated to link_tokens. It is marked deprecated.
- The legacy `/payment_initiation/payment/token/create` endpoint is added back. This endpoint should
only be used if you have your public_key enabled and are not yet migrated to link_tokens. It is
marked deprecated.

## 7.1.0

Expand Down Expand Up @@ -194,4 +241,4 @@ BREAKING CHANGES:

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

[docs-sandbox-item-fire-webhook]: https://plaid.com/docs/#firing-webhooks
[docs-sandbox-item-fire-webhook]: https://plaid.com/docs/#firing-webhooks
38 changes: 13 additions & 25 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,23 @@
# Contributing

## Setup

1. From the `plaid-python` directory, create the `.env` file, which will be used to configure the Plaid client.

```
cp .env.example .env
```
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).

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.
## Setup

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

```
make setup
```
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.

## Running Tests

Please lint (with `flake8`) and test your pull requests:

```console
$ make lint
$ ./.env make test
```

## Updating Documentation
1. To build the docker image for the client tests, run `docker build -t plaid-python .`.
2. Go to the [Plaid Dashboard](https://dashboard.plaid.com/) and copy and paste your `client_id` and sandbox `secret` into the following command.
3. Run `docker run --rm -e CLIENT_ID=$CLIENT_ID -e SECRET=$SECRET plaid-python`.

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

```console
$ make docs
```
[1]: https://github.com/plaid/plaid-python
[2]: https://plaid.com
[3]: https://github.com/plaid/plaid-openapi
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

FROM python:3.7

# Create app directory
WORKDIR /usr/src/app

# Copy app to directory
COPY . /usr/src/app

# newer versions of tox fail on circleci for some reason
# https://discuss.circleci.com/t/python-tox-doesnt-build-anymore/35059
RUN pip install tox==3.15.0
RUN pip install -r requirements.txt

CMD ["make", "test"]

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 changes: 20 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!make

.PHONY: lint
lint:
flake8 plaid
CURRENT_DIR:=$(shell pwd)
OPENAPI_VERSION:=1.5.4-beta
OPENAPI_FILE:=2020-09-14.yml
PYTHON_PACKAGE_VERSION=$(shell cat setup.py | grep VERSION | head -1 | sed -e "s/^VERSION=//" -e "s/'//" -e "s/'//")
OPENAPI_GENERATOR:=docker run --rm -v $(CURRENT_DIR):/local openapitools/openapi-generator-cli:v5.0.1 generate

# Requires tox to be installed and in the executable path
.PHONY: test
test: lint
./.env tox
test:
CLIENT_ID=$(CLIENT_ID) SECRET=$(SECRET) tox

# Setting up for local development
.PHONY: setup
Expand All @@ -33,3 +34,16 @@ package-check:
.PHONY: package-publish
package-publish:
twine upload dist/*

.PHONY: pull-openapi
pull-openapi:
curl https://raw.githubusercontent.com/plaid/plaid-openapi/$(OPENAPI_VERSION)/$(OPENAPI_FILE) --output $(CURRENT_DIR)/$(OPENAPI_FILE)

.PHONY: build-openapi
build-openapi:
$(OPENAPI_GENERATOR) -g python \
-i local/$(OPENAPI_FILE) \
-o local/ \
-p packageName=plaid,packageVersion='$(PYTHON_PACKAGE_VERSION)' \
--global-property apiTests=false,modelTests=false \
-t local/templates/python
6 changes: 3 additions & 3 deletions PUBLISH.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

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

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

2. **Publish to Pypi**

Expand Down Expand Up @@ -58,4 +58,4 @@ history at:
https://pypi.org/project/plaid-python/#history.
```

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