Skip to content

Commit

Permalink
Merge pull request #280 from clumio-oss/release/4.0.0
Browse files Browse the repository at this point in the history
Release/4.0.0
  • Loading branch information
sodul committed Jan 16, 2024
2 parents 186a6db + bc6b69c commit b4a8e40
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 82 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ jobs:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: [
"3.8", "3.9", "3.10", "3.11", "3.12.0",
"pypy3.8", "pypy3.9", "pypy3.10"
]
fail-fast: false

steps:
Expand Down
15 changes: 10 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@
#### Date TBD

# Version 4.0.0
#### 12 Jan 2024
#### 16 Jan 2024

The biggest change in this release is the addition of support for new Python versions up through 3.12, and the dropping of support for Python < 3.8, including Python 2 entirely.

- Fix an error and warnings that occur with Python 3.12. Contributed by [`@sodul`](https://github.com/sodul) in [#272], [#274], and [#275].
- Add setup.cfg and pyproject.toml to support the setup.py deprecation in pip 23.
- Lift minimum supported Python version from 3.5 to 3.8.
There is a breaking in change in Python 3.12.1 which causes Green to break on skipped tests.
The workaround is to use Python 3.12.0 or to comment out unittests that use `@unittest.skipIf(...)` annotation.
We will release a fix for this in the next version of Green.

- Fix an error and warnings that occur with Python 3.12. Contributed by [`@sodul`](https://github.com/sodul) in [#272], [#274], and [#275]
- Add setup.cfg and pyproject.toml to support the setup.py deprecation in pip 23
- Lift minimum supported Python version from 3.5 to 3.8
- CI Improvements:
- Add 3.12 to the CI Action
- Add button to run CI checks manually
- Add 15 minute timeout to CI checks
- Add 15 minutes timeout to CI checks
- Update CI to pip install green in developer mode
- Add `mypy` linting & fix lint warnings
- Use `pyupgrade` to modernize code
Expand All @@ -21,6 +25,7 @@ The biggest change in this release is the addition of support for new Python ver
- Move `setup.py` logic into `setup.cfg`
- README cleanup
- Fixes for newer versions of coverage
- New maintainer: @sodul.


[#272]: https://github.com/CleanCut/green/issues/272
Expand Down
71 changes: 3 additions & 68 deletions green/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def ddebug(msg, err=None): # pragma: no cover
class ProcessLogger:
"""
I am used by LoggingDaemonlessPool to get crash output out to the logger,
instead of having process crashes be silent
instead of having process crashes be silent.
"""

def __init__(self, callable):
Expand All @@ -59,71 +59,10 @@ def __call__(self, *args, **kwargs):
return result


# -------------------------------------------------------------------------
# I started with code from cpython/Lib/multiprocessing/pool.py from version
# 3.5.0a4+ of the main python mercurial repository. Then altered it to run
# on 2.7+ and added the finalizer/finalargs parameter handling. This approach
# worked until we hit Python 3.8, when it broke.
class LoggingDaemonlessPool37(Pool): # pragma: no cover
class LoggingDaemonlessPool(Pool):
"""
I make a pool of workers which can get crash output to the logger, run processes not as daemons,
and which run finalizers...in a way which works on Python 2.7 to 3.7, inclusive.
"""

@staticmethod
def Process(*args, **kwargs):
kwargs["daemon"] = False
return multiprocessing.Process(*args, **kwargs)

def apply_async(self, func, args=(), kwds={}, callback=None):
return Pool.apply_async(self, ProcessLogger(func), args, kwds, callback)

_wrap_exception = True

def __init__(
self,
processes=None,
initializer=None,
initargs=(),
maxtasksperchild=None,
context=None,
finalizer=None,
finalargs=(),
):
self._finalizer = finalizer
self._finalargs = finalargs
super().__init__(processes, initializer, initargs, maxtasksperchild)

def _repopulate_pool(self):
"""
Bring the number of pool processes up to the specified number, for use
after reaping workers which have exited.
"""
for i in range(self._processes - len(self._pool)):
w = self.Process(
target=worker,
args=(
self._inqueue,
self._outqueue,
self._initializer,
self._initargs,
self._maxtasksperchild,
self._wrap_exception,
self._finalizer,
self._finalargs,
),
)
self._pool.append(w)
w.name = w.name.replace("Process", "PoolWorker")
w.start()
util.debug("added worker")


class LoggingDaemonlessPool38(Pool):
"""
I make a pool of workers which can get crash output to the logger, run processes not as daemons,
and which run finalizers...in a way which works on Python 3.8+.
and which run finalizers.
"""

@staticmethod
Expand Down Expand Up @@ -208,10 +147,6 @@ def _repopulate_pool_static(
util.debug("added worker")


LoggingDaemonlessPool = LoggingDaemonlessPool38
if tuple(map(int, platform.python_version_tuple()[:2])) < (3, 8): # pragma: no cover
LoggingDaemonlessPool = LoggingDaemonlessPool37 # type: ignore


import multiprocessing.pool
from multiprocessing import util # type: ignore
Expand Down
8 changes: 1 addition & 7 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,7 @@ test_suite='green.test'

[options]
python_requires = >=3.8
# The file:requirements.txt syntax is not compatible until Python 3.7.
# install_requires = file:requirements.txt
install_requires =
colorama
coverage
lxml
unidecode
install_requires = file:requirements.txt
include_package_data = True
packages = find:

Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# setup.py file for cleancut/green.
#
# setuptools versions older than 64.0.0 need a minimal setup.py file.
# Versions 39.2.0 of setuptools should be compatible with python 3.5.
#

from setuptools import setup
Expand Down

0 comments on commit b4a8e40

Please sign in to comment.