As mentioned by other here:

Interfaces are not necessary in Python. This is because Python has proper multiple inheritance, and also ducktyping, which means that the places where you must have interfaces in Java, you don't have to have them in Python.

That said, there are still several uses for interfaces. Some of them are covered by Pythons Abstract Base Classes, introduced in Python 2.6. They are useful, if you want to make base classes that cannot be instantiated, but provide a specific interface or part of an implementation.

Another usage is if you somehow want to specify that an object implements a specific interface, and you can use ABC's for that too by subclassing from them. Another way is zope.interface, a module that is a part of the Zope Component Architecture, a really awesomely cool component framework. Here you don't subclass from the interfaces, but instead mark classes (or even instances) as implementing an interface. This can also be used to look up components from a component registry. Supercool!

Answer from Lennart Regebro on Stack Overflow
🌐
Real Python
realpython.com › python-interface
Implementing an Interface in Python – Real Python
February 21, 2024 - Once you’ve imported the abc module, you can directly register a virtual subclass by using the .register() metamethod. In the next example, you register the interface Double as a virtual base class of the built-in __float__ class:
Top answer
1 of 8
272

As mentioned by other here:

Interfaces are not necessary in Python. This is because Python has proper multiple inheritance, and also ducktyping, which means that the places where you must have interfaces in Java, you don't have to have them in Python.

That said, there are still several uses for interfaces. Some of them are covered by Pythons Abstract Base Classes, introduced in Python 2.6. They are useful, if you want to make base classes that cannot be instantiated, but provide a specific interface or part of an implementation.

Another usage is if you somehow want to specify that an object implements a specific interface, and you can use ABC's for that too by subclassing from them. Another way is zope.interface, a module that is a part of the Zope Component Architecture, a really awesomely cool component framework. Here you don't subclass from the interfaces, but instead mark classes (or even instances) as implementing an interface. This can also be used to look up components from a component registry. Supercool!

2 of 8
239

Implementing interfaces with abstract base classes is much simpler in modern Python 3 and they serve a purpose as an interface contract for plug-in extensions.

Create the interface/abstract base class:

from abc import ABC, abstractmethod

class AccountingSystem(ABC):

    @abstractmethod
    def create_purchase_invoice(self, purchase):
        pass

    @abstractmethod
    def create_sale_invoice(self, sale):
        log.debug('Creating sale invoice', sale)

Create a normal subclass and override all abstract methods:

class GizmoAccountingSystem(AccountingSystem):

    def create_purchase_invoice(self, purchase):
        submit_to_gizmo_purchase_service(purchase)

    def create_sale_invoice(self, sale):
        super().create_sale_invoice(sale)
        submit_to_gizmo_sale_service(sale)

You can optionally have common implementation in the abstract methods as in create_sale_invoice(), calling it with super() explicitly in the subclass as above.

Instantiation of a subclass that does not implement all the abstract methods fails:

class IncompleteAccountingSystem(AccountingSystem):
    pass

>>> accounting = IncompleteAccountingSystem()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Can't instantiate abstract class IncompleteAccountingSystem with abstract methods
create_purchase_invoice, create_sale_invoice

You can also have abstract properties, static and class methods by combining corresponding annotations with @abstractmethod.

Abstract base classes are great for implementing plugin-based systems. All imported subclasses of a class are accessible via __subclasses__(), so if you load all classes from a plugin directory with importlib.import_module() and if they subclass the base class, you have direct access to them via __subclasses__() and you can be sure that the interface contract is enforced for all of them during instantiation.

Here's the plugin loading implementation for the AccountingSystem example above:

...
from importlib import import_module

class AccountingSystem(ABC):

    ...
    _instance = None

    @classmethod
    def instance(cls):
        if not cls._instance:
            module_name = settings.ACCOUNTING_SYSTEM_MODULE_NAME
            import_module(module_name)
            subclasses = cls.__subclasses__()
            if len(subclasses) > 1:
                raise InvalidAccountingSystemError('More than one '
                        f'accounting module: {subclasses}')
            if not subclasses or module_name not in str(subclasses[0]):
                raise InvalidAccountingSystemError('Accounting module '
                        f'{module_name} does not exist or does not '
                        'subclass AccountingSystem')
            cls._instance = subclasses[0]()
        return cls._instance

Then you can access the accounting system plugin object through the AccountingSystem class:

>>> accountingsystem = AccountingSystem.instance()

(Inspired by this PyMOTW-3 post.)

🌐
PyPI
pypi.org › project › python-interface
python-interface
JavaScript is disabled in your browser. Please enable JavaScript to proceed · A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-interface-module
Python-interface module - GeeksforGeeks
March 26, 2020 - In python, interface is defined using python class statements and is a subclass of interface.Interface which is the parent interface for all interfaces. Syntax : class IMyInterface(zope.interface.Interface): # methods and attributes Example ...
🌐
Python Guides
pythonguides.com › python-interface
Understand Python Interfaces
December 1, 2025 - While Python does not have a built-in interface keyword like some other languages, it uses the abc module to create abstract base classes that serve as interfaces.
🌐
Tutorialspoint
tutorialspoint.com › python › python_interfaces.htm
Python - Interfaces
In languages like Java and Go, ... have it or any similar keyword. It uses abstract base classes (in short ABC module) and @abstractmethod decorator to create interfaces....
🌐
Readthedocs
python-interface.readthedocs.io
interface — interface 1.4.0 documentation
interface is a library for declaring interfaces and for statically asserting that classes implement those interfaces. It provides stricter semantics than Python’s built-in abc module, and it aims to produce exceptionally useful error messages when interfaces aren’t satisfied.
Find elsewhere
🌐
Python
docs.python.org › 3 › library › os.html
os — Miscellaneous operating system interfaces
Source code: Lib/os.py This module provides a portable way of using operating system dependent functionality. If you just want to read or write a file see open(), if you want to manipulate paths, s...
🌐
Scaler
scaler.com › home › topics › interface in python
Interface in Python - Scaler Topics
June 23, 2024 - They are essential for software engineering and code organization. Interfaces, typically a set of method signatures in object-oriented programming, ensure consistency and manage updates in large applications. While Python uses the abc module, zope.interface offers stricter semantics.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-interface-module
Python-interface module - GeeksforGeeks
March 26, 2020 - In python, interface is defined using python class statements and is a subclass of interface.Interface which is the parent interface for all interfaces. Syntax : class IMyInterface(zope.interface.Interface): # methods and attributes Example ...
🌐
Upgrad
upgrad.com › home › tutorials › software & tech › interface in python
Interface in Python
January 4, 2026 - In Python, interfaces are defined using abstract base classes (ABCs) provided by the ABC module. Abstract base classes serve as a way to declare the methods that must be implemented by classes that inherit from them.
🌐
GitHub
github.com › ssanderson › python-interface
GitHub - ssanderson/python-interface: Minimal Pythonic Interface Definitions
interface is a library for declaring interfaces and for statically asserting that classes implement those interfaces. It aims to provide stricter semantics and better error messages than Python's built-in abc module.
Starred by 112 users
Forked by 17 users
Languages   Python 100.0% | Python 100.0%
🌐
Python documentation
docs.python.org › 3 › tutorial › modules.html
6. Modules — Python 3.14.3 documentation
To support this, Python has a way to put definitions in a file and use them in a script or in an interactive instance of the interpreter. Such a file is called a module; definitions from a module can be imported into other modules or into the main module (the collection of variables that you have access to in a script executed at the top level and in calculator mode).
🌐
Javatpoint
javatpoint.com › interface-in-python
Interface in Python - Javatpoint
Create a Modern login UI using the CustomTkinter Module in Python · Deepchecks Testing Machine Learning Models |Python · Develop Data Visualization Interfaces in Python with Dash · Difference between 'del' and 'pop' in python · Get value from Dictionary by key with get() in Python ·
🌐
Pythia
pythia.org › latest-manual › PythonInterface.html
Python Interface
After configuring the Python interface for PYTHIA to be built and running make as usual, the following files should be generated in the directory lib. ... To ensure that the pythia8.so module is available to Python, the system variable PYTHONPATH should be set similar to
🌐
Reddit
reddit.com › r/python › interfaces in python
r/Python on Reddit: Interfaces in Python
June 26, 2022 - Sometimes you may not even own module b. ... Frequently, when I'm using ABC, I need to perform a string-to-class lookup. For this, I created the library AutoRegistry, which adds a dictionary interface to classes (not objects created from classes!) that is automatically populated with it's children.
🌐
Python GUIs
pythonguis.com › faq › which python gui library should you use?
Which Python GUI library should you use in 2026?
December 23, 2025 - Best all-rounder with batteries included. PyQt and PySide are wrappers around the Qt framework. They allow you to easily create modern interfaces that look right at home on any platform, including Windows, macOS, Linux, and even Android.