Skip to content

Commit 17212b8

Browse files
author
Test User
committed
Drop 3.8, fix mypy, add ty, bump test req versions
1 parent 3dd2008 commit 17212b8

11 files changed

Lines changed: 132 additions & 130 deletions

File tree

.github/workflows/tests.yml

Lines changed: 76 additions & 95 deletions
Large diffs are not rendered by default.

.readthedocs.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,30 @@
77

88
# Required
99
version: 2
10+
1011
build:
1112
os: "ubuntu-24.04"
1213
tools:
1314
python: "3.13"
15+
16+
# Build documentation in the docs/ directory with Sphinx
1417
sphinx:
1518
configuration: docs/source/conf.py
19+
20+
# Build documentation with MkDocs
21+
#mkdocs:
22+
# configuration: mkdocs.yml
23+
24+
# Optionally build your docs in additional formats such as PDF and ePub
1625
formats: all
26+
1727
python:
1828
install:
1929
- requirements: requirements/docs.txt
2030
- method: pip
2131
path: .
32+
#extra_requirements:
33+
# - docs
34+
35+
#conda:
36+
# environment: environment.yml

build_wheels.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,13 @@ if ! which cibuildwheel ; then
1818
exit 1
1919
fi
2020

21-
# Build version-pinned wheels
22-
cibuildwheel --config-file pyproject.toml --platform linux --archs x86_64
21+
LOCAL_CP_VERSION=$(python3 -c "import sys; print('cp' + ''.join(list(map(str, sys.version_info[0:2]))))")
22+
echo "LOCAL_CP_VERSION = $LOCAL_CP_VERSION"
23+
24+
# Build for only the current version of Python
25+
export CIBW_BUILD="${LOCAL_CP_VERSION}-*"
26+
27+
28+
#pip wheel -w wheelhouse .
29+
# python -m build --wheel -o wheelhouse # line_profiler: +COMMENT_IF(binpy)
30+
cibuildwheel --config-file pyproject.toml --platform linux --archs x86_64 # line_profiler: +UNCOMMENT_IF(binpy)

docs/source/conf.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def visit_Assign(self, node):
141141

142142

143143
project = 'line_profiler'
144-
copyright = '2025, Robert Kern'
144+
copyright = '2026, Robert Kern'
145145
author = 'Robert Kern'
146146
modname = 'line_profiler'
147147

@@ -435,7 +435,7 @@ class PatchedPythonDomain(PythonDomain):
435435
"""
436436

437437
def resolve_xref(
438-
self, env, fromdocname, builder, typ, target, node, contnode
438+
self, env, fromdocname, builder, type, target, node, contnode
439439
):
440440
"""
441441
Helps to resolves cross-references
@@ -445,7 +445,7 @@ def resolve_xref(
445445
if target.startswith('xdoc.'):
446446
target = 'xdoctest.' + target[3]
447447
return_value = super(PatchedPythonDomain, self).resolve_xref(
448-
env, fromdocname, builder, typ, target, node, contnode
448+
env, fromdocname, builder, type, target, node, contnode
449449
)
450450
return return_value
451451

@@ -838,10 +838,12 @@ def create_doctest_figure(app, obj, name, lines):
838838
The idea is that each doctest that produces a figure should generate that
839839
and then that figure should be part of the docs.
840840
"""
841-
import xdoctest
842841
import sys
843842
import types
844843

844+
import xdoctest
845+
import xdoctest.core
846+
845847
if isinstance(obj, types.ModuleType):
846848
module = obj
847849
else:
@@ -1035,9 +1037,10 @@ def postprocess_hyperlinks(app, doctree, docname):
10351037
"autodoc-process-docstring" event.
10361038
"""
10371039
# Your hyperlink postprocessing logic here
1038-
from docutils import nodes
10391040
import pathlib
10401041

1042+
from docutils import nodes
1043+
10411044
for node in doctree.traverse(nodes.reference):
10421045
if 'refuri' in node.attributes:
10431046
refuri = node.attributes['refuri']
@@ -1054,14 +1057,15 @@ def postprocess_hyperlinks(app, doctree, docname):
10541057

10551058

10561059
def fix_rst_todo_section(lines):
1057-
new_lines = []
1060+
# new_lines = []
10581061
for line in lines:
10591062
...
10601063
...
10611064

10621065

10631066
def setup(app):
10641067
import sphinx
1068+
import sphinx.application
10651069

10661070
app: sphinx.application.Sphinx = app
10671071
app.add_domain(PatchedPythonDomain, override=True)

line_profiler/_logger.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import logging
77
from abc import ABC, abstractmethod
88
import sys
9-
from typing import ClassVar
9+
from typing import ClassVar, cast
1010
from logging import INFO, DEBUG, ERROR, WARNING, CRITICAL # NOQA
1111

1212

@@ -168,7 +168,7 @@ def configure(
168168
'path': None,
169169
'format': '%(asctime)s : [file] %(levelname)s : %(message)s',
170170
}
171-
streaminfo = {
171+
streaminfo: dict[str, bool | None | str] = {
172172
'__enable__': None, # will be determined below
173173
'format': '%(levelname)s: %(message)s',
174174
}
@@ -195,7 +195,7 @@ def configure(
195195

196196
# Add a stream handler if enabled
197197
if streaminfo['__enable__']:
198-
streamformat = streaminfo.get('format')
198+
streamformat = cast(str, streaminfo.get('format'))
199199
sh = logging.StreamHandler(sys.stdout)
200200
sh.setFormatter(logging.Formatter(streamformat))
201201
self.logger.addHandler(sh)

line_profiler/autoprofile/autoprofile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,4 @@ def __exit__(self, *_, **__):
153153
# then restore it via the context manager, so that the executed
154154
# code is run as `__main__`
155155
sys.modules['__main__'] = module_obj
156-
exec(code_obj, cast(Dict[str, Any], namespace), namespace)
156+
exec(code_obj, cast(Dict[str, Any], namespace), namespace) # type: ignore[redundant-cast]

line_profiler/cli_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
import shutil
1313
import sys
1414
from os import PathLike
15-
from typing import Protocol, Sequence, TypeVar, cast
15+
from typing import cast
1616
from .toml_config import ConfigSource
1717

1818

19-
_BOOLEAN_VALUES = {
19+
_BOOLEAN_VALUES: dict[str, bool] = {
2020
**{k.casefold(): False for k in ('', '0', 'off', 'False', 'F', 'no', 'N')},
2121
**{k.casefold(): True for k in ('1', 'on', 'True', 'T', 'yes', 'Y')},
2222
}

pyproject.toml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ omit =[
3434
]
3535

3636
[tool.cibuildwheel]
37-
build = "cp38-* cp39-* cp310-* cp311-* cp312-* cp313-* cp314-*"
37+
build = "cp39-* cp310-* cp311-* cp312-* cp313-* cp314-*"
3838
# XXX: since `tests.yml` already defines `matrix.cibw_skip` for
3939
# `build_binpy_wheels`, can we deduplicate and just use that?
4040
# Or do we need these when building wheels for release, which may run on
@@ -59,13 +59,13 @@ archs = ['AMD64', 'ARM64']
5959
ignore_missing_imports = true
6060

6161
[tool.xcookie]
62-
tags = [ "pyutils", "binpy", "github",]
62+
tags = [ "pyutils", "binpy", "github", "mypy", "binpy-ubuntu-arm"]
6363
mod_name = "line_profiler"
6464
repo_name = "line_profiler"
6565
rel_mod_parent_dpath = "."
6666
os = [ "all", "linux", "osx", "win",]
6767
main_python = '3.13'
68-
min_python = '3.8'
68+
min_python = '3.9'
6969
max_python = '3.14'
7070
author = "Robert Kern"
7171
author_email = "robert.kern@enthought.com"
@@ -102,7 +102,7 @@ rules = { unused-type-ignore-comment = "ignore" }
102102

103103
[tool.ruff]
104104
line-length = 80
105-
target-version = "py38"
105+
target-version = "py39"
106106

107107
[tool.ruff.lint]
108108
# Enable Flake8 (E, F) and isort (I) rules.
@@ -119,3 +119,8 @@ indent-style = "space"
119119
skip-magic-trailing-comma = false
120120
line-ending = "auto"
121121
docstring-code-format = false
122+
123+
[tool.ty.rules]
124+
unused-ignore-comment = "ignore"
125+
unused-type-ignore-comment = "ignore"
126+
unresolved-import = "ignore"

requirements/ipython.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
IPython >=8.14.0 ; python_version < '4.0.0' and python_version >= '3.9.0' # Python 3.9+
2-
IPython >=8.12.2 ; python_version < '3.9.0' and python_version >= '3.8.0' # Python 3.8
1+
IPython >=8.14.0 ; python_version < '3.10' and python_version >= '3.9'
2+
IPython >=8.28.0 ; python_version < '4.0' and python_version >= '3.10'

requirements/optional.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Add requirements here, use the script for help
22
# xdev availpkg rich
3-
rich>=12.3.0
3+
rich>=13.9.0
44
-r ipython.txt

0 commit comments

Comments
 (0)