Skip to content

Commit

Permalink
Merge pull request #3 from bmarroquin/main
Browse files Browse the repository at this point in the history
Updates supported pythons and github actions
  • Loading branch information
AndrewSpittlemeister authored Oct 4, 2023
2 parents 4c4029f + 78af392 commit 3651b2b
Show file tree
Hide file tree
Showing 7 changed files with 897 additions and 837 deletions.
46 changes: 16 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,23 @@ on:

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]

python-version: ["3.10", "3.11"]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
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 dependencies
run: |
python -m pip install --upgrade pip
python -m pip install black pylint pytest bandit mypy poetry
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with black & pylint
run: |
pylint --max-line-length=100 bytechomp --disable=duplicate-code
black --verbose --check --diff --line-length=100 bytechomp
- name: Type check with Mypy
run: |
mypy bytechomp
- name: Security check with Bandit
run: |
bandit -r bytechomp
- name: Build with Poetry
run: |
poetry build --format=wheel
- name: Test with pytest
run: |
pytest
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
allow-prereleases: true
- run: poetry install
- run: poetry run pylint --max-line-length=100 bytechomp --disable=duplicate-code
- run: poetry run black --verbose --check --diff --line-length=100 bytechomp
- run: poetry run mypy bytechomp
- run: poetry run pytest
5 changes: 1 addition & 4 deletions bytechomp/byte_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ class ByteOrder(Enum):

def to_pattern(self) -> str:
"""Returns the corresponding struct pattern."""

if self == ByteOrder.NATIVE:
return "@"
if self == ByteOrder.BIG:
return ">"
if self == ByteOrder.LITTLE:
return "<"
raise Exception("invalid enumeration value")
return "@"
1 change: 1 addition & 0 deletions bytechomp/data_descriptor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
bytechomp.data_descriptor
"""
# pylint: disable=broad-exception-raised

from __future__ import annotations
from typing import Annotated, Any, get_origin, get_args
Expand Down
2 changes: 1 addition & 1 deletion bytechomp/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def allocate(self) -> Reader[T]:
or not is_dataclass(self.__datatype)
or self.__datatype is None
):
raise Exception("generic datatype must be a dataclass")
raise ValueError("generic datatype must be a dataclass")

# verify that the datatype contains only known types
self.__data_description = build_data_description(self.__datatype)
Expand Down
1 change: 1 addition & 0 deletions bytechomp/serialization.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
bytechomp.serialization
"""
# pylint: disable=broad-exception-raised

import struct
from typing import Annotated, get_origin, get_args
Expand Down
1,677 changes: 876 additions & 801 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ include = [
]

[tool.poetry.dependencies]
python = "~3.10"
python = ">=3.10"

[tool.poetry.dev-dependencies]
black = "*"
Expand Down

0 comments on commit 3651b2b

Please sign in to comment.