Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
a84644d
Remove python 2 compat junk
peytondmurray Jul 24, 2025
6a283ca
WIP
peytondmurray Jul 25, 2025
1eb0634
Cut as many corners as possible while still remaining with python
peytondmurray Jul 25, 2025
176b790
Fix type annotation
peytondmurray Jul 25, 2025
315f124
cpp extension boilerplate
peytondmurray Aug 11, 2025
7e61b64
meson build is now working
peytondmurray Aug 12, 2025
f33d3e1
WIP
peytondmurray Aug 12, 2025
2bba155
wip
peytondmurray Aug 12, 2025
85db618
Implement a compiled extension which finds modules
peytondmurray Aug 13, 2025
f8110b3
Compiled extension tested, working
peytondmurray Aug 13, 2025
b373664
Don't use `python setup.py <whatever>`
peytondmurray Aug 13, 2025
922620d
Don't use editable installs for testing
peytondmurray Aug 13, 2025
a63ebe1
Don't build/test with build isolation
peytondmurray Aug 13, 2025
ecabfa2
Switch order of args
peytondmurray Aug 13, 2025
510edc0
Merge branch 'master' into 571-optimize-iter-modules
peytondmurray Aug 13, 2025
025bcdc
Correct a bad docstring
peytondmurray Aug 13, 2025
8aa4381
Add pybind11 dep to CI...
peytondmurray Aug 13, 2025
d9cd381
Enforce c++17 standard
peytondmurray Aug 13, 2025
0bbb60c
Fix the doc build configuration
peytondmurray Aug 13, 2025
9f8ef45
Use dependency groups for docs and lint; don't build docs in test
peytondmurray Aug 13, 2025
f576055
Add 'build' as test dependency
peytondmurray Aug 13, 2025
445346f
Make tests run in editable mode
peytondmurray Aug 14, 2025
72bc1b4
Add hypothesis; follow meson-python docs around editable mode
peytondmurray Aug 14, 2025
d5e5f7b
Make epydoc and wheel direct dependencies of pyflyby
peytondmurray Aug 14, 2025
18a9101
Add setuptools and wheel, required by epydoc
peytondmurray Aug 14, 2025
25eb122
Make the install `pure: false`; prevent site-packages pollution
peytondmurray Aug 14, 2025
7390cfc
Set lower bound on meson-python to 0.18.0 to enforce PEP639
peytondmurray Aug 20, 2025
91d8519
Add caching; progress bars aren't quite right yet
peytondmurray Aug 22, 2025
a4dd907
Don't bother with progress bars
peytondmurray Aug 22, 2025
847d9ab
Add a function to force the cache to be rebuilt
peytondmurray Aug 22, 2025
d61b636
Export rebuild_import_cache at top level
peytondmurray Aug 22, 2025
0b04997
Merge branch 'master' into 571-optimize-iter-modules
peytondmurray Aug 22, 2025
d8f312e
Cleanup
peytondmurray Aug 22, 2025
ee6ae7d
Expand import caching test
peytondmurray Aug 22, 2025
9ade0cd
Check that updating the mtime of an importer path regenerates the cache
peytondmurray Aug 22, 2025
8ae7d62
Add `appdirs` to autodoc_mock_imports; remove unused import
peytondmurray Aug 22, 2025
c9a467c
Add `prompt-toolkit` as dependency
peytondmurray Aug 22, 2025
4e7cbf5
Fix tests broken by new log messages
peytondmurray Aug 25, 2025
7a45d5b
Disable test broken due to log messages
peytondmurray Aug 26, 2025
e81442d
Remove patch_stdout calls; that's a problem for another time
peytondmurray Aug 26, 2025
3d4a9ad
Try using two scenarios
peytondmurray Aug 26, 2025
fadc728
Try stripping out log lines; can't do anything else since subprocess...
peytondmurray Aug 27, 2025
714de2c
Add env variable for suppressing pyflyby cache rebuild log messages
peytondmurray Aug 27, 2025
4075e55
Merge branch 'master' into 571-optimize-iter-modules
peytondmurray Aug 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ jobs:
- uses: actions/setup-python@v5
- name: Install dependencies
run: |
pip install sphinx sphinx_rtd_theme sphinx-autodoc-typehints
python -m pip install --upgrade pip setuptools wheel
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
pip install -e .
pip install -U pip
pip install -v --group docs
- name: Build docs
run: |
make html
Expand Down
24 changes: 10 additions & 14 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,22 @@ name: Lint
on: [push, pull_request]

jobs:
test:
lint:
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
python-version: ["3.13"]

steps:
- uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install and update Python dependencies on Python 3
python-version: 3.13
- name: Install pyflyby
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade pyflakes flake8 mypy
python -m pip install types-six
pip install -e .
# Include build dependencies for run time; see
# https://mesonbuild.com/meson-python/how-to-guides/editable-installs.html#build-dependencies
# for details.
pip install meson-python meson ninja pybind11>=2.10.4
pip install setuptools wheel # needed for epydoc
pip install --no-build-isolation -ve . --group lint
- name: Mypy
run: |
mypy lib/python --ignore-missing-imports
Expand All @@ -32,4 +29,3 @@ jobs:
- name: Self-tidy-import
run: |
./bin/tidy-imports -d lib/python/ tests/

20 changes: 8 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,17 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install and update Python dependencies on Python 3
- name: Install pyflyby
run: |
python -m pip install --upgrade pip setuptools wheel
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
pip install -e .
# Include build dependencies for run time; see
# https://mesonbuild.com/meson-python/how-to-guides/editable-installs.html#build-dependencies
# for details.
pip install meson-python meson ninja pybind11>=2.10.4
pip install setuptools wheel # needed for epydoc
pip install --no-build-isolation -ve .[test]
- name: test release build
run: |
python setup.py sdist bdist_wheel
python -m build
- name: compileall
run: |
python -We:invalid -m compileall -f -q lib/ etc/;
Expand All @@ -62,10 +65,3 @@ jobs:
name: pytest-timing-${{ matrix.os }}-${{ matrix.python-version }}
path: ./report-*.json
- uses: codecov/codecov-action@v5
- name: Build docs
if: ${{ matrix.python-version == '3.11'}}
run: |
pip install sphinx sphinx_rtd_theme sphinx-autodoc-typehints
cd doc
make html
cd ..
4 changes: 1 addition & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ Emacs support

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

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


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

8. Check/update https://github.com/conda-forge/pyflyby-feedstock for new pyflyby
release on conda-forge


1 change: 0 additions & 1 deletion doc/api/idents.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ _idents module
==============
.. automodule:: pyflyby._idents
:members:
:exclude-members: _my_iskeyword
24 changes: 22 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# -- Path setup --------------------------------------------------------------
import os
import pathlib
import re
import sys
sys.path.insert(0, os.path.abspath('../lib/python'))
sys.path.insert(0, os.path.abspath('..'))
Expand All @@ -11,9 +13,21 @@
copyright = '2019, Karl Chen'
author = 'Karl Chen'
# The full version, including alpha/beta/rc tags
import pyflyby

release = pyflyby.__version__
def find_version():
# Extract version information via regex to avoid importing
project_root = pathlib.Path(__file__).parent.parent
with open(project_root / "lib" / "python" / "pyflyby" / "_version.py") as f:
version_match = re.search(
r"^__version__ = ['\"](?P<version>.*)['\"]$",
f.read(),
re.M,
)
if version_match:
return version_match.group("version")
raise RuntimeError("Unable to find version string.")

release = find_version()


# -- General configuration ---------------------------------------------------
Expand All @@ -29,6 +43,12 @@
'private-members': True
}

autodoc_mock_imports = [
"pyflyby._fast_iter_modules",
"appdirs",
"prompt_toolkit",
]

html_theme_options = {
'collapse_navigation': False,
'navigation_depth': -1,
Expand Down
1 change: 1 addition & 0 deletions lib/python/pyflyby/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
unload_ipython_extension)
from pyflyby._livepatch import livepatch, xreload
from pyflyby._log import logger
from pyflyby._modules import rebuild_import_cache
from pyflyby._parse import PythonBlock, PythonStatement
from pyflyby._saveframe import saveframe
from pyflyby._saveframe_reader \
Expand Down
10 changes: 2 additions & 8 deletions lib/python/pyflyby/_idents.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,14 @@


from functools import total_ordering
from keyword import kwlist
from keyword import iskeyword
import re

from pyflyby._util import cached_attribute, cmp

from typing import Optional, Tuple, Dict


# Don't consider "print" a keyword, in order to be compatible with user code
# that uses "from __future__ import print_function".
_my_kwlist = list(kwlist)
_my_iskeyword = frozenset(_my_kwlist).__contains__


# TODO: use DottedIdentifier.prefixes
def dotted_prefixes(dotted_name, reverse=False):
"""
Expand Down Expand Up @@ -114,7 +108,7 @@ def is_identifier(s: str, dotted: bool = False, prefix: bool = False):
return is_identifier(s + '_', dotted=dotted, prefix=False)
if dotted:
return all(is_identifier(w, dotted=False) for w in s.split('.'))
return s.isidentifier() and not _my_iskeyword(s)
return s.isidentifier() and not iskeyword(s)


def brace_identifiers(text):
Expand Down
Loading
Loading