Skip to content

Commit

Permalink
Use Poetry for dependency management (#431)
Browse files Browse the repository at this point in the history
  • Loading branch information
george-zubrienko authored Jul 16, 2023
1 parent 73de65c commit 094f074
Show file tree
Hide file tree
Showing 13 changed files with 1,512 additions and 368 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/code-quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
- name: Install Poetry and dependencies
run: |
python -m pip install --upgrade pip
pip install ".[dev]"
set -e
curl -sSL https://install.python-poetry.org | python3 -
poetry install --all-extras
- uses: reviewdog/action-setup@v1

- name: run mypy
run: mypy --no-warn-no-return dataclasses_json
run: poetry run mypy --no-warn-no-return dataclasses_json
19 changes: 19 additions & 0 deletions .github/workflows/prepare-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Prepare GH Release

on: workflow_dispatch

jobs:
create_release:
name: Create Release
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Create Release
uses: SneaksAndData/github-actions/[email protected]
with:
major_v: 0
minor_v: 5
55 changes: 34 additions & 21 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,27 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
- name: Install Poetry and dependencies
run: |
python -m pip install --upgrade pip
pip install ".[dev]"
set -e
curl -sSL https://install.python-poetry.org | python3 -
poetry install --all-extras
- name: Lint with flake8
run: |
flake8 dataclasses_json --show-source --statistics --count
set -e
poetry run flake8 dataclasses_json --show-source --statistics --count
- name: Test with pytest
run: |
pytest
set -euxo pipefail
poetry run pytest ./tests --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=term-missing:skip-covered | tee pytest-coverage.txt
- name: Publish Code Coverage
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./junit/test-results.xml


release:
needs: [test]
Expand All @@ -50,25 +61,27 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python3 -m
build
--sdist
--wheel
--outdir dist/
.
python-version: "3.9.x"
- name: Install Poetry and Prepare version
run:
set -e

curl -sSL https://install.python-poetry.org | python3 -

version=$(git describe --tags --abbrev=7)
sed -i "s/version = \"0.0.0\"/version = \"${version:1}\"/" pyproject.toml
echo "__version__ = '${version:1}'" > ./dataclasses_json/_version.py
- name: Build package
run:
set -e

poetry build

- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@release/v1
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

20 changes: 0 additions & 20 deletions Pipfile

This file was deleted.

242 changes: 0 additions & 242 deletions Pipfile.lock

This file was deleted.

2 changes: 2 additions & 0 deletions dataclasses_json/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
Exclude, LetterCase)
from dataclasses_json.undefined import CatchAll, Undefined

from dataclasses_json._version import __version__

__all__ = ['DataClassJsonMixin', 'LetterCase', 'dataclass_json',
'config', 'global_config', 'Exclude',
'CatchAll', 'Undefined']
6 changes: 6 additions & 0 deletions dataclasses_json/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""
Version file.
Allows common version lookup via from dataclasses_json import __version__
"""

__version__ = "0.0.0" # replaced by git tag on deploy
Loading

4 comments on commit 094f074

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
dataclasses_json
   cfg.py51492%77, 81–83
   core.py231996%38–41, 51, 64, 66, 81, 83, 169
   mm.py1892985%33–36, 42–45, 53–56, 62–65, 88, 152–153, 158, 162, 166, 171, 175, 179, 187, 193, 198, 207, 212, 217, 235–242
   stringcase.py25388%59, 76, 97
   undefined.py143299%24, 38
   utils.py1283176%11–24, 44–49, 60–64, 74, 77, 80, 99–100, 108–109, 158, 177, 202
tests
   entities.py220299%229, 235
   test_annotations.py814248%50–67, 78–102, 106–122
   test_api.py142299%139–140
   test_str_subclass.py22195%9
TOTAL240612595% 

Tests Skipped Failures Errors Time
281 1 💤 0 ❌ 0 🔥 3.138s ⏱️

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
dataclasses_json
   cfg.py51492%77, 81–83
   core.py232996%38–41, 51, 64, 66, 81, 83, 169
   mm.py1892985%33–36, 42–45, 53–56, 62–65, 88, 152–153, 158, 162, 166, 171, 175, 179, 187, 193, 198, 207, 212, 217, 235–242
   stringcase.py25388%59, 76, 97
   undefined.py141299%24, 38
   utils.py1283176%11–24, 44–49, 60–64, 74, 77, 80, 99–100, 108–109, 158, 177, 202
tests
   entities.py201299%229, 235
   test_annotations.py804248%50–67, 78–102, 106–122
   test_api.py140299%139–140
   test_str_subclass.py22195%9
TOTAL229712595% 

Tests Skipped Failures Errors Time
281 1 💤 0 ❌ 0 🔥 2.986s ⏱️

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
dataclasses_json
   cfg.py51492%77, 81–83
   core.py2321096%38–41, 51, 64, 66, 81, 83, 169, 197
   mm.py1903084%33–36, 42–45, 53–56, 62–65, 88, 152–153, 158, 162, 166, 171, 175, 179, 187, 193, 198, 207, 212, 217, 226, 235–242
   stringcase.py25388%59, 76, 97
   undefined.py143299%24, 38
   utils.py1283870%11–24, 44–49, 60–64, 74, 77, 80, 99–100, 108–109, 124–132, 158, 177, 202
tests
   entities.py220299%229, 235
   test_annotations.py814248%50–67, 78–102, 106–122
   test_api.py142497%88, 99, 139–140
   test_str_subclass.py22195%9
   test_union.py981090%87–94, 108–115
TOTAL240814694% 

Tests Skipped Failures Errors Time
281 3 💤 0 ❌ 0 🔥 3.333s ⏱️

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
dataclasses_json
   cfg.py51492%77, 81–83
   core.py231996%38–41, 51, 64, 66, 81, 83, 169
   mm.py1892985%33–36, 42–45, 53–56, 62–65, 88, 152–153, 158, 162, 166, 171, 175, 179, 187, 193, 198, 207, 212, 217, 235–242
   stringcase.py25388%59, 76, 97
   undefined.py143299%24, 38
   utils.py1283176%11–24, 44–49, 60–64, 74, 77, 80, 99–100, 108–109, 158, 177, 202
tests
   entities.py220299%229, 235
   test_annotations.py814248%50–67, 78–102, 106–122
   test_api.py142199%139
   test_str_subclass.py22195%9
TOTAL240612495% 

Tests Skipped Failures Errors Time
281 1 💤 0 ❌ 0 🔥 4.050s ⏱️

Please sign in to comment.