diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml new file mode 100644 index 0000000..79f7415 --- /dev/null +++ b/.github/workflows/checks.yml @@ -0,0 +1,41 @@ +name: checks +on: + push: + pull_request: + schedule: + - cron: "40 22 * * 6" + +concurrency: + group: check-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + name: test with ${{ matrix.py }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + py: + - "3.12" + - "3.11" + - "3.10" + - "3.9" + - "3.8" + os: + - ubuntu-latest + - windows-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup python for test ${{ matrix.py }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.py }} + - name: Install tox + run: python -m pip install tox-gh>=1.2 + - name: Setup test suite + run: tox -vv --notest + - name: Run test suite + run: tox \ No newline at end of file diff --git a/.github/workflows/linux-checks.yml b/.github/workflows/linux-checks.yml deleted file mode 100644 index 8d51142..0000000 --- a/.github/workflows/linux-checks.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: Checks-Linux - -on: - push: - branches: [main] - pull_request: - branches: [main] - schedule: - - cron: "40 22 * * 6" - -jobs: - unit-tests: - - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - matrix: - python-version: [3.7, 3.8, 3.9, "3.10"] - pandas: [10, latest] - exclude: - - python-version: 3.9 - pandas: "10" - - python-version: "3.10" - pandas: "10" - include: - - python-version: 3.7 - pandas: "10" - tox_env: py37-pandas10 - - python-version: 3.7 - pandas: latest - tox_env: py37-pandaslatest - - python-version: 3.8 - pandas: "10" - tox_env: py38-pandas10 - - python-version: 3.8 - pandas: latest - tox_env: py38-pandaslatest - - python-version: 3.9 - pandas: latest - tox_env: py39-pandaslatest - - python-version: "3.10" - pandas: latest - tox_env: py310-pandaslatest - - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install tox - run: | - python -m pip install --upgrade pip - python -m pip install tox - - name: Test with pytest - run: | - tox -e ${{ matrix.tox_env }} - - linting: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: "3.10" - - name: Install tox - run: | - python -m pip install --upgrade pip - python -m pip install tox - - name: Linting - run: | - tox -e linting diff --git a/.github/workflows/windows-checks.yml b/.github/workflows/windows-checks.yml deleted file mode 100644 index 5cc0bc5..0000000 --- a/.github/workflows/windows-checks.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Checks-Windows - -on: - push: - branches: [main] - pull_request: - branches: [main] - schedule: - - cron: "40 22 * * 6" - -jobs: - unit-tests: - - runs-on: windows-latest - strategy: - fail-fast: false - matrix: - python-version: [3.7, 3.8, 3.9, "3.10"] - pandas: [10, latest] - exclude: - - python-version: 3.9 - pandas: "10" - - python-version: "3.10" - pandas: "10" - include: - - python-version: 3.7 - pandas: "10" - tox_env: py37-pandas10 - - python-version: 3.7 - pandas: latest - tox_env: py37-pandaslatest - - python-version: 3.8 - pandas: "10" - tox_env: py38-pandas10 - - python-version: 3.8 - pandas: latest - tox_env: py38-pandaslatest - - python-version: 3.9 - pandas: latest - tox_env: py39-pandaslatest - - python-version: "3.10" - pandas: latest - tox_env: py310-pandaslatest - - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install tox - run: | - python -m pip install --upgrade pip - python -m pip install tox - - name: Test with pytest - run: | - tox -e ${{ matrix.tox_env }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f0e7d60..d615bb4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.3.0 + rev: v4.5.0 hooks: - id: check-case-conflict - id: check-toml @@ -15,17 +15,17 @@ repos: - id: black - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort - repo: https://github.com/PyCQA/flake8 - rev: 3.8.4 + rev: 7.0.0 hooks: - id: flake8 - repo: https://github.com/econchick/interrogate - rev: 1.3.2 + rev: 1.5.0 hooks: - id: interrogate exclude: ^(setup.py) diff --git a/README.md b/README.md index 7f044d0..64ba7ce 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -[![unit-tests-linux](https://github.com/drgfreeman/dynamo-pandas/actions/workflows/linux-checks.yml/badge.svg)](https://github.com/DrGFreeman/dynamo-pandas/actions/workflows/linux-checks.yml) -[![unit-tests-windows](https://github.com/drgfreeman/dynamo-pandas/actions/workflows/windows-checks.yml/badge.svg)](https://github.com/DrGFreeman/dynamo-pandas/actions/workflows/windows-checks.yml) +[![unit-tests-linux](https://github.com/drgfreeman/dynamo-pandas/actions/workflows/checks.yml/badge.svg)](https://github.com/DrGFreeman/dynamo-pandas/actions/workflows/checks.yml) [![Documentation Status](https://readthedocs.org/projects/dynamo-pandas/badge/?version=latest)](https://dynamo-pandas.readthedocs.io/en/latest/?badge=latest) # dynamo-pandas diff --git a/dynamo_pandas/__init__.py b/dynamo_pandas/__init__.py index f498177..c723762 100644 --- a/dynamo_pandas/__init__.py +++ b/dynamo_pandas/__init__.py @@ -2,6 +2,6 @@ from .dynamo_pandas import keys from .dynamo_pandas import put_df -__version__ = "1.3.0" +__version__ = "1.4.0-dev" __all__ = ["get_df", "keys", "put_df", "__version__"] diff --git a/requirements-test.txt b/requirements-test.txt index 89687aa..adb7955 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,4 +1,4 @@ -moto +moto[dynamodb]>=5,<6 pytest pytest-cov -pytest-randomly \ No newline at end of file +pytest-randomly diff --git a/setup.py b/setup.py index c8e0b87..1d52bda 100644 --- a/setup.py +++ b/setup.py @@ -37,16 +37,17 @@ def find_meta(meta): long_description=read("README.md"), long_description_content_type="text/markdown", packages=find_packages(), - python_requires=">=3.7", - install_requires=["pandas>=1"], + python_requires=">=3.8", + install_requires=["pandas>=1.2"], extras_require={"boto3": ["boto3"]}, classifiers=[ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ], ) diff --git a/tests/conftest.py b/tests/conftest.py index d2bf700..2102ec3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,7 +2,7 @@ import os import boto3 -from moto import mock_dynamodb +from moto import mock_aws import pytest from test_data import large_table_items from test_data import test_df @@ -23,7 +23,7 @@ def aws_credentials(): @pytest.fixture() def ddb_client(aws_credentials): """Fixture to mock the dynamodb client using moto.""" - with mock_dynamodb(): + with mock_aws(): yield boto3.client("dynamodb") diff --git a/tests/test_main.py b/tests/test_main.py index 908ccba..bccc3fe 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -145,8 +145,8 @@ def test_attributes_returns_specified_columns(self, test_df_table): assert df.equals( pd.DataFrame( [ - {"A": "abc", "E": "2000-01-01 00:00:00+00:00", "id": 0}, - {"A": None, "E": "2000-12-31 23:59:59+00:00", "id": 1}, + {"id": 0, "A": "abc", "E": "2000-01-01 00:00:00+00:00"}, + {"id": 1, "A": None, "E": "2000-12-31 23:59:59+00:00"}, ] ) ) @@ -159,9 +159,9 @@ def test_attributes_and_keys(self, test_df_table): assert df.equals( pd.DataFrame( [ - {"A": "abc", "E": "2000-01-01 00:00:00+00:00", "id": 0}, - {"A": None, "E": "2000-12-31 23:59:59+00:00", "id": 1}, - {"A": None, "E": None, "id": 2}, + {"id": 0, "A": "abc", "E": "2000-01-01 00:00:00+00:00"}, + {"id": 1, "A": None, "E": "2000-12-31 23:59:59+00:00"}, + {"id": 2, "A": None, "E": None}, ] ) ) @@ -312,7 +312,7 @@ def test_with_dtype(self): test_items, dtype=dict( # C="timedelta64[ns]", # Ref. #24 - D="datetime64", + D="datetime64[ns]", E="datetime64[ns, UTC]", F="Int32", ), diff --git a/tox.ini b/tox.ini index e1f66bf..7f2b8a6 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,14 @@ [tox] -minversion = 3.10 -envlist = py{37, 38}-pandas10, py{37, 38, 39, 310}-pandaslatest, linting +minversion = 4 +envlist = py{38, 39}-pandas12, py{38, 39, 310, 311, 312}-pandaslatest, linting + +[gh] +python = + 3.12 = py312-pandaslatest + 3.11 = py311-pandaslatest + 3.10 = py310-pandaslatest, linting + 3.9 = py39-pandas12, py39-pandaslatest + 3.8 = py38-pandas12, py38-pandaslatest [testenv] setenv = @@ -12,8 +20,8 @@ download = true deps = .[boto3] -rrequirements-test.txt - pandas10: pandas>=1,<1.1 - pandas10: numpy<=1.20 + pandas12: pandas>=1.2,<1.3 + pandas12: numpy<=1.20 commands = pytest -v --cov={envsitepackagesdir}/dynamo_pandas --cov-report term-missing {posargs} [testenv:linting] @@ -21,12 +29,14 @@ basepython = python310 deps = pre-commit skipdist = true usedevelop = true +skipinstall = true commands = pre-commit run --all-files [pytest] filterwarnings = - error + ; error ignore:.*is a deprecated alias:DeprecationWarning ignore:numpy.ufunc size changed:RuntimeWarning ignore:The distutils package:DeprecationWarning - ignore:distutils Version classes are deprecated:DeprecationWarning \ No newline at end of file + ignore:distutils Version classes are deprecated:DeprecationWarning + ignore:.*Pyarrow:DeprecationWarning