Skip to content

Commit

Permalink
Patch up python-v2 (#178)
Browse files Browse the repository at this point in the history
* Patch up python-v2

* trigger build

* fix build

* install poetry

* change python version

* fix test

* add lint, fix up

* forgot to add in actions changes

* fix lock

* add black dependency

* fix lock again

* change black verison
  • Loading branch information
jiajames authored Jun 20, 2024
1 parent 37299eb commit 3330f67
Show file tree
Hide file tree
Showing 6 changed files with 940 additions and 303 deletions.
76 changes: 49 additions & 27 deletions .github/workflows/py-lint-test.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,75 @@
name: "[v4-client-py] Lint, Test"
name: "[v4-client-py-v2] Lint, Test"

on: # yamllint disable-line rule:truthy
pull_request:
paths:
- 'v4-client-py/**'
- 'v4-client-py-v2/**'
push:
paths:
- 'v4-client-py/**'
- 'v4-client-py-v2/**'
branches:
- main
- "release/*"

jobs:
# lint:
# runs-on: ubuntu-latest
# defaults:
# run:
# working-directory: ./v4-client-py
# steps:
# - name: Check out repository code
# uses: actions/checkout@v3

# - name: Set up Python 3.11
# uses: actions/setup-python@v4
# with:
# python-version: 3.11

# - name: Install Dependencies
# run: pip install -r requirements-lint.txt

# - name: Lint
# run: flake8
lint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./v4-client-py-v2
steps:
- name: Check out repository code
uses: actions/checkout@v3

- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: 3.12

- name: Cache poetry dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install poetry
run: pip install poetry

- name: Install Dependencies
run: poetry install

- name: Lint
run: poetry run black --check ./dydx_v4_client ./tests ./examples

test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./v4-client-py
working-directory: ./v4-client-py-v2
steps:
- name: Check out repository code
uses: actions/checkout@v3

- name: Set up Python 3.11
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: 3.11
python-version: 3.12

- name: Cache poetry dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install poetry
run: pip install poetry

- name: Install Dependencies
run: sudo pip install -r requirements-test.txt
run: poetry install

- name: Run pytest
run: pytest
run: poetry run pytest
28 changes: 18 additions & 10 deletions .github/workflows/py-publish.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: "[v4-client-py] Publish to PyPI"
name: "[v4-client-py-v2] Publish to PyPI"

on: # yamllint disable-line rule:truthy
push:
paths:
- 'v4-client-py/**'
- 'v4-client-py-v2/**'
branches:
- main

Expand All @@ -13,21 +13,29 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./v4-client-py
working-directory: ./v4-client-py-v2
steps:
- name: Check out repository code
uses: actions/checkout@v3

- name: Set up Python 3.11
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: 3.11
python-version: 3.12

- name: Install Dependencies
run: pip install -r requirements-publish.txt
- name: Cache poetry dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install Poetry dependencies
run: poetry install --no-root
- name: Install poetry
run: pip install poetry

- name: Install Dependencies
run: poetry install

- name: Build package
run: poetry build
Expand All @@ -37,4 +45,4 @@ jobs:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
twine upload -r pypi dist/*
poetry run twine upload -r pypi dist/*
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
## v4-client-js
The dYdX Chain Client Typescript client is used for placing transactions and querying the dYdX chain.

## v4-client-py
Python client for dYdX Chain. Huge thanks to [kaloureyes3](https://github.com/kaloureyes3/v4-clients) for helping us
maintain this!

The library is currently tested against Python versions 3.9, and 3.11.
## v4-client-py-v2
Python client for dYdX Chain. Developed and maintained by the Nethermind team.
- [Saul M.](https://github.com/samtin0x)
- [Piotr P.](https://github.com/piwonskp)

## v4-client-cpp (Third Party Client)
To pull the latest C++ client, run `git submodule update --init --recursive`
Expand Down
2 changes: 1 addition & 1 deletion v4-client-py-v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div align="center">

### 📘 [Documentation](https://docs.dydx.exchange)
### 📘 [Documentation](https://docs.dydx.exchange)
### 📦 [Other implementations](https://github.com/dydxprotocol/v4-clients)

</div>
Expand Down
Loading

0 comments on commit 3330f67

Please sign in to comment.