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

Feat/release v09 #253

Merged
merged 29 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8e63e6e
feat: add MsgPrivilegedExecuteContract, MsgInstantiateContract compos…
vinhphuctadang Sep 14, 2023
8698291
(feat) Added Poetry to the proyect and the pyproject.toml configurati…
Sep 19, 2023
144fe3b
(feat) Added GitHub workflow to run pre-commit checks for pushes to m…
Sep 19, 2023
00b2d8e
(fix) Fix issue in pre-commit workflow
Sep 19, 2023
494869e
(fix) Fix error un pre-commit workflow
Sep 19, 2023
9b8421e
(fix) Update release GitHub workflow to use Poetry to publish the SDK…
Sep 19, 2023
870af10
Merge branch 'master' of https://github.com/InjectiveLabs/sdk-python …
Sep 19, 2023
71becbf
(feat) Removed file setup.py (not required now that we use Poetry)
Sep 19, 2023
fa7377d
(feat) Added Isort to the project and configure it to run in pre-commit
Sep 19, 2023
05f3bdf
(feat) Added Black to the project and as part of the pre-commit. Fixe…
Sep 19, 2023
a30481c
(feat) Added GitHub workflow to run tests and calculate coverage
Sep 19, 2023
2d1bb99
(fix) Fix reference to ubuntu OS in the run-test GitHub workflow
Sep 19, 2023
be1b05b
(fix) Consider Python version in the GitHub workflow cache for the en…
Sep 19, 2023
cee1e5d
(feat) Added CodeCov badge to README file
Sep 19, 2023
f5d2e1a
(fix) Fix minimum required coverage
Sep 19, 2023
9c3bff0
(fix) Fix minimum required coverage
Sep 19, 2023
189c498
(fix) Updated README file
Sep 19, 2023
088e3fd
(fix) Changed release workflow to try to solve the error publishing p…
Sep 19, 2023
c17aeb5
(fix) Fix release workflow configuration
Sep 19, 2023
9ceb008
Merge pull request #249 from InjectiveLabs/feat/replace_pipenv_with_p…
aarmoa Sep 19, 2023
bbd7b3d
(fix) Added port to endpoints where the port was missing, to have the…
Sep 20, 2023
7078a76
Merge pull request #250 from InjectiveLabs/fix/sync_network_endpoints…
aarmoa Sep 20, 2023
cd78b5f
(fix) Included missing project infor in Poetry useful when building a…
Sep 20, 2023
2bc29a1
Merge pull request #251 from InjectiveLabs/fix/complete_project_info_…
aarmoa Sep 20, 2023
9a5846e
(fix) Changed broadcaster logic to initialize timeout_height and sequ…
Sep 20, 2023
24eda15
(fix) Changed broadcaster logic to initialize timeout_height and sequ…
Sep 20, 2023
72d9b7f
Merge branch 'fix/broadcaster_sequence_number_initialization' of http…
Sep 20, 2023
0b3b17b
Merge pull request #252 from InjectiveLabs/fix/broadcaster_sequence_n…
aarmoa Sep 20, 2023
9b0945c
(feat) Updated version number to release v0.9.0
Sep 20, 2023
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
32 changes: 32 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: pre-commit
on:
pull_request:
push:
branches: [master, dev]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v4

- name: Install poetry
run: python -m pip install poetry
- name: Cache the virtualenv
id: cache-venv
uses: actions/cache@v3
with:
path: ./.venv
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cache-venv.outputs.cache-hit != 'true'
run: python -m poetry install

- name: Run pre-commit
run: |
python -m poetry run pre-commit run --show-diff-on-failure --color=always --all-files
shell: bash
32 changes: 14 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,22 @@ name: Publish Python 🐍 distribution 📦 to PyPI

on:
release:
types: [created]
types: [published]

jobs:
deploy:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload --skip-existing dist/*
- name: Checkout
uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v3
- name: Install poetry
run: python -m pip install poetry
- name: Publish package
env:
PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish --build
45 changes: 45 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: run-tests
on:
pull_request:
push:
branches: [master, dev]

jobs:
run-tests:
strategy:
matrix:
python: ["3.9", "3.10", "3.11"]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Install poetry
run: python -m pip install poetry
- name: Cache the virtualenv
id: cache-venv
uses: actions/cache@v3
with:
path: ./.venv
key: ${{ runner.os }}-${{ matrix.python }}-venv-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cache-venv.outputs.cache-hit != 'true'
run: python -m poetry install

- name: Run tests and Generate coverage
run: |
poetry run pytest --cov --cov-report=xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
env_vars: OS,PYTHON
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,5 @@ cython_debug/

.chain_cookie
.exchange_cookie

.flakeheaven_cache
28 changes: 28 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
exclude: '^pyinjective/proto/.*'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- repo: https://github.com/flakeheaven/flakeheaven
rev: 3.3.0
hooks:
- id: flakeheaven
name: flakeheaven
description: '`flakeheaven` is a `flake8` wrapper.'
entry: flakeheaven lint
language: python
types_or: [ python, jupyter, markdown, rst, yaml ]
require_serial: true
minimum_pre_commit_version: 2.9.0
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.9.1
hooks:
- id: black
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,4 @@ Copyright © 2021 - 2022 Injective Labs Inc. (https://injectivelabs.org/)
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ copy-proto:
done

tests:
pytest -v
poetry run pytest -v

.PHONY: all gen gen-client copy-proto tests
2 changes: 1 addition & 1 deletion NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ Copyright © 2021 - 2022 Injective Labs Inc. (https://injectivelabs.org/)
Originally released by Injective Labs Inc. under: <br />
Apache License <br />
Version 2.0, January 2004 <br />
http://www.apache.org/licenses/
http://www.apache.org/licenses/
44 changes: 20 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Injective Python SDK

[![codecov](https://codecov.io/gh/InjectiveLabs/sdk-python/graph/badge.svg?token=RBGK98G6F1)](https://codecov.io/gh/InjectiveLabs/sdk-python)

### Dependencies

**Ubuntu**
Expand All @@ -24,20 +26,20 @@ pip install injective-py
```

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

[Examples](https://github.com/InjectiveLabs/sdk-python/tree/master/examples)
```bash
$ pipenv shell
$ pipenv install
$ poetry install

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

# sending a msg with bank transfer
# signs and posts a transaction to the Injective Chain
$ python examples/chain_client/1_MsgSend.py
$ poetry run python examples/chain_client/1_MsgSend.py
```
Upgrade `pip` to the latest version, if you see these warnings:
```
Expand All @@ -49,16 +51,10 @@ Upgrade `pip` to the latest version, if you see these warnings:
1. Generate proto binding & build
```
make gen
python -m build
poetry build
```

2. Enable dev env
```
pipenv shell
pipenv install --dev
```

3. Install pkg
2. Install pkg
```
# from local build
pip uninstall injective-py
Expand All @@ -69,24 +65,25 @@ Upgrade `pip` to the latest version, if you see these warnings:
pip install injective-py
```

4. Fetch latest denom config
3. Fetch latest denom config
```
python pyinjective/fetch_metadata.py
poetry run python pyinjective/fetch_metadata.py
```

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)

5. Install the development environment (requires `pipenv`)
4. Run all unit tests in a development environment
```
pipenv install -d
```

6. Run all unit tests in a development environment
```
make tests
poetry run pytest -v
```

### Changelogs
**0.9.0**
* Improvement in broadcaster to initialize the account sequence number and the timeout height only when required
* Replace Pipenv with Poetry
* Add pre-commit validations to the project
* Add a GitHub workflow to run all tests and calculate coverage for each PR

**0.8.5**
* Added NEOK/USDT and ORAI/USDT spot markets to the mainnet .ini file

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

http://www.apache.org/licenses/
Empty file added codecov.yml
Empty file.
2 changes: 1 addition & 1 deletion compatibility-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ API users must also install the typing_extensions library with the below command

```bash
pip3 install typing_extensions
```
```

The Python 3.7 stdlib has an older version of typing.py so the above change in the code will fix the compatibility issue by importing Literal from typing_extensions
Loading
Loading