Skip to content

Commit

Permalink
migrate to poetry (#44)
Browse files Browse the repository at this point in the history
* migrate to pyproject

* remove transient/unused packages

* update to newest versions for all packages

* ensure isort compatability with black

* make package 3.8 compatible

* remove old pip command

* readd typed packages

* add python 3.12 to version matrix

* add python 3.12 to classifiers

* prune to only required typed dependencies

* Pin pypi-publish-version in python-release.yml

* test sdist again in pythonapp.yml

* Update python-release.yml

---------

Co-authored-by: ldruschk <[email protected]>
  • Loading branch information
RTUnreal and ldruschk committed Jun 8, 2024
1 parent b542ba3 commit 9e4dbee
Show file tree
Hide file tree
Showing 10 changed files with 656 additions and 127 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/python-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,21 @@ jobs:
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 pypa/build

- name: Install poetry
run: |
python -m pip install build --user
python -m pip install poetry
- name: Build a binary wheel and a source tarball
run: |
python -m build --sdist --wheel --outdir dist/ .
python -m poetry build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # v1.8.14
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
33 changes: 25 additions & 8 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,45 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

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

- name: Install poetry
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: test pip install
python -m pip install poetry
- name: Configure poetry
run: |
pip install .
python -m poetry config virtualenvs.in-project true
- name: Cache the virtualenv
uses: actions/cache@v2
with:
path: ./.venv
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}

- name: Check poetry.lock
run: |
python -m poetry check
- name: Install dependencies
run: |
python -m poetry install --with test
- name: lint
run: |
pip install -r dev-requirements.txt
make lint
- name: test sdist
run: |
mkdir /tmp/test_sdist
python setup.py sdist -d /tmp/test_sdist
python -m poetry build -f sdist -o /tmp/test_sdist
cd /tmp/test_sdist
pip install enochecker_test-*.tar.gz
7 changes: 0 additions & 7 deletions .isort.cfg

This file was deleted.

19 changes: 0 additions & 19 deletions .mypy.ini

This file was deleted.

15 changes: 7 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
lint:
python -m isort -c enochecker_test/
python -m black --check --diff enochecker_test/
python -m flake8 --select F --per-file-ignores="__init__.py:F401" enochecker_test/
python -m mypy enochecker_test/
poetry run isort -c enochecker_test/
poetry run black --check --diff enochecker_test/
poetry run flake8 --select F --per-file-ignores="__init__.py:F401" enochecker_test/
poetry run mypy enochecker_test/

format:
python -m isort enochecker_test/
python -m black enochecker_test/
poetry run isort enochecker_test/
poetry run black enochecker_test/

test:
pip install .
python -m pytest
poetry run pytest
24 changes: 0 additions & 24 deletions dev-requirements.txt

This file was deleted.

534 changes: 534 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

82 changes: 82 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
[tool.poetry]
name = "enochecker_test"
version = "0.9.0"
description = "Library to help testing checker scripts based on enochecker"
authors = ["ldruschk <[email protected]>"]
license = "MIT"
readme = "README.md"
homepage = "https://github.com/enowars/enochecker_test"
repository = "https://github.com/enowars/enochecker_test"
classifiers = [
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
"Development Status :: 3 - Alpha",
# Indicate who your project is intended for
# 'Intended Audience :: Developers',
"License :: OSI Approved :: MIT License",
# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
"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",
]

[tool.poetry.dependencies]
python = ">=3.8.1,<=4.0"
enochecker-core = "^0.10.0"
jsons = "^1.6.3"
pytest = "^8.2.1"
requests = "^2.32.3"

[tool.poetry.group.test.dependencies]
black = "^24.4.2"
flake8 = "^7.0.0"
isort = "^5.13.2"
mypy = "^1.10.0"

types-requests = "^2.30"

[tool.poetry.scripts]
enochecker_cli = "enochecker_cli.main:main"

[build-system]
requires = ["poetry-core>=1.5.0"]
build-backend = "poetry.core.masonry.api"


[tool.mypy]
check_untyped_defs = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_unreachable = true

[[tool.mypy.overrides]]
module = "pytest"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "enochecker"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "enochecker_core"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "jsons"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "enochecker_test"

[tool.isort]
profile = "black"
multi_line_output=3
include_trailing_comma = true
line_length = 88
force_grid_wrap = 0
use_parentheses = true
14 changes: 0 additions & 14 deletions requirements.txt

This file was deleted.

42 changes: 0 additions & 42 deletions setup.py

This file was deleted.

0 comments on commit 9e4dbee

Please sign in to comment.