.. _useless-import-alias:

useless-import-alias / C0414
============================

**Message emitted:**

Import alias does not rename original package

**Description:**

*Used when an import alias is same as original package, e.g., using import numpy as numpy instead of import numpy as np.*

**Problematic code:**

.. literalinclude:: /data/messages/u/useless-import-alias/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/u/useless-import-alias/good.py
   :language: python

**Additional details:**

Known issue
-----------

If you prefer to use "from-as" to explicitly reexport in API (`from fruit import orange as orange`)
instead of using `__all__` this message will be a false positive.

If that's the case use `pylint: disable=useless-import-alias` before your imports in your API files.
`False positive 'useless-import-alias' error for mypy-compatible explicit re-exports #6006 <https://github.com/PyCQA/pylint/issues/6006>`_

**Related links:**

- `PEP 8, Import Guideline <https://peps.python.org/pep-0008/#imports>`_
- :ref:`Pylint block-disable <block_disables>`
- `mypy --no-implicit-reexport <https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-no-implicit-reexport>`_

Created by the `imports <https://github.com/PyCQA/pylint/blob/main/pylint/checkers/imports.py>`__ checker.