Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redo Autoimport #464

Closed
wants to merge 67 commits into from
Closed
Show file tree
Hide file tree
Changes from 56 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
0bab02d
switch to sqllite3
bagel897 Apr 2, 2022
0df9167
use ast
bagel897 Apr 4, 2022
3f2c1a8
refactor to use ProcessPoolExecutor
bagel897 Apr 4, 2022
55de3ae
actually somewhat working implementation
bagel897 Apr 4, 2022
fa945e4
parse __all__
bagel897 Apr 4, 2022
0a20abd
improve parsing of modules with submodules
bagel897 Apr 4, 2022
56460d5
fix resource parsing
bagel897 Apr 4, 2022
b622adc
add package finder and update_module
bagel897 Apr 4, 2022
70e2b99
propogate underlined more
bagel897 Apr 4, 2022
42ef20d
match public api more closely
bagel897 Apr 4, 2022
f57fdbb
migrate to pytest
bagel897 Apr 4, 2022
b49dda1
handle observer module names correctly
bagel897 Apr 4, 2022
3f93257
error propogation
bagel897 Apr 5, 2022
9290528
get name locations
bagel897 Apr 5, 2022
b37fad5
update generate_module_cache to exclude the project
bagel897 Apr 5, 2022
65f0c72
add builtin handling
bagel897 Apr 5, 2022
08e8768
split into multiple files
bagel897 Apr 5, 2022
c0aba3d
make private api public within autoimport
bagel897 Apr 5, 2022
ab11c36
add so parsing
bagel897 Apr 5, 2022
2155385
fix builtin handling
bagel897 Apr 5, 2022
bc21e92
reformat
bagel897 Apr 5, 2022
03585be
fix project location issue
bagel897 Apr 5, 2022
ebfc3b8
update documentation
bagel897 Apr 5, 2022
f719f95
use code block
bagel897 Apr 5, 2022
90a1600
use code block
bagel897 Apr 5, 2022
a9ddf65
improve formatting and change example to Dict
bagel897 Apr 5, 2022
ed12e20
use old testsuite(mostly)
bagel897 Apr 5, 2022
b197ce4
move packages to dedicated database and improve detection of bogus pa…
bagel897 Apr 5, 2022
7e41f57
improve detection of bogus packages
bagel897 Apr 5, 2022
2182bfe
improve detection of bogus packages
bagel897 Apr 5, 2022
f77a63b
fix amend issue
bagel897 Apr 5, 2022
24d0517
Move compiled modules to single thread, add single threaded option
bagel897 Apr 7, 2022
fbc1cd3
propogate underlined, handle directories without __init__, detect com…
bagel897 Apr 7, 2022
ed5876a
update docs on manual sources
bagel897 Apr 7, 2022
056ec2c
reformat with black
bagel897 Apr 7, 2022
73b4d32
Merge branch 'master' into master
bagel897 Apr 7, 2022
2dfa97b
python 3.6 compatibility
bagel897 Apr 7, 2022
c4ce0aa
Merge branch 'master' of github.com:bageljrkhanofemus/rope
bagel897 Apr 7, 2022
92dff73
add some more tests
bagel897 Apr 7, 2022
1dcc8f6
Merge branch 'master' into master
lieryan Apr 8, 2022
1511451
add utils tests
bagel897 Apr 8, 2022
50d8f9e
fix several issues with handling non-python files
bagel897 Apr 9, 2022
5ef7608
add exact_match toggle
bagel897 Apr 9, 2022
c3eaf26
handle python_crun, return module name with search
bagel897 Apr 11, 2022
2a7077f
add lsp search
bagel897 Apr 12, 2022
46252f6
add nametype
bagel897 Apr 12, 2022
54f9dcb
Merge branch 'master' of github.com:bageljrkhanofemus/rope
bagel897 Apr 12, 2022
b793a85
Update workflows to install rope in editable mode
bagel897 Apr 12, 2022
8fe2817
WIP use generators
bagel897 Apr 13, 2022
9e6d956
itemkind infrence for compiled modules
bagel897 Apr 13, 2022
277edf1
add more tuples and use them more
bagel897 Apr 13, 2022
9f09410
WIP on autoimport using namedTuples
bagel897 Apr 13, 2022
780b52b
mostly working threaded implementation
bagel897 Apr 13, 2022
7035b6e
reformat and update tests
bagel897 Apr 13, 2022
30595cd
blacken
bagel897 Apr 13, 2022
292df31
check underlined on submodules
bagel897 Apr 13, 2022
7c4d3c2
fix some typos
bagel897 Apr 14, 2022
dea4f42
fix: basic job set implementation, improve list comprehension of utils
bagel897 Apr 14, 2022
fc8d3d7
hack to make the job_set work
bagel897 Apr 14, 2022
f52695b
fix: don't increment on null job sets
bagel897 Apr 14, 2022
af14440
process imports on __init__.py
bagel897 Apr 14, 2022
77a9e5f
split out search
bagel897 Apr 17, 2022
15b82ad
ignore submodules for vanilla import statements
bagel897 Apr 17, 2022
1bac155
implement search_full with the ability to ignore names already presen…
bagel897 Apr 22, 2022
b952b20
use CREATE INDEX,remove unnessecary checks
bagel897 Apr 22, 2022
49bc66e
use a multithread executor to dramatically speed up indexing of local…
bagel897 Apr 22, 2022
4a99a77
ignore imports which don't belong to the package
bagel897 Apr 27, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip pytest pytest-timeout
python -m pip -e .[dev]
lieryan marked this conversation as resolved.
Show resolved Hide resolved
- name: Test with pytest
run: |
pytest -v
Expand Down
6 changes: 2 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# **Upcoming release**

## XXX

- XXX
## New feature
- #464 Improve autoimport code to use a sqllite3 database, cache all available modules quickly, search for names and produce import statements, sort import statements.

# Release 1.0.0

Expand Down
17 changes: 17 additions & 0 deletions docs/library.rst
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,23 @@ returns the list of modules with the given global name.
``AutoImport.import_assist()`` tries to find the modules that have a
global name that starts with the given prefix.

It uses an sqllite3 database, which can be made persistent by passing memory as false to the constructor.
It must be closed when done with the ```AutoImport.close()``` method.

AutoImport can search for a name from both modules and statements you can import from them.

.. code-block:: python

from rope.base.project import Project
from rope.contrib.autoimport import AutoImport

project = Project("/path/to/project")
autoimport = AutoImport(project, memory=False)
autoimport.generate_resource_cache() # Generates a cache of the local modules, from the project you're working on
autoimport.generate_modules_cache() # Generates a cache of external modules
print(autoimport.search("Dict"))
autoimport.close()


Cross-Project Refactorings
--------------------------
Expand Down
226 changes: 0 additions & 226 deletions rope/contrib/autoimport.py

This file was deleted.

4 changes: 4 additions & 0 deletions rope/contrib/autoimport/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""AutoImport module for rope."""
from .autoimport import AutoImport

__all__ = ["AutoImport"]