Skip to content

Commit

Permalink
Merge pull request #190 from jodal/jodal/upgrades
Browse files Browse the repository at this point in the history
Require Python 3.8, replace flake8 and isort with ruff
  • Loading branch information
jodal committed Jun 4, 2023
2 parents e6a1a96 + 5dfe7d2 commit d3d7090
Show file tree
Hide file tree
Showing 43 changed files with 340 additions and 335 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ jobs:
fail-fast: false
matrix:
include:
- name: "Test: Python 3.7"
python: "3.7"
tox: py37
- name: "Test: Python 3.8"
python: "3.8"
tox: py38
Expand All @@ -28,12 +25,15 @@ jobs:
python: "3.11"
tox: py311
coverage: true
- name: "Lint: flake8"
- name: "Lint: black"
python: "3.11"
tox: flake8
tox: black
- name: "Lint: mypy"
python: "3.11"
tox: mypy
- name: "Lint: ruff"
python: "3.11"
tox: ruff
- name: "Docs"
python: "3.11"
tox: docs
Expand All @@ -53,7 +53,7 @@ jobs:
key: ${{ runner.os }}-${{ matrix.python }}-${{ matrix.tox }}-pip-${{ hashFiles('pyproject.toml', 'tox.ini') }} }}
restore-keys: |
${{ runner.os }}-${{ matrix.python }}-${{ matrix.tox }}-pip-
- run: python -m pip install poetry==1.3.1 tox==3.28.0
- run: python -m pip install poetry==1.5.1 tox==3.28.0
- run: python -m tox -e ${{ matrix.tox }}
if: ${{ ! matrix.coverage }}
- run: python -m tox -e ${{ matrix.tox }} -- --cov-report=xml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/setup-python@v2
with:
python-version: "3.11"
- run: python -m pip install poetry==1.3.1 tox==3.28.0
- run: python -m pip install poetry==1.5.1 tox==3.28.0
- run: tox --skip-missing-interpreters true
- run: poetry build
- run: poetry publish --username=__token__ --password=${{ secrets.PYPI_TOKEN }}
18 changes: 9 additions & 9 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
version: 2

build:
image: latest

python:
version: 3.7
install:
- requirements: docs/requirements.txt
- method: pip
path: .
os: "ubuntu-22.04"
tools:
python: "3.11"
jobs:
post_install:
- pip install poetry
- poetry config virtualenvs.create false
- poetry install --all-extras --only=main,docs

sphinx:
builder: htmldir
configuration: docs/conf.py
builder: dirhtml

formats: all
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
poetry 1.3.1
python 3.11.1 3.10.9 3.9.16 3.8.16 3.7.16
poetry 1.5.1
python 3.11 3.10 3.9 3.8
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ see the [documentation](https://pykka.readthedocs.io/).

## Installation

Pykka requires Python 3.7 or newer.
Pykka requires Python 3.8 or newer.

Pykka is available from [PyPI](https://pypi.org/project/pykka/):

Expand All @@ -39,6 +39,6 @@ python3 -m pip install pykka

## License

Pykka is copyright 2010-2022 Stein Magnus Jodal and contributors.
Pykka is copyright 2010-2023 Stein Magnus Jodal and contributors.
Pykka is licensed under the
[Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0).
12 changes: 8 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Pykka documentation build configuration file"""
"""Pykka documentation build configuration file."""

import toml

project = "Pykka"
author = "Stein Magnus Jodal and contributors"
copyright = f"2010-2022, {author}"
copyright = f"2010-2023, {author}" # noqa: A001

release = toml.load("../pyproject.toml")["tool"]["poetry"]["version"]
version = ".".join(release.split(".")[:2])
Expand All @@ -25,6 +25,10 @@

autodoc_member_order = "bysource"

extlinks = {"issue": ("https://github.com/jodal/pykka/issues/%s", "#")}
extlinks = {
"issue": ("https://github.com/jodal/pykka/issues/%s", "#%s"),
}

intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
}
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Pykka is available from PyPI. To install it, run::

pip install pykka

Pykka works with Python 3.7 or newer.
Pykka works with Python 3.8 or newer.


Inpiration
Expand Down Expand Up @@ -73,6 +73,6 @@ Project resources
License
=======

Pykka is copyright 2010-2022 Stein Magnus Jodal and contributors.
Pykka is copyright 2010-2023 Stein Magnus Jodal and contributors.
Pykka is licensed under the
`Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0>`_.
3 changes: 0 additions & 3 deletions docs/requirements.txt

This file was deleted.

4 changes: 2 additions & 2 deletions examples/plain_actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ def __init__(self):
def on_receive(self, message):
if message is GetMessages:
return self.stored_messages
else:
self.stored_messages.append(message)
self.stored_messages.append(message)
return None


if __name__ == "__main__":
Expand Down
6 changes: 3 additions & 3 deletions examples/producer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
from producer import ProducerActor


@pytest.fixture
@pytest.fixture()
def consumer_mock(mocker):
yield mocker.Mock()
return mocker.Mock()


@pytest.fixture
@pytest.fixture()
def producer(consumer_mock):
# Step 1: The actor under test is wired up with
# its dependencies and is started.
Expand Down
3 changes: 1 addition & 2 deletions examples/resolver.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python3

"""
Resolve a bunch of IP addresses using a pool of resolver actors.
"""Resolve a bunch of IP addresses using a pool of resolver actors.
Based on example contributed by Kristian Klette <klette@klette.us>.
Expand Down
111 changes: 92 additions & 19 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,32 @@ classifiers = [
include = ["docs", "examples", "tests"]

[tool.poetry.dependencies]
python = "^3.7.0"
importlib_metadata = { version = ">=1.6", python = "<3.8" }
python = "^3.8.0"

[tool.poetry.group.black.dependencies]
black = "^23.3.0"

[tool.poetry.group.dev.dependencies]
black = "^22.1"
flake8 = "^5.0.4"
flake8-black = "^0.3.3"
flake8-bugbear = "^22.9.23"
flake8-isort = "^4.2.0"
flake8-pyi = "^22.8.2"
isort = "^5.9.2"
tox = "^4.5.2"

[tool.poetry.group.docs.dependencies]
sphinx = "^6.2.1"
sphinx_rtd_theme = "^1.2.1"
toml = "^0.10.2"

[tool.poetry.group.mypy.dependencies]
mypy = "^0.971"

[tool.poetry.group.ruff.dependencies]
ruff = "^0.0.270"

[tool.poetry.group.tests.dependencies]
pytest = "^7.0.0"
pytest-cov = "^3.0.0"
pytest-mock = "^3.6.1"
tox = "^3.23.1"

[tool.black]
target-version = ["py37", "py38", "py39", "py310", "py311"]

[tool.isort]
profile = "black"
target-version = ["py38", "py39", "py310", "py311"]

[tool.mypy]
no_implicit_optional = true
Expand All @@ -53,12 +57,81 @@ warn_unused_configs = true
module = "pykka.*"
disallow_untyped_defs = true

[[tool.mypy.overrides]]
module = [
"importlib.*", # importlib types are missing when running mypy on Python 3.7
"pytest.*",
[tool.ruff]
select = [
"A", # flake8-builtins
# "ANN", # flake8-annotations # TODO: Enable when annotations are merged into .py files
"ARG", # flake8-unused-arguments
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"C90", # mccabe
"D", # pydocstyle
"DTZ", # flake8-datetimez
"E", # pycodestyle
"ERA", # eradicate
"F", # pyflakes
"FBT", # flake8-boolean-trap
"I", # isort
"INP", # flake8-no-pep420
"ISC", # flake8-implicit-str-concat
"N", # pep8-naming
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PLC", # pylint convention
"PLE", # pylint error
"PLR", # pylint refactor
"PLW", # pylint warning
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"Q", # flake8-quotes
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # ruff
"SIM", # flake8-simplify
"SLF", # flake8-self
"T20", # flake8-print
"TCH", # flake8-type-checking
"TID", # flake8-tidy-imports
"TRY", # tryceratops
"UP", # pyupgrade
"W", # pycodestyle
]
ignore_missing_imports = true
ignore = [
"A003", # builtin-attribute-shadowing
"ANN101", # missing-type-self
"ANN102", # missing-type-cls
"D203", # one-blank-line-before-class
"D213", # multi-line-summary-second-line
"FBT", # boolean-trap # FIXME Make keywords only in 4.0
"PLR2004", # magic-value-comparison
"RET504", # unnecessary-assign
"TRY003", # raise-vanilla-args
#
# Equivalent to `pyupgrade --keep-runtime-typing`:
"UP006", # deprecated-collection-type
"UP007", # typing-union
]
target-version = "py38"

[tool.ruff.per-file-ignores]
"docs/*" = [
"D", # pydocstyle
"INP001", # flake8-no-pep420
]
"examples/*" = [
"D", # pydocstyle
"INP001", # flake8-no-pep420
"T20", # flake8-print
]
"tests/*" = [
"ANN", # flake8-annotations
"ARG", # flake8-unused-arguments
"D", # pydocstyle
"TRY002", # raise-vanilla-class
]

[tool.ruff.isort]
known-first-party = ["pykka"]

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
37 changes: 0 additions & 37 deletions setup.cfg

This file was deleted.

8 changes: 3 additions & 5 deletions src/pykka/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
"""Pykka is a Python implementation of the actor model."""

import importlib.metadata as _importlib_metadata
import logging as _logging

from pykka._exceptions import ActorDeadError, Timeout
Expand All @@ -10,11 +13,6 @@
from pykka._actor import Actor # isort:skip
from pykka._threading import ThreadingActor, ThreadingFuture # isort:skip

try:
import importlib.metadata as _importlib_metadata
except ImportError:
import importlib_metadata as _importlib_metadata # type: ignore


__all__ = [
"Actor",
Expand Down

0 comments on commit d3d7090

Please sign in to comment.