Skip to content

Commit f8704ec

Browse files
committed
Revert "ENH: CLI env runs with typing.TYPE_CHECKING = True"
This reverts commit 2fc6315. It appears things begin to fall appart. This line would normally be hidden by `if TYPE_CHECKING:`, because type checkers don't fail with circular imports! Refs: #460 ``` Traceback (most recent call last): File "/opt/hostedtoolcache/Python/3.11.13/x64/bin/pdoc3", line 8, in <module> sys.exit(main()) ^^^^^^ File "/home/runner/work/pdoc/pdoc/pdoc/cli.py", line 559, in main modules = [pdoc.Module(module, docfilter=docfilter, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/runner/work/pdoc/pdoc/pdoc/cli.py", line 559, in <listcomp> modules = [pdoc.Module(module, docfilter=docfilter, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/runner/work/pdoc/pdoc/pdoc/__init__.py", line 677, in __init__ super().__init__(module.__name__, self, module) File "/home/runner/work/pdoc/pdoc/pdoc/__init__.py", line 547, in __init__ from pdoc.html_helpers import _ToMarkdown File "/home/runner/work/pdoc/pdoc/pdoc/html_helpers.py", line 16, in <module> import markdown File "/opt/hostedtoolcache/Python/3.11.13/x64/lib/python3.11/site-packages/markdown/__init__.py", line 42, in <module> from .core import Markdown, markdown, markdownFromFile File "/opt/hostedtoolcache/Python/3.11.13/x64/lib/python3.11/site-packages/markdown/core.py", line 27, in <module> from . import util File "/opt/hostedtoolcache/Python/3.11.13/x64/lib/python3.11/site-packages/markdown/util.py", line 35, in <module> from markdown import Markdown ImportError: cannot import name 'Markdown' from partially initialized module 'markdown' (most likely due to a circular import) (/opt/hostedtoolcache/Python/3.11.13/x64/lib/python3.11/site-packages/markdown/__init__.py) ```
1 parent 2fc6315 commit f8704ec

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

pdoc/cli.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import re
1212
import subprocess
1313
import sys
14-
import typing
1514
import warnings
1615
from contextlib import contextmanager
1716
from functools import lru_cache
@@ -454,8 +453,6 @@ def main(_args=None):
454453
global args
455454
args = _args or parser.parse_args()
456455

457-
typing.TYPE_CHECKING = True # type: ignore # Set this for subsequent module imports
458-
459456
# If warnings not externally managed, show deprecation warnings
460457
if not sys.warnoptions:
461458
warnings.simplefilter("once", DeprecationWarning)

0 commit comments

Comments
 (0)