Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Poetry for dependency management #431

Merged
merged 6 commits into from
Jul 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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