Skip to content

Commit c7a8939

Browse files
committed
Revert "[ENH] Speed up first completion (deshaw#399)"
This reverts commit ee751d3.
1 parent ffdbb35 commit c7a8939

File tree

16 files changed

+318
-579
lines changed

16 files changed

+318
-579
lines changed

.github/workflows/docs.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ jobs:
1212
- uses: actions/setup-python@v5
1313
- name: Install dependencies
1414
run: |
15-
pip install -U pip
16-
pip install -v --group docs
15+
pip install sphinx sphinx_rtd_theme sphinx-autodoc-typehints
16+
python -m pip install --upgrade pip setuptools wheel
17+
python -m pip install --upgrade rlipython ipykernel==5.4.3 requests jupyter flaky 'notebook<6.1' 'prompt_toolkit<3.0.15' wheel 'jupyter_console>=6.2' 'pytest-cov<3' ipython 'coverage<6.3' pytest-json-report
18+
pip install -e .
1719
- name: Build docs
1820
run: |
1921
make html

.github/workflows/lint.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,25 @@ name: Lint
33
on: [push, pull_request]
44

55
jobs:
6-
lint:
6+
test:
77
runs-on: "ubuntu-latest"
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
python-version: ["3.13"]
12+
813
steps:
914
- uses: actions/checkout@v5
10-
- name: Set up Python
15+
- name: Set up Python ${{ matrix.python-version }}
1116
uses: actions/setup-python@v5
1217
with:
13-
python-version: 3.13
14-
- name: Install pyflyby
18+
python-version: ${{ matrix.python-version }}
19+
- name: Install and update Python dependencies on Python 3
1520
run: |
16-
# Include build dependencies for run time; see
17-
# https://mesonbuild.com/meson-python/how-to-guides/editable-installs.html#build-dependencies
18-
# for details.
19-
pip install meson-python meson ninja pybind11>=2.10.4
20-
pip install setuptools wheel # needed for epydoc
21-
pip install --no-build-isolation -ve . --group lint
21+
python -m pip install --upgrade pip setuptools wheel
22+
python -m pip install --upgrade pyflakes flake8 mypy
23+
python -m pip install types-six
24+
pip install -e .
2225
- name: Mypy
2326
run: |
2427
mypy lib/python --ignore-missing-imports
@@ -29,3 +32,4 @@ jobs:
2932
- name: Self-tidy-import
3033
run: |
3134
./bin/tidy-imports -d lib/python/ tests/
35+

.github/workflows/test.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,14 @@ jobs:
3030
uses: actions/setup-python@v5
3131
with:
3232
python-version: ${{ matrix.python-version }}
33-
- name: Install pyflyby
33+
- name: Install and update Python dependencies on Python 3
3434
run: |
35-
# Include build dependencies for run time; see
36-
# https://mesonbuild.com/meson-python/how-to-guides/editable-installs.html#build-dependencies
37-
# for details.
38-
pip install meson-python meson ninja pybind11>=2.10.4
39-
pip install setuptools wheel # needed for epydoc
40-
pip install --no-build-isolation -ve .[test]
35+
python -m pip install --upgrade pip setuptools wheel
36+
python -m pip install --upgrade "pexpect>=3.3" 'pytest<=8' rlipython 'ipykernel>=5.4.3' requests jupyter flaky 'notebook<6.1' wheel 'jupyter_console>=6.2' pytest-cov ipython coverage pytest-json-report hypothesis
37+
pip install -e .
4138
- name: test release build
4239
run: |
43-
python -m build
40+
python setup.py sdist bdist_wheel
4441
- name: compileall
4542
run: |
4643
python -We:invalid -m compileall -f -q lib/ etc/;
@@ -65,3 +62,10 @@ jobs:
6562
name: pytest-timing-${{ matrix.os }}-${{ matrix.python-version }}
6663
path: ./report-*.json
6764
- uses: codecov/codecov-action@v5
65+
- name: Build docs
66+
if: ${{ matrix.python-version == '3.11'}}
67+
run: |
68+
pip install sphinx sphinx_rtd_theme sphinx-autodoc-typehints
69+
cd doc
70+
make html
71+
cd ..

README.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ Emacs support
459459

460460
* To get a ``M-x tidy-imports`` command in GNU Emacs, add to your ``~/.emacs``::
461461

462-
(load "/<site-packages>/pyflyby/share/emacs/site-lisp/pyflyby.el")
462+
(load "/path/to/pyflyby/lib/emacs/pyflyby.el")
463463

464464

465465
- Pyflyby.el doesn't yet work with XEmacs; patches welcome.
@@ -546,3 +546,5 @@ Release
546546

547547
8. Check/update https://github.com/conda-forge/pyflyby-feedstock for new pyflyby
548548
release on conda-forge
549+
550+

doc/api/idents.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ _idents module
22
==============
33
.. automodule:: pyflyby._idents
44
:members:
5+
:exclude-members: _my_iskeyword

doc/conf.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
# -- Path setup --------------------------------------------------------------
44
import os
5-
import pathlib
6-
import re
75
import sys
86
sys.path.insert(0, os.path.abspath('../lib/python'))
97
sys.path.insert(0, os.path.abspath('..'))
@@ -13,21 +11,9 @@
1311
copyright = '2019, Karl Chen'
1412
author = 'Karl Chen'
1513
# The full version, including alpha/beta/rc tags
14+
import pyflyby
1615

17-
def find_version():
18-
# Extract version information via regex to avoid importing
19-
project_root = pathlib.Path(__file__).parent.parent
20-
with open(project_root / "lib" / "python" / "pyflyby" / "_version.py") as f:
21-
version_match = re.search(
22-
r"^__version__ = ['\"](?P<version>.*)['\"]$",
23-
f.read(),
24-
re.M,
25-
)
26-
if version_match:
27-
return version_match.group("version")
28-
raise RuntimeError("Unable to find version string.")
29-
30-
release = find_version()
16+
release = pyflyby.__version__
3117

3218

3319
# -- General configuration ---------------------------------------------------
@@ -43,12 +29,6 @@ def find_version():
4329
'private-members': True
4430
}
4531

46-
autodoc_mock_imports = [
47-
"pyflyby._fast_iter_modules",
48-
"appdirs",
49-
"prompt_toolkit",
50-
]
51-
5232
html_theme_options = {
5333
'collapse_navigation': False,
5434
'navigation_depth': -1,

lib/python/pyflyby/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
unload_ipython_extension)
3232
from pyflyby._livepatch import livepatch, xreload
3333
from pyflyby._log import logger
34-
from pyflyby._modules import rebuild_import_cache
3534
from pyflyby._parse import PythonBlock, PythonStatement
3635
from pyflyby._saveframe import saveframe
3736
from pyflyby._saveframe_reader \

lib/python/pyflyby/_idents.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,20 @@
55

66

77
from functools import total_ordering
8-
from keyword import iskeyword
8+
from keyword import kwlist
99
import re
1010

1111
from pyflyby._util import cached_attribute, cmp
1212

1313
from typing import Optional, Tuple, Dict
1414

1515

16+
# Don't consider "print" a keyword, in order to be compatible with user code
17+
# that uses "from __future__ import print_function".
18+
_my_kwlist = list(kwlist)
19+
_my_iskeyword = frozenset(_my_kwlist).__contains__
20+
21+
1622
# TODO: use DottedIdentifier.prefixes
1723
def dotted_prefixes(dotted_name, reverse=False):
1824
"""
@@ -108,7 +114,7 @@ def is_identifier(s: str, dotted: bool = False, prefix: bool = False):
108114
return is_identifier(s + '_', dotted=dotted, prefix=False)
109115
if dotted:
110116
return all(is_identifier(w, dotted=False) for w in s.split('.'))
111-
return s.isidentifier() and not iskeyword(s)
117+
return s.isidentifier() and not _my_iskeyword(s)
112118

113119

114120
def brace_identifiers(text):

0 commit comments

Comments
 (0)