Skip to content

Commit ca8173a

Browse files
authored
Merge pull request #253 from InjectiveLabs/feat/release_v09
Feat/release v09
2 parents c247dbe + 9b0945c commit ca8173a

File tree

159 files changed

+4861
-2180
lines changed

Some content is hidden

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

159 files changed

+4861
-2180
lines changed

.github/workflows/pre-commit.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: pre-commit
2+
on:
3+
pull_request:
4+
push:
5+
branches: [master, dev]
6+
7+
jobs:
8+
pre-commit:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v3
13+
- name: Install Python
14+
uses: actions/setup-python@v4
15+
16+
- name: Install poetry
17+
run: python -m pip install poetry
18+
- name: Cache the virtualenv
19+
id: cache-venv
20+
uses: actions/cache@v3
21+
with:
22+
path: ./.venv
23+
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
24+
25+
- name: Install dependencies
26+
if: steps.cache-venv.outputs.cache-hit != 'true'
27+
run: python -m poetry install
28+
29+
- name: Run pre-commit
30+
run: |
31+
python -m poetry run pre-commit run --show-diff-on-failure --color=always --all-files
32+
shell: bash

.github/workflows/release.yml

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,22 @@ name: Publish Python 🐍 distribution 📦 to PyPI
22

33
on:
44
release:
5-
types: [created]
5+
types: [published]
66

77
jobs:
88
deploy:
9-
runs-on: ubuntu-20.04
9+
runs-on: ubuntu-latest
1010

1111
steps:
12-
- uses: actions/checkout@master
13-
- name: Set up Python
14-
uses: actions/setup-python@v2
15-
with:
16-
python-version: 3.9
17-
- name: Install dependencies
18-
run: |
19-
python -m pip install --upgrade pip
20-
pip install setuptools wheel twine
21-
- name: Build and publish
22-
env:
23-
TWINE_USERNAME: __token__
24-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
25-
run: |
26-
python setup.py sdist bdist_wheel
27-
twine upload --skip-existing dist/*
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
- name: Install Python
15+
uses: actions/setup-python@v3
16+
- name: Install poetry
17+
run: python -m pip install poetry
18+
- name: Publish package
19+
env:
20+
PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
21+
run: |
22+
poetry config pypi-token.pypi $PYPI_TOKEN
23+
poetry publish --build

.github/workflows/run-tests.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: run-tests
2+
on:
3+
pull_request:
4+
push:
5+
branches: [master, dev]
6+
7+
jobs:
8+
run-tests:
9+
strategy:
10+
matrix:
11+
python: ["3.9", "3.10", "3.11"]
12+
os: [ubuntu-latest, macos-latest, windows-latest]
13+
runs-on: ${{ matrix.os }}
14+
env:
15+
OS: ${{ matrix.os }}
16+
PYTHON: ${{ matrix.python }}
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v3
20+
- name: Install Python
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: ${{ matrix.python }}
24+
25+
- name: Install poetry
26+
run: python -m pip install poetry
27+
- name: Cache the virtualenv
28+
id: cache-venv
29+
uses: actions/cache@v3
30+
with:
31+
path: ./.venv
32+
key: ${{ runner.os }}-${{ matrix.python }}-venv-${{ hashFiles('**/poetry.lock') }}
33+
34+
- name: Install dependencies
35+
if: steps.cache-venv.outputs.cache-hit != 'true'
36+
run: python -m poetry install
37+
38+
- name: Run tests and Generate coverage
39+
run: |
40+
poetry run pytest --cov --cov-report=xml
41+
42+
- name: Upload coverage to Codecov
43+
uses: codecov/codecov-action@v3
44+
with:
45+
env_vars: OS,PYTHON

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,5 @@ cython_debug/
143143

144144
.chain_cookie
145145
.exchange_cookie
146+
147+
.flakeheaven_cache

.pre-commit-config.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
exclude: '^pyinjective/proto/.*'
2+
repos:
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v3.2.0
5+
hooks:
6+
- id: trailing-whitespace
7+
- id: end-of-file-fixer
8+
- id: check-yaml
9+
- repo: https://github.com/flakeheaven/flakeheaven
10+
rev: 3.3.0
11+
hooks:
12+
- id: flakeheaven
13+
name: flakeheaven
14+
description: '`flakeheaven` is a `flake8` wrapper.'
15+
entry: flakeheaven lint
16+
language: python
17+
types_or: [ python, jupyter, markdown, rst, yaml ]
18+
require_serial: true
19+
minimum_pre_commit_version: 2.9.0
20+
- repo: https://github.com/pycqa/isort
21+
rev: 5.12.0
22+
hooks:
23+
- id: isort
24+
name: isort (python)
25+
- repo: https://github.com/psf/black-pre-commit-mirror
26+
rev: 23.9.1
27+
hooks:
28+
- id: black

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,4 +200,4 @@ Copyright © 2021 - 2022 Injective Labs Inc. (https://injectivelabs.org/)
200200
distributed under the License is distributed on an "AS IS" BASIS,
201201
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202202
See the License for the specific language governing permissions and
203-
limitations under the License.
203+
limitations under the License.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ copy-proto:
3535
done
3636

3737
tests:
38-
pytest -v
38+
poetry run pytest -v
3939

4040
.PHONY: all gen gen-client copy-proto tests

NOTICE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ Copyright © 2021 - 2022 Injective Labs Inc. (https://injectivelabs.org/)
55
Originally released by Injective Labs Inc. under: <br />
66
Apache License <br />
77
Version 2.0, January 2004 <br />
8-
http://www.apache.org/licenses/
8+
http://www.apache.org/licenses/

README.md

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## Injective Python SDK
22

3+
[![codecov](https://codecov.io/gh/InjectiveLabs/sdk-python/graph/badge.svg?token=RBGK98G6F1)](https://codecov.io/gh/InjectiveLabs/sdk-python)
4+
35
### Dependencies
46

57
**Ubuntu**
@@ -24,20 +26,20 @@ pip install injective-py
2426
```
2527

2628
### Usage
27-
Requires Python 3.7+
29+
Requires Python 3.9+
30+
Please install `poetry` following the steps described in the [documentation](https://python-poetry.org/docs/#installation)
2831

2932
[Examples](https://github.com/InjectiveLabs/sdk-python/tree/master/examples)
3033
```bash
31-
$ pipenv shell
32-
$ pipenv install
34+
$ poetry install
3335

3436
# connecting to Injective Exchange API
3537
# and listening for new orders from a specific spot market
36-
$ python examples/exchange_client/spot_exchange_rpc/8_StreamOrders.py
38+
$ poetry run python examples/exchange_client/spot_exchange_rpc/8_StreamOrders.py
3739

3840
# sending a msg with bank transfer
3941
# signs and posts a transaction to the Injective Chain
40-
$ python examples/chain_client/1_MsgSend.py
42+
$ poetry run python examples/chain_client/1_MsgSend.py
4143
```
4244
Upgrade `pip` to the latest version, if you see these warnings:
4345
```
@@ -49,16 +51,10 @@ Upgrade `pip` to the latest version, if you see these warnings:
4951
1. Generate proto binding & build
5052
```
5153
make gen
52-
python -m build
54+
poetry build
5355
```
5456

55-
2. Enable dev env
56-
```
57-
pipenv shell
58-
pipenv install --dev
59-
```
60-
61-
3. Install pkg
57+
2. Install pkg
6258
```
6359
# from local build
6460
pip uninstall injective-py
@@ -69,24 +65,25 @@ Upgrade `pip` to the latest version, if you see these warnings:
6965
pip install injective-py
7066
```
7167

72-
4. Fetch latest denom config
68+
3. Fetch latest denom config
7369
```
74-
python pyinjective/fetch_metadata.py
70+
poetry run python pyinjective/fetch_metadata.py
7571
```
7672

7773
Note that the [sync client](https://github.com/InjectiveLabs/sdk-python/blob/master/pyinjective/client.py) has been deprecated as of April 18, 2022. If you are using the sync client please make sure to transition to the [async client](https://github.com/InjectiveLabs/sdk-python/blob/master/pyinjective/async_client.py), for more information read [here](https://github.com/InjectiveLabs/sdk-python/issues/101)
7874

79-
5. Install the development environment (requires `pipenv`)
75+
4. Run all unit tests in a development environment
8076
```
81-
pipenv install -d
82-
```
83-
84-
6. Run all unit tests in a development environment
85-
```
86-
make tests
77+
poetry run pytest -v
8778
```
8879

8980
### Changelogs
81+
**0.9.0**
82+
* Improvement in broadcaster to initialize the account sequence number and the timeout height only when required
83+
* Replace Pipenv with Poetry
84+
* Add pre-commit validations to the project
85+
* Add a GitHub workflow to run all tests and calculate coverage for each PR
86+
9087
**0.8.5**
9188
* Added NEOK/USDT and ORAI/USDT spot markets to the mainnet .ini file
9289

@@ -264,5 +261,4 @@ Copyright © 2021 - 2022 Injective Labs Inc. (https://injectivelabs.org/)
264261
Originally released by Injective Labs Inc. under: <br />
265262
Apache License <br />
266263
Version 2.0, January 2004 <br />
267-
http://www.apache.org/licenses/
268-
264+
http://www.apache.org/licenses/

codecov.yml

Whitespace-only changes.

0 commit comments

Comments
 (0)