Skip to content

Commit

Permalink
Support Python 3.13, drop support for Python 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
fizyk committed Oct 11, 2024
1 parent a6935de commit 45c711a
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ jobs:
uses: actions/checkout@v4
- uses: fizyk/actions-reuse/.github/actions/[email protected]
with:
python-version: "3.12"
python-version: "3.13"
command: tbump --dry-run --only-patch $(pipenv run tbump current-version)"-x"
towncrier:
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
- uses: fizyk/actions-reuse/.github/actions/[email protected]
with:
python-version: "3.12"
python-version: "3.13"
command: towncrier check --compare-with origin/main
fetch-depth: 0
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ jobs:
tests:
uses: fizyk/actions-reuse/.github/workflows/[email protected]
with:
python-versions: '["3.8", "3.9", "3.10", "3.11", "3.12", "pypy-3.10"]'
python-versions: '["3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.10"]'
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
macostests:
uses: fizyk/actions-reuse/.github/workflows/[email protected]
needs: [tests]
with:
python-versions: '["3.10", "3.11", "3.12", "pypy-3.10"]'
python-versions: '["3.11", "3.12", "3.13", "pypy-3.10"]'
os: macos-latest
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions newsfragments/+0e5f4193.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added support for Python 3.13
1 change: 1 addition & 0 deletions newsfragments/+f5d4730a.break.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Dropped support for Python 3.8 (As it reached EOL)
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"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",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Software Development :: Libraries :: Python Modules",
]
Expand All @@ -30,7 +30,7 @@ dependencies = [
# <https://github.com/giampaolo/psutil/issues/82>.
"psutil>=4.0.0; sys_platform != 'cygwin'",
]
requires-python = ">= 3.8"
requires-python = ">= 3.9"

[project.urls]
"Source" = "https://github.com/ClearcodeHQ/mirakuru"
Expand Down Expand Up @@ -86,7 +86,7 @@ xfail_strict = "True"

[tool.black]
line-length = 80
target-version = ['py38']
target-version = ['py39']
include = '.*\.pyi?$'

[tool.ruff]
Expand Down
7 changes: 2 additions & 5 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,5 @@


def ps_aux() -> str:
"""Return output of systems `ps aux -w` call.
:rtype str
"""
return str(check_output(("ps", "aux", "-w")))
"""Return output of systems `ps aux -w` call."""
return check_output(("ps", "aux", "-w")).decode()
9 changes: 6 additions & 3 deletions tests/executors/test_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,22 @@ def test_forgotten_stop() -> None:
If someone forgot to stop() or kill() subprocess it should be killed
by default on instance cleanup.
"""
mark = str(uuid.uuid1())
mark = uuid.uuid1().hex
# We cannot simply do `sleep 300 #<our-uuid>` in a shell because in that
# case bash (default shell on some systems) does `execve` without cloning
# itself - that means there will be no process with commandline like:
# '/bin/sh -c sleep 300 && true #<our-uuid>' - instead that process would
# get substituted with 'sleep 300' and the marked commandline would be
# overwritten.
# Injecting some flow control (`&&`) forces bash to fork properly.
marked_command = f"sleep 300 && true #{mark!s}"
marked_command = f"sleep 300 && true #{mark}"
executor = SimpleExecutor(marked_command, shell=True)
executor.start()
assert executor.running() is True
assert mark in ps_aux(), "The test process should be running."
ps_output = ps_aux()
assert (
mark in ps_output
), f"The test command {marked_command} should be running in \n\n {ps_output}."
del executor
gc.collect() # to force 'del' immediate effect
assert (
Expand Down
7 changes: 4 additions & 3 deletions tests/executors/test_executor_kill.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ def raise_os_error(*_: int, **__: int) -> NoReturn:
def processes_with_env_mock(*_: str, **__: str) -> Set[int]:
return {1}

with patch(
"mirakuru.base.processes_with_env", new=processes_with_env_mock
), patch("os.kill", new=raise_os_error):
with (
patch("mirakuru.base.processes_with_env", new=processes_with_env_mock),
patch("os.kill", new=raise_os_error),
):
executor = SimpleExecutor(SLEEP_300)
executor._kill_all_kids(executor._stop_signal)

0 comments on commit 45c711a

Please sign in to comment.