Skip to content

Commit

Permalink
build: change from setuptools to poetry
Browse files Browse the repository at this point in the history
as poetry is the defacto standard in the python ecosystem, this might streamline the build process
  • Loading branch information
moldhouse committed Oct 22, 2024
1 parent 7c07328 commit 93d7736
Show file tree
Hide file tree
Showing 7 changed files with 3,344 additions and 127 deletions.
16 changes: 6 additions & 10 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,23 @@ jobs:
strategy:
matrix:
python-version: [3.8, 3.12]

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: |
**/setup.py
- name: Setup Poetry
uses: Gr1N/setup-poetry@v9
- name: Install deps
run: |
python -m pip install --upgrade pip
pip install -e .[test,types]
run: poetry install
- name: Lint with mypy
run: |
mypy aleph_alpha_client
mypy --ignore-missing-imports tests
poetry run mypy aleph_alpha_client
poetry run mypy tests --ignore-missing-imports
- name: Run tests
run: |
pytest
poetry run pytest
env:
TEST_API_URL: https://api.aleph-alpha.com
TEST_TOKEN: ${{ secrets.AA_API_TOKEN }}
48 changes: 11 additions & 37 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
Expand All @@ -14,34 +6,16 @@ on:

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Assert tag version matches __version__ attribute
run: |
pushd aleph_alpha_client
python -c "from version import __version__; \
git_ref = '${GITHUB_REF#refs/}'; \
assert git_ref.startswith('tags'), \
f'{git_ref} is not a version tag'; \
git_version = '${GITHUB_REF#refs/tags/}'[1:]; \
assert __version__ == git_version, \
f'versions do not match {__version__} vs. {git_version}. Please update version.py to match the git Release tag.'"
popd
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@897895f1e160c830e369f9779632ebc134688e1b
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Setup Poetry
uses: Gr1N/setup-poetry@v9
- name: Install deps
run: poetry install
- name: Build
run: poetry build
- name: Publish
run: poetry publish -u __token__ -p ${{ secrets.PYPI_API_TOKEN }}
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,17 @@ Get started using the client by first [creating an account](https://app.aleph-al

For local development, start by creating a Python virtual environment as follows:

```
```shell
python3 -m venv venv
. ./venv/bin/activate
```

Next, install the `test` and `dev` dependencies:
Next, install the test and dev dependencies:

```shell
poetry install
```
pip install -e ".[test,dev]"
```


Now you should be able to ...

Expand Down
5 changes: 4 additions & 1 deletion aleph_alpha_client/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
__version__ = "7.4.0"
import importlib.metadata

__version__ = importlib.metadata.version("aleph-alpha-client")

MIN_API_VERSION = "1.19.0"
Loading

0 comments on commit 93d7736

Please sign in to comment.