Skip to content

Commit

Permalink
Update compatibility with pynamodb 5.0 and bump 0.3.0 (#27)
Browse files Browse the repository at this point in the history
* Update compatibility with pynamodb 5.0

* bump 0.3.0 and minimum version of pynamodb

* Upgrade pynamodb in pre-commit config too

Also run pre-commit autoupdate.

* Migrate to github actions

* github/workflows: fix triggers and install deps

Co-authored-by: francisco souza <[email protected]>
  • Loading branch information
fsouza and fsouza authored Jan 28, 2021
1 parent 289f2df commit 270400d
Show file tree
Hide file tree
Showing 15 changed files with 102 additions and 90 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Release

on:
release:
types: [published]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
python -m pip install -e . -r requirements.txt
- name: Build packages
run: |
python setup.py sdist bdist_wheel
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
49 changes: 49 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Tests
on:
push:

pull_request:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.8"

services:
dynamodb-local:
image: "amazon/dynamodb-local:latest"
ports:
- "8000:8000"

steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: install deps
run: |
python -m pip install -e . -r requirements.txt
- name: run tests
run: make test

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install pre-commit
run: pip install pre-commit

- run: make lint
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
repos:
- repo: https://github.com/asottile/reorder_python_imports
rev: v2.3.0
rev: v2.3.6
hooks:
- id: reorder-python-imports
- repo: https://github.com/asottile/add-trailing-comma
rev: v2.0.1
rev: v2.1.0
hooks:
- id: add-trailing-comma
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.1.0
rev: v3.4.0
hooks:
- id: check-ast
- id: check-docstring-first
Expand All @@ -20,15 +20,15 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3
rev: 3.8.4
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- flake8-builtins
- flake8-comprehensions
- repo: https://github.com/asottile/yesqa
rev: v1.2.1
rev: v1.2.2
hooks:
- id: yesqa
additional_dependencies:
Expand All @@ -37,16 +37,16 @@ repos:
- flake8-builtins
- flake8-comprehensions
- repo: https://github.com/thlorenz/doctoc
rev: v1.4.0
rev: v2.0.0
hooks:
- id: doctoc
- repo: https://github.com/asottile/pyupgrade
rev: v2.6.2
rev: v2.7.4
hooks:
- id: pyupgrade
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.782
rev: v0.800
hooks:
- id: mypy
additional_dependencies:
- pynamodb==4.3.2
- pynamodb==5.0.0
34 changes: 0 additions & 34 deletions .travis.yml

This file was deleted.

28 changes: 0 additions & 28 deletions pynamodb_attributes/_typing.py

This file was deleted.

3 changes: 1 addition & 2 deletions pynamodb_attributes/float.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from pynamodb.attributes import Attribute
from pynamodb.attributes import NumberAttribute

from ._typing import Attribute


class FloatAttribute(Attribute[float]):
"""
Expand Down
3 changes: 1 addition & 2 deletions pynamodb_attributes/integer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from pynamodb.attributes import Attribute
from pynamodb.attributes import NumberAttribute

from ._typing import Attribute


class IntegerAttribute(Attribute[int]):
"""
Expand Down
3 changes: 2 additions & 1 deletion pynamodb_attributes/integer_date.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import json
from datetime import date

from ._typing import Attribute
from pynamodb.attributes import Attribute

from pynamodb_attributes import IntegerAttribute


Expand Down
3 changes: 1 addition & 2 deletions pynamodb_attributes/integer_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
from typing import TypeVar

import pynamodb.constants

from ._typing import Attribute
from pynamodb.attributes import Attribute

T = TypeVar('T', bound=Enum)
_fail: Any = object()
Expand Down
3 changes: 1 addition & 2 deletions pynamodb_attributes/timedelta.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
from typing import Optional

import pynamodb

from ._typing import Attribute
from pynamodb.attributes import Attribute


class TimedeltaAttribute(Attribute[timedelta]):
Expand Down
3 changes: 1 addition & 2 deletions pynamodb_attributes/timestamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
from typing import Optional

import pynamodb.constants

from ._typing import Attribute
from pynamodb.attributes import Attribute


class TimestampAttribute(Attribute[datetime]):
Expand Down
3 changes: 1 addition & 2 deletions pynamodb_attributes/unicode_delimited_tuple.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
from typing import TypeVar

import pynamodb.constants

from ._typing import Attribute
from pynamodb.attributes import Attribute

T = TypeVar('T', bound=Tuple[Any, ...])
_DEFAULT_FIELD_DELIMITER = '::'
Expand Down
3 changes: 1 addition & 2 deletions pynamodb_attributes/unicode_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
from typing import TypeVar

import pynamodb.constants

from ._typing import Attribute
from pynamodb.attributes import Attribute

T = TypeVar('T', bound=Enum)
_fail: Any = object()
Expand Down
3 changes: 1 addition & 2 deletions pynamodb_attributes/uuid.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
from uuid import UUID

import pynamodb.constants

from ._typing import Attribute
from pynamodb.attributes import Attribute


class UUIDAttribute(Attribute[UUID]):
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

setup(
name='pynamodb-attributes',
version='0.2.10',
version='0.3.0',
description='Common attributes for PynamoDB',
url='https://www.github.com/lyft/pynamodb-attributes',
maintainer='Lyft',
maintainer_email='[email protected]',
packages=find_packages(exclude=['tests*']),
dependency_links=[],
install_requires=[
"pynamodb>=3.3.3",
"pynamodb>=5.0.0",
],
python_requires='>=3',
package_data={'pynamodb_attributes': ['py.typed']},
Expand Down

0 comments on commit 270400d

Please sign in to comment.