Skip to content

Commit

Permalink
Merge pull request #4580 from Avasam/no-ABCMeta
Browse files Browse the repository at this point in the history
Remove `ABCMeta` metaclass, keep `abstractmethod`s
  • Loading branch information
jaraco authored Aug 20, 2024
2 parents 477f713 + b7ee00d commit 18963fb
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
1 change: 1 addition & 0 deletions newsfragments/4579.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove `abc.ABCMeta` metaclass from abstract classes. `pypa/setuptools#4503 <https://github.com/pypa/setuptools/pull/4503>`_ had an unintended consequence of causing potential ``TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases`` -- by :user:`Avasam`
3 changes: 1 addition & 2 deletions pkg_resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from __future__ import annotations

import sys
from abc import ABC

if sys.version_info < (3, 8): # noqa: UP036 # Check for unsupported versions
raise RuntimeError("Python 3.8 or later is required")
Expand Down Expand Up @@ -306,7 +305,7 @@ def get_supported_platform():
]


class ResolutionError(Exception, ABC):
class ResolutionError(Exception):
"""Abstract base for dependency resolution errors"""

def __repr__(self):
Expand Down
4 changes: 2 additions & 2 deletions setuptools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os
import re
import sys
from abc import ABC, abstractmethod
from abc import abstractmethod
from typing import TYPE_CHECKING, TypeVar, overload

sys.path.extend(((vendor_path := os.path.join(os.path.dirname(os.path.dirname(__file__)), 'setuptools', '_vendor')) not in sys.path) * [vendor_path]) # fmt: skip
Expand Down Expand Up @@ -120,7 +120,7 @@ def setup(**attrs):
_Command = monkey.get_unpatched(distutils.core.Command)


class Command(_Command, ABC):
class Command(_Command):
"""
Setuptools internal actions are organized using a *command design pattern*.
This means that each action (or group of closely related actions) executed during
Expand Down
3 changes: 1 addition & 2 deletions setuptools/command/setopt.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import configparser
import os
from abc import ABC

from .. import Command
from ..unicode_utils import _cfg_read_utf8_with_fallback
Expand Down Expand Up @@ -70,7 +69,7 @@ def edit_config(filename, settings, dry_run=False):
opts.write(f)


class option_base(Command, ABC):
class option_base(Command):
"""Abstract base class for commands that mess with config files"""

user_options = [
Expand Down
3 changes: 1 addition & 2 deletions setuptools/sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import sys
import tempfile
import textwrap
from abc import ABC

import pkg_resources
from pkg_resources import working_set
Expand Down Expand Up @@ -263,7 +262,7 @@ def run_setup(setup_script, args):
# Normal exit, just return


class AbstractSandbox(ABC):
class AbstractSandbox:
"""Wrap 'os' module and 'open()' builtin for virtualizing setup scripts"""

_active = False
Expand Down

0 comments on commit 18963fb

Please sign in to comment.