diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7e2ee11..aa97a91 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python-version: [3.9, 3.10.9] + python-version: [3.9, 3.10.9, 3.12] test_env: [python, precommit, mypy] runs-on: ubuntu-latest steps: diff --git a/.github/workflows/pypi_release.yml b/.github/workflows/pypi_release.yml new file mode 100644 index 0000000..38fa35f --- /dev/null +++ b/.github/workflows/pypi_release.yml @@ -0,0 +1,55 @@ +name: PyPIRelease +# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ + +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.12 + + - name: Install pypa/build + run: >- + python3 -m + pip install + build + --user + + - name: Build a binary wheel and a source tarball + run: python3 -m build + + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + release: + name: >- + Publish Python 🐍 distribution 📦 to PyPI + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi_release + url: https://pypi.org/p/py-SEED + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/README.rst b/README.rst index 377e0d3..9fd3e62 100644 --- a/README.rst +++ b/README.rst @@ -1,7 +1,6 @@ py-SEED =========== - .. image:: https://github.com/seed-platform/py-seed/actions/workflows/ci.yml/badge.svg?branch=develop :target: https://github.com/seed-platform/py-seed/actions/workflows/ci.yml/badge.svg @@ -74,6 +73,7 @@ Low-Level Documentation ----------------------- This client has access to the lower level API client by accessing `seed_client_base.SEEDOAuthReadOnlyClient`, `seed_client_base.SEEDOAuthReadWriteClient`, `seed_client_base.SEEDReadOnlyClient`, and `seed_client_base.SEEDReadWriteClient`. This provides two user authentication based Python clients and two authentication methods, basic and `OAuth2 `_. More information on authentication can be seen in the following py-SEED classes: +.. code-block:: bash SEEDOAuthReadOnlyClient SEEDOAuthReadWriteClient @@ -107,10 +107,10 @@ Tests can be run via the `pytest` command. You will need to export environment variables for a test portfolio manager account to test integration. Environment variables should be named: - ..code-block:: bash +.. code-block:: bash - SEED_PM_UN - SEED_PM_PW + SEED_PM_UN + SEED_PM_PW SEED Platform @@ -126,16 +126,12 @@ Full details in LICENSE file. Releasing --------- -* Configure your PyPi with token access `https://pypi.org/manage/account/token/ `_. -* Merge down to main -* Tag release on GitHub and add in the change log -* Release via command line +This project is configured with GitHub Actions to automatically release to PyPi when a new tag is created. To release a new version: -.. code-block:: bash +* Create a branch with the prepared release change log +* Merge branch to develop, and open PR to main +* Once deployed to main, create a new tag in GitHub against main and copy the change log notes into the tag description +* GitHub Actions will automatically prepare the release the new version to PyPi +* Go to GitHub actions to approve the release - rm -rf dist - python setup.py sdist - pip install twine - # make sure to check the dist package for errors in the RST files - twine check dist/* - twine upload --repository py-seed dist/* +The GitHub Action required updates to the GitHub repo to only release on tags (https://github.com/SEED-platform/py-seed/settings/environments) after approval and on PyPi to add an authorized publisher (https://pypi.org/manage/project/py-SEED/settings/publishing/). diff --git a/pyseed/seed_client_base.py b/pyseed/seed_client_base.py index 22a009c..51bcbfa 100644 --- a/pyseed/seed_client_base.py +++ b/pyseed/seed_client_base.py @@ -242,11 +242,11 @@ def _check_response(self, response, *args, **kwargs): elif status_field == 'success': # continue error = False - elif 'success' in response.json().keys(): + elif 'success' in response.json(): success_flag = response.json().get('success', None) # For file uploads the response key is 'success' error = not success_flag - elif 'progress_data' in response.json().keys(): + elif 'progress_data' in response.json(): # this is a system matching response, which is okay. return the success flag of this status_flag = response.json()['progress_data'].get('status', None) error = status_flag not in ['not-started', 'success', 'parsing'] diff --git a/requirements-test.txt b/requirements-test.txt index 39ec4a5..5d19027 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,11 +1,11 @@ -r requirements.txt -flake8==4.0.1 -mock==4.0.3 +flake8==7.0.0 +mock==5.1.0 mypy==1.10.0 -pre-commit==2.19.0 -pytest==7.1.2 -pytest-cov==3.0.0 -pytest-order==1.0.1 -pytest-xdist==2.5.0 -testfixtures>=5.1.1 -tox==3.25.0 +pre-commit==3.7.1 +pytest==8.2.2 +pytest-cov==5.0.0 +pytest-order==1.2.1 +pytest-xdist==3.6.1 +testfixtures>=8.3.0 +tox==4.15.1 diff --git a/requirements.txt b/requirements.txt index c50220a..931bce5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ openpyxl==3.1.2 requests>=2.28.0 -typing==3.6.1 +typing==3.7.4.3 diff --git a/setup.cfg b/setup.cfg index 41d6360..5fee117 100644 --- a/setup.cfg +++ b/setup.cfg @@ -15,6 +15,7 @@ classifiers = Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 [options] packages = find: