FindImports
===========
FindImports extracts Python module dependencies by parsing source files.
It can report names that are imported but not used, and it can generate
module import graphs in ASCII or graphviz formats.
A distinguishing feature of findimports used to be that it could parse doctest
code inside docstrings.
Note that not all cases are handled correctly, especially if you use
'import foo.bar.baz'.
If you need to find unused imports in your codebase, I recommend Pyflakes_
instead -- it's better maintained and more reliable. For import graphs
consider pydeps_.
.. _Pyflakes: https://pypi.org/project/pyflakes/
.. _pydeps: https://pypi.org/project/pydeps/
Misc
----
Home page: https://github.com/mgedmin/findimports
Licence: MIT (https://mit-license.org/)
|buildstatus|_ |appveyor|_ |coverage|_
.. |buildstatus| image:: https://github.com/mgedmin/findimports/workflows/build/badge.svg?branch=master
.. _buildstatus: https://github.com/mgedmin/findimports/actions
.. |appveyor| image:: https://ci.appveyor.com/api/projects/status/github/mgedmin/findimports?branch=master&svg=true
.. _appveyor: https://ci.appveyor.com/project/mgedmin/findimports
.. |coverage| image:: https://coveralls.io/repos/mgedmin/findimports/badge.svg?branch=master
.. _coverage: https://coveralls.io/r/mgedmin/findimports
Changes
=======
2.5.2 (2024-11-27)
------------------
- Bugfix: findimports was treating all imports as relative, just like in the
good old Python 2 days. Oops.
- When reporting that it couldn't find the source for an imported module,
findimports will now mention the line number that contained the import
statement.
2.5.1 (2024-10-09)
------------------
- Add support for Python 3.13.
2.5.0 (2024-05-30)
------------------
- Fixed extension module detection that never worked on Python 3. See `pull
request 29 <https://github.com/mgedmin/findimports/pull/29>`_.
- Add ``--attr``/``-A`` to add arbitrary graphviz `graph attributes
<https://graphviz.org/docs/graph/>`_ to the output. See `pull
request 30 <https://github.com/mgedmin/findimports/pull/30>`_.
2.4.0 (2024-02-01)
------------------
- Add support for Python 3.12.
- Change license from GPL to MIT. See `issue 27
<https://github.com/mgedmin/findimports/issues/27>`_.
- Add ``--package-externals``/``-pE`` to simplify the module graph.
- Add ``--rmprefix PREFIX``/``-R PREFIX`` to remove a package prefix from
displayed names.
- Add ``--depth N``/``-D N`` to ignore import statements nested too deep in the
syntax tree (e.g. in functions or if statements).
2.3.0 (2022-10-27)
------------------
- Rewrote command-line parsing to use argparse. Options that select an action
(``--imports``/``--dot``/``--names``/``--unused``) now conflict instead of
all but the last one being ignored. See `pull request #20
<https://github.com/mgedmin/findimports/pull/20>`_.
- Add support for Python 3.11.
- Drop support for Python 3.6.
2.2.0 (2021-12-16)
------------------
- Add support for Python 3.10.
- Add ``--ignore-stdlib`` flag to ignore modules from the Python standard
library.
2.1.0 (2021-05-16)
------------------
- Add ``--ignore`` flag to ignore files and directories, it can be used multiple
times. See `pull request #14 <https://github.com/mgedmin/findimports/pull/14>`_.
2.0.0 (2021-05-09)
------------------
- Add support for Python 3.9.
- Drop support for Python 3.5 and 2.7.
- Fix a bug where the encoding of Python files was not determined in the
same way as by Python itself. See `issue 15
<https://github.com/mgedmin/findimports/issues/15>`_. This requires
the use of ``tokenize.open`` which is not in Python 2.7.
1.5.2 (2019-10-31)
------------------
- Add support for Python 3.8.
- Fix a bug where a package/module with a name that is a prefix of another
package/module might accidentally be used instead of the other one (e.g. py
instead of pylab). See `issue 10
<https://github.com/mgedmin/findimports/issues/10>`_.
1.5.1 (2019-04-23)
------------------
- Drop support for Python 3.4.
1.5.0 (2019-03-18)
------------------
- Support Python 3.6 and 3.7.
- Drop support for Python 2.6 and 3.3.
- Suppress duplicate import warnings if the line in question has a comment.
1.4.1 (2016-09-28)
------------------
- Replace ``getopt`` with ``optparse``. This changes the ``--help``
message as a side effect (`#4
<https://github.com/mgedmin/findimports/issues/4>`_).
1.4.0 (2015-06-04)
------------------
- Python 3 support (3.3 and newer).
- Use ``ast`` instead of ``compiler`` (`#1
<https://github.com/mgedmin/findimports/issues/1>`_).
1.3.2 (2015-04-13)
------------------
- Fix "cannot find datetime" on Ubuntu 14.04 LTS (`#3
<https://github.com/mgedmin/findimports/issues/3>`_).
- 100% test coverage.
1.3.1 (2014-04-16)
------------------
- Added support for relative imports (e.g. ``from .. import foo``).
1.3.0 (2013-04-10)
------------------
- Moved to Github.
- Drop Python 2.4 and 2.5 support.
- Handle unicode docstrings with doctests.
1.2.14 (2012-02-12)
-------------------
- Recognize builtin modules using ``sys.builtin_module_names``.
Fixes https://bugs.launchpad.net/findimports/+bug/880989.
1.2.13 (2011-04-18)
-------------------
- Suppress "not a zipfile" warnings about ``*.egg-info`` files listed in
sys.path.
1.2.12 (2011-04-08)
-------------------
- Handle zipfile errors when there are plain files that are not zip files
on sys.path.
1.2.11 (2011-03-30)
-------------------
- Fix 'could not find cPickle' errors on Python 2.6 and newer.
1.2.10 (2010-02-05)
-------------------
- Ignore 'from __future__ import ...'.
1.2.9 (2009-07-07)
------------------
- Fixed broken and uninstallable source distribution by adding a MANIFEST.in.
1.2.8 (2009-07-07)
------------------
- Is able to find modules inside zip files (e.g. eggs).
- Fixed deprecation warning on Python 2.6.
Raw data
{
"_id": null,
"home_page": "https://github.com/mgedmin/findimports",
"name": "findimports",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": "Marius Gedminas",
"author_email": "marius@gedmin.as",
"download_url": "https://files.pythonhosted.org/packages/a2/ba/534c1445931e6f64980898e07cfb97e4fdcfeefdbdfd58eb7f4ebe495ad4/findimports-2.5.2.tar.gz",
"platform": null,
"description": "FindImports\n===========\n\nFindImports extracts Python module dependencies by parsing source files.\nIt can report names that are imported but not used, and it can generate\nmodule import graphs in ASCII or graphviz formats.\n\nA distinguishing feature of findimports used to be that it could parse doctest\ncode inside docstrings.\n\nNote that not all cases are handled correctly, especially if you use\n'import foo.bar.baz'.\n\nIf you need to find unused imports in your codebase, I recommend Pyflakes_\ninstead -- it's better maintained and more reliable. For import graphs\nconsider pydeps_.\n\n.. _Pyflakes: https://pypi.org/project/pyflakes/\n.. _pydeps: https://pypi.org/project/pydeps/\n\n\nMisc\n----\n\nHome page: https://github.com/mgedmin/findimports\n\nLicence: MIT (https://mit-license.org/)\n\n|buildstatus|_ |appveyor|_ |coverage|_\n\n.. |buildstatus| image:: https://github.com/mgedmin/findimports/workflows/build/badge.svg?branch=master\n.. _buildstatus: https://github.com/mgedmin/findimports/actions\n\n.. |appveyor| image:: https://ci.appveyor.com/api/projects/status/github/mgedmin/findimports?branch=master&svg=true\n.. _appveyor: https://ci.appveyor.com/project/mgedmin/findimports\n\n.. |coverage| image:: https://coveralls.io/repos/mgedmin/findimports/badge.svg?branch=master\n.. _coverage: https://coveralls.io/r/mgedmin/findimports\n\n\nChanges\n=======\n\n\n2.5.2 (2024-11-27)\n------------------\n\n- Bugfix: findimports was treating all imports as relative, just like in the\n good old Python 2 days. Oops.\n\n- When reporting that it couldn't find the source for an imported module,\n findimports will now mention the line number that contained the import\n statement.\n\n\n2.5.1 (2024-10-09)\n------------------\n\n- Add support for Python 3.13.\n\n\n2.5.0 (2024-05-30)\n------------------\n\n- Fixed extension module detection that never worked on Python 3. See `pull\n request 29 <https://github.com/mgedmin/findimports/pull/29>`_.\n\n- Add ``--attr``/``-A`` to add arbitrary graphviz `graph attributes\n <https://graphviz.org/docs/graph/>`_ to the output. See `pull\n request 30 <https://github.com/mgedmin/findimports/pull/30>`_.\n\n\n2.4.0 (2024-02-01)\n------------------\n\n- Add support for Python 3.12.\n\n- Change license from GPL to MIT. See `issue 27\n <https://github.com/mgedmin/findimports/issues/27>`_.\n\n- Add ``--package-externals``/``-pE`` to simplify the module graph.\n\n- Add ``--rmprefix PREFIX``/``-R PREFIX`` to remove a package prefix from\n displayed names.\n\n- Add ``--depth N``/``-D N`` to ignore import statements nested too deep in the\n syntax tree (e.g. in functions or if statements).\n\n\n2.3.0 (2022-10-27)\n------------------\n\n- Rewrote command-line parsing to use argparse. Options that select an action\n (``--imports``/``--dot``/``--names``/``--unused``) now conflict instead of\n all but the last one being ignored. See `pull request #20\n <https://github.com/mgedmin/findimports/pull/20>`_.\n\n- Add support for Python 3.11.\n\n- Drop support for Python 3.6.\n\n\n2.2.0 (2021-12-16)\n------------------\n\n- Add support for Python 3.10.\n\n- Add ``--ignore-stdlib`` flag to ignore modules from the Python standard\n library.\n\n\n2.1.0 (2021-05-16)\n------------------\n\n- Add ``--ignore`` flag to ignore files and directories, it can be used multiple\n times. See `pull request #14 <https://github.com/mgedmin/findimports/pull/14>`_.\n\n\n2.0.0 (2021-05-09)\n------------------\n\n- Add support for Python 3.9.\n\n- Drop support for Python 3.5 and 2.7.\n\n- Fix a bug where the encoding of Python files was not determined in the\n same way as by Python itself. See `issue 15\n <https://github.com/mgedmin/findimports/issues/15>`_. This requires\n the use of ``tokenize.open`` which is not in Python 2.7.\n\n\n1.5.2 (2019-10-31)\n------------------\n\n- Add support for Python 3.8.\n\n- Fix a bug where a package/module with a name that is a prefix of another\n package/module might accidentally be used instead of the other one (e.g. py\n instead of pylab). See `issue 10\n <https://github.com/mgedmin/findimports/issues/10>`_.\n\n\n1.5.1 (2019-04-23)\n------------------\n\n- Drop support for Python 3.4.\n\n\n1.5.0 (2019-03-18)\n------------------\n\n- Support Python 3.6 and 3.7.\n\n- Drop support for Python 2.6 and 3.3.\n\n- Suppress duplicate import warnings if the line in question has a comment.\n\n\n1.4.1 (2016-09-28)\n------------------\n\n- Replace ``getopt`` with ``optparse``. This changes the ``--help``\n message as a side effect (`#4\n <https://github.com/mgedmin/findimports/issues/4>`_).\n\n\n1.4.0 (2015-06-04)\n------------------\n\n- Python 3 support (3.3 and newer).\n\n- Use ``ast`` instead of ``compiler`` (`#1\n <https://github.com/mgedmin/findimports/issues/1>`_).\n\n\n1.3.2 (2015-04-13)\n------------------\n\n- Fix \"cannot find datetime\" on Ubuntu 14.04 LTS (`#3\n <https://github.com/mgedmin/findimports/issues/3>`_).\n\n- 100% test coverage.\n\n\n1.3.1 (2014-04-16)\n------------------\n\n- Added support for relative imports (e.g. ``from .. import foo``).\n\n\n1.3.0 (2013-04-10)\n------------------\n\n- Moved to Github.\n\n- Drop Python 2.4 and 2.5 support.\n\n- Handle unicode docstrings with doctests.\n\n\n1.2.14 (2012-02-12)\n-------------------\n\n- Recognize builtin modules using ``sys.builtin_module_names``.\n Fixes https://bugs.launchpad.net/findimports/+bug/880989.\n\n\n1.2.13 (2011-04-18)\n-------------------\n\n- Suppress \"not a zipfile\" warnings about ``*.egg-info`` files listed in\n sys.path.\n\n\n1.2.12 (2011-04-08)\n-------------------\n\n- Handle zipfile errors when there are plain files that are not zip files\n on sys.path.\n\n\n1.2.11 (2011-03-30)\n-------------------\n\n- Fix 'could not find cPickle' errors on Python 2.6 and newer.\n\n\n1.2.10 (2010-02-05)\n-------------------\n\n- Ignore 'from __future__ import ...'.\n\n\n1.2.9 (2009-07-07)\n------------------\n\n- Fixed broken and uninstallable source distribution by adding a MANIFEST.in.\n\n\n1.2.8 (2009-07-07)\n------------------\n\n- Is able to find modules inside zip files (e.g. eggs).\n\n- Fixed deprecation warning on Python 2.6.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python module import analysis tool",
"version": "2.5.2",
"project_urls": {
"Homepage": "https://github.com/mgedmin/findimports"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "51733f8f83980592464521a9c16345803d21313563906124eaa69c4bd4fc3185",
"md5": "d766c0cb5cd87ba610b5ff31100ecef2",
"sha256": "538e1794fbb286b3886a2c40dda213cab405a52e63c271f64b8913427dade0bf"
},
"downloads": -1,
"filename": "findimports-2.5.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d766c0cb5cd87ba610b5ff31100ecef2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 16284,
"upload_time": "2024-11-27T12:49:13",
"upload_time_iso_8601": "2024-11-27T12:49:13.448343Z",
"url": "https://files.pythonhosted.org/packages/51/73/3f8f83980592464521a9c16345803d21313563906124eaa69c4bd4fc3185/findimports-2.5.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a2ba534c1445931e6f64980898e07cfb97e4fdcfeefdbdfd58eb7f4ebe495ad4",
"md5": "0e2553e4727e50dc4ee9b2242824952e",
"sha256": "d4532cb9714e7772854f941b1cdb09cb5d377838b0f6f926940097778bcf818e"
},
"downloads": -1,
"filename": "findimports-2.5.2.tar.gz",
"has_sig": false,
"md5_digest": "0e2553e4727e50dc4ee9b2242824952e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 29252,
"upload_time": "2024-11-27T12:49:14",
"upload_time_iso_8601": "2024-11-27T12:49:14.821737Z",
"url": "https://files.pythonhosted.org/packages/a2/ba/534c1445931e6f64980898e07cfb97e4fdcfeefdbdfd58eb7f4ebe495ad4/findimports-2.5.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-27 12:49:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mgedmin",
"github_project": "findimports",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"appveyor": true,
"tox": true,
"lcname": "findimports"
}