pdoc3 / pdoc3/pdoc

pdoc3 crashes after package 'pdoc' is uninstalled

Open
#131 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug upstream
Dominant language
Python
Stars
1.2k
Forks
146
PR merge metrics
No merged PRs in 30d

Description

This issue is probably the same as #30 which was closed "invalid". Here are steps to reproduce.

It looks like an interaction (name collision) between "pdoc" and "pdoc3" packages. Both packages appear to create this file upon install and remove it upon uninstall:

Lib/site-packages/pdoc/__init__.py
Expected Behavior
> pdoc3 --version
pdoc3 0.7.2
Actual Behavior
> pdoc3 --version
Traceback (most recent call last):
  File "C:\Python36-32\Scripts\pdoc3-script.py", line 11, in <module>
    load_entry_point('pdoc3==0.7.2', 'console_scripts', 'pdoc3')()
  File "c:\python36-32\lib\site-packages\pkg_resources\__init__.py", line 476, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "c:\python36-32\lib\site-packages\pkg_resources\__init__.py", line 2700, in load_entry_point
    return ep.load()
  File "c:\python36-32\lib\site-packages\pkg_resources\__init__.py", line 2318, in load
    return self.resolve()
  File "c:\python36-32\lib\site-packages\pkg_resources\__init__.py", line 2324, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "c:\python36-32\lib\site-packages\pdoc\cli.py", line 27, in <module>
    '--version', action='version', version='%(prog)s ' + pdoc.__version__)
AttributeError: module 'pdoc' has no attribute '__version__'
Steps to Reproduce
  1. Clean slate
> pip3 uninstall pdoc pdoc3 markdown
  1. Install pdoc3 to observe normal behaviour
> pip3 install pdoc3
  1. Observe normal behaviour
> pdoc3 --version
pdoc3 0.7.2
  1. SOURCE OF ISSUE - Install pdoc and then uninstall (which downgrades markdown, so we need to re-upgrade that):
> pip3 install pdoc
> pip3 uninstall pdoc
> pip3 install --upgrade markdown
  1. Observe crash:
> pdoc3 --version
Traceback (most recent call last):
  File "C:\Python36-32\Scripts\pdoc3-script.py", line 11, in <module>
    load_entry_point('pdoc3==0.7.2', 'console_scripts', 'pdoc3')()
  File "c:\python36-32\lib\site-packages\pkg_resources\__init__.py", line 476, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "c:\python36-32\lib\site-packages\pkg_resources\__init__.py", line 2700, in load_entry_point
    return ep.load()
  File "c:\python36-32\lib\site-packages\pkg_resources\__init__.py", line 2318, in load
    return self.resolve()
  File "c:\python36-32\lib\site-packages\pkg_resources\__init__.py", line 2324, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "c:\python36-32\lib\site-packages\pdoc\cli.py", line 27, in <module>
    '--version', action='version', version='%(prog)s ' + pdoc.__version__)
AttributeError: module 'pdoc' has no attribute '__version__'
Workaround

Uninstall pdoc and pdoc3 and re-install pdoc3.

> pip3 uninstall pdoc pdoc3
> pip3 install pdoc3
Additional info
  • pdoc3 version: 0.7.2
  • Python 3.7.4
  • Windows 10 command line

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the traceback location in pdoc/cli.py and reproduce the package-install sequence on Python 3.7.4 and Windows if available. Compare the pdoc3 and pdoc installations around Lib/site-packages/pdoc/init.py, then verify that pdoc3 --version still reports pdoc3 0.7.2 after pdoc is installed and uninstalled.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.