Skip to content

Commit

Permalink
Merge branch 'release/20210424'
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreMiras committed Apr 24, 2021
2 parents ffb593c + b681fba commit eb23186
Show file tree
Hide file tree
Showing 13 changed files with 680 additions and 27 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/push.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: PyPI release

on: [push]

jobs:
pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Install dependencies
run: python -m pip install --upgrade setuptools wheel twine
- name: Build
run: |
python setup.py sdist bdist_wheel
twine check dist/*
- name: Publish package
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@v1.4.1
with:
verbose: true
user: __token__
password: ${{ secrets.pypi_password }}
34 changes: 34 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Tests

on: [push]

jobs:
test:

runs-on: ubuntu-latest
strategy:
matrix:
python: [3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- run: pip install tox
- run: tox -e py

- name: Coveralls
uses: AndreMiras/coveralls-python-action@v20201129
with:
parallel: true
flag-name: Unit Test

coveralls_finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: AndreMiras/coveralls-python-action@v20201129
with:
parallel-finished: true
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Change Log


## [20210424]
- Python 3.9 support
- Setup coverage testing, refs #2
- Auto publish to PyPI on release, refs #3


## [20201026]
- Handle TheGraph `TransportQueryError`
- Fix crash on total supply zero
Expand All @@ -14,11 +20,9 @@


## [20201023]

- Setup CI, refs #1
- Ship missing `abi.json`, refs #4


## [20201022]

- Initial release
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ PYTEST=$(VIRTUAL_ENV)/bin/pytest
TOX=$(VIRTUAL_ENV)/bin/tox
TWINE=$(VIRTUAL_ENV)/bin/twine
PYTHON_MAJOR_VERSION=3
PYTHON_MINOR_VERSION=8
PYTHON_MINOR_VERSION=9
PYTHON_VERSION=$(PYTHON_MAJOR_VERSION).$(PYTHON_MINOR_VERSION)
PYTHON_MAJOR_MINOR=$(PYTHON_MAJOR_VERSION)$(PYTHON_MINOR_VERSION)
PYTHON_WITH_VERSION=python$(PYTHON_VERSION)
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Pools

[![Tests](https://github.com/AndreMiras/libpools/workflows/Tests/badge.svg?branch=develop)](https://github.com/AndreMiras/libpools/actions?query=workflow%3ATests)
[![Coverage Status](https://coveralls.io/repos/github/AndreMiras/libpools/badge.svg?branch=develop)](https://coveralls.io/github/AndreMiras/libpools?branch=develop)
[![PyPI version](https://badge.fury.io/py/pools.svg)](https://badge.fury.io/py/pools)

Python library for pools liquidity providers.
Python library for Ethereum pools liquidity providers.

## Install
```sh
Expand Down
3 changes: 3 additions & 0 deletions docs/Release.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ make release/upload
Got to GitHub [Release/Tags](https://github.com/AndreMiras/libpools/tags), click "Add release notes" for the tag just created.
Add the tag name in the "Release title" field and the relevant CHANGELOG.md section in the "Describe this release" textarea field.
Finally, attach the generated APK release file and click "Publish release".

## Post release
Update the [setup.py](/setup.py) `version string` with `YYYYMMDD.dev0`.
27 changes: 27 additions & 0 deletions pools/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,3 +260,30 @@ def patch_client_execute(m_execute):
def patch_session_fetch_schema():
"""Bypassing `fetch_schema()` on unit tests."""
return mock.patch("gql.client.SyncClientSession.fetch_schema")


def patch_get_liquidity_positions(positions=None):
positions = positions or []
return mock.patch("pools.uniswap.get_liquidity_positions", return_value=positions)


def patch_get_staking_positions(positions=None):
positions = positions or []
return mock.patch("pools.uniswap.get_staking_positions", return_value=positions)


def patch_get_lp_transactions(mints_burns):
return mock.patch("pools.uniswap.get_lp_transactions", return_value=mints_burns)


def patch_get_eth_price(price):
return mock.patch("pools.uniswap.get_eth_price", return_value=price)


def patch_portfolio(data=None):
data = data or {}
return mock.patch("pools.uniswap.portfolio", return_value=data)


def patch_sys_argv(argv):
return mock.patch("sys.argv", argv)
3 changes: 2 additions & 1 deletion pools/uniswap.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,8 @@ def main():
address = args.address
data = portfolio(address)
pprint(data)
return data


if __name__ == "__main__":
main()
main() # pragma: no cover
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[flake8]
max-line-length = 88
extend-ignore = E203
[coverage:run]
relative_files = True
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def read(fname):
# exposing the params so it can be imported
setup_params = {
"name": "pools",
"version": "20201026",
"version": "20210424",
"description": "Python library for pools liquidity providers",
"long_description": read("README.md"),
"long_description_content_type": "text/markdown",
Expand Down

0 comments on commit eb23186

Please sign in to comment.