From ca840ae791ffd32a615afca650181ef04fa65705 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Fri, 9 Apr 2021 00:01:32 +0800 Subject: [PATCH] Support python 3.6 (#19) * Support python 3.6 * Remove test dependency on 3.7 datetime * Fix black * Do not ignore images --- .github/workflows/ci.yml | 34 ++++++++++++++++++++++++++++++---- setup.py | 4 +++- tests/test_serving.py | 4 +--- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5fa7a2f..aeda683 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,20 +4,25 @@ on: push: branches: - master + tags: + - "[0-9]+.[0-9]+.[0-9]+" pull_request: types: [opened, ready_for_review, reopened, synchronize] + paths-ignore: + - docs + - examples + - notebooks jobs: - PR: + coverage: runs-on: ubuntu-latest - # if: ${{ github.event_name == 'pull_request' }} steps: - name: Checkout code uses: actions/checkout@v2 - - name: Set up Python 3.7 + - name: Set up Python 3.6 uses: actions/setup-python@v2 with: - python-version: "3.7" + python-version: 3.6 - name: Install dependencies run: pip install -r requirements.txt - name: Run tests @@ -28,3 +33,24 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: true verbose: true + release: + runs-on: ubuntu-latest + # Only push the image on new tag event + if: ${{ startsWith(github.ref, 'refs/tags/') }} + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Set up Python 3.7 + uses: actions/setup-python@v2 + with: + python-version: 3.7 + - name: Install pypa/build + run: pip install build + - name: Build a binary wheel and a source tarball + run: build --sdist --wheel --outdir dist/ . + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} + verbose: true diff --git a/setup.py b/setup.py index 19cf43d..39ccc7f 100644 --- a/setup.py +++ b/setup.py @@ -15,17 +15,19 @@ packages=setuptools.find_packages(), classifiers=[ "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", ], - python_requires=">=3.7", + python_requires=">=3.6", # TODO: can we relax these requirements at all? install_requires=[ "fluent-logger==0.9.6", "prometheus_client==0.9", "numpy==1.19.4", + "dataclasses; python_version<'3.7'", ], ) diff --git a/tests/test_serving.py b/tests/test_serving.py index 8d58fa3..b1be592 100644 --- a/tests/test_serving.py +++ b/tests/test_serving.py @@ -123,9 +123,7 @@ def test_log_prediction(): # Validate prediction id server_id, timestamp, entity_id = pid.split("/") assert server_id == "unknown-server" - parsed = datetime.fromisoformat(timestamp) - assert parsed.microsecond == 0 - assert not parsed.tzinfo + datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%S") assert str(UUID(entity_id)) == entity_id body, _ = service.export_http()