Skip to content

Commit

Permalink
feat: poetry (#182)
Browse files Browse the repository at this point in the history
* poetry checkpoint

* use .env file

* tox example

* adding coverage and pytest qol

* chore: update pyproject.toml

* chore: bump ez-a-sync to needed version

* adding asyncio

* updating lockfile

* release workflow setup with poetry

* updating mypy actions

* updating pytest.yaml w/ poetry

* docs workflow updated with poetry

* dev comment

* chore: use matrix for mypy action

* local load env check

* brownie should be accessed correctly now

---------

Co-authored-by: BobTheBuidler <[email protected]>
  • Loading branch information
pmdaly and BobTheBuidler committed May 4, 2024
1 parent 7c0235a commit 50284c2
Show file tree
Hide file tree
Showing 14 changed files with 4,917 additions and 71 deletions.
4 changes: 4 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Fill this out when developing locally
PYTEST_NETWORK=
ETHERSCAN_TOKEN=
WEB3_INFURA_PROJECT_ID=
22 changes: 14 additions & 8 deletions .github/workflows/deploy-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,34 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v4.1.4

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install Dependencies
run: |
poetry install --no-interaction
- name: Install dependencies
# pip will install despite the conflicts, poetry will prevent it
run: |
pip install wheel
pip install --no-build-isolation "Cython<3" "pyyaml==5.4.1"
pip install -r requirements.txt -r requirements-dev.txt
pip install sphinx sphinx-rtd-theme
poetry run pip install wheel
poetry run pip install --no-build-isolation "Cython<3" "pyyaml==5.4.1"
poetry run pip install sphinx sphinx-rtd-theme
- name: Setup brownie networks
run: |
brownie networks modify mainnet host=${{ secrets.ALCHEMY_PROVIDER }}
poetry run brownie networks modify mainnet host=${{ secrets.ALCHEMY_PROVIDER }}
continue-on-error: true

- name: Build documentation config
run: |
pip install .
make docs
- name: Build documentation
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/mypy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,23 @@ concurrency:

jobs:
mypy:
runs-on: ubuntu-20.04
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
pyversion: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Setup Python (faster than using Python container)
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: "3.9"
python-version: ${{ matrix.pyversion }}

- name: Install MyPy
run: |
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,28 @@ jobs:

steps:
- name: Check out repository code
uses: actions/checkout@v2
uses: actions/checkout@v4.1.4

- name: Setup Python (faster than using Python container)
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.pyversion }}

- name: Install dependencies
run: |
pip install -r requirements.txt -r requirements-dev.txt
- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install Dependencies
run: poetry install --no-interaction

- name: Setup brownie networks
run: |
brownie networks modify mainnet host=${{ secrets[matrix.provider] }}
poetry run brownie networks modify mainnet host=${{ secrets[matrix.provider] }}
continue-on-error: true

- name: Run test suite
env:
PYTEST_NETWORK: mainnet
ETHERSCAN_TOKEN: ${{ secrets.ETHERSCAN_TOKEN }}
run: pytest --asyncio-task-timeout=3600
run: |
poetry run pytest --asyncio-task-timeout=3600
33 changes: 21 additions & 12 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,27 @@ jobs:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- uses: actions/setup-python@v2
- 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_PASSWORD }}

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.9"

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install Dependencies
run: poetry install --no-interaction

- name: Run Tests
run: poetry run pytest

- name: Build and Publish
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
poetry config pypi-token.pypi ${{ secrets.PYPI_PASSWORD }}
poetry publish --build --no-interaction
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ dank_mids.egg-info
.pytest_cache
.eggs
.mypy_cache
__pycache__
__pycache__
.env
.tox/
.python-version
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ docs:
rm -r ./docs/source -f
rm -r ./docs/_templates -f
rm -r ./docs/_build -f
sphinx-apidoc -o ./docs/source ./dank_mids
poetry run sphinx-apidoc -o ./docs/source ./dank_mids
Loading

0 comments on commit 50284c2

Please sign in to comment.