atlassian-api / atlassian-python-api

Atlassian Python REST API wrapper
https://atlassian-python-api.readthedocs.io
Apache License 2.0
1.29k stars 642 forks source link

Use correct name for Beautiful Soup in dependencies #1296

Closed WOnder93 closed 5 months ago

WOnder93 commented 5 months ago

As noted at https://pypi.org/project/bs4/, the official name of the Beautiful Soup package is beautifulsoup4, while bs4 is just an alias. In distribution packaging (such as Fedora) the package may not be available under this alias, so it's better to use the official name.

codecov-commenter commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (03fd007) 34.36% compared to head (21f57c8) 34.36%.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1296 +/- ## ======================================= Coverage 34.36% 34.36% ======================================= Files 45 45 Lines 8241 8241 Branches 1146 1146 ======================================= Hits 2832 2832 Misses 5295 5295 Partials 114 114 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

gonchik commented 5 months ago

Thanks, I have not known

FCamborda commented 5 months ago

This should've been added to setup.py too for the pypi distribution, right? This only fixes the Tox env and the source installation

WOnder93 commented 5 months ago

setup.py doesn't contain any bs4 references, no? Or am I missing something?

gsemet commented 5 months ago

The official package is "beautifulsoup4", yes, but the module inside is bs4.

from beautifulsoup4 import BeautifulSoup

does not work. It should be:

from bs4 import BeautifulSoup

See the official documentation: https://pypi.org/project/beautifulsoup4/

image

FCamborda commented 5 months ago

setup.py doesn't contain any bs4 references, no? Or am I missing something?

Exactly, that's the issue. install_requires should mention explicitly all direct dependencies, in this case beautifulsoup4. Probably one of the other dependencies declared bs4 as a dependency and has now removed it, hence why before beautifulsoup4 was installed transitively.

The import statement should be from bs4 import BeautifulSoup, as the documentation says. (The package name is taken as-is from the directory containing the file __init__.py. In this case bs4 https://git.launchpad.net/beautifulsoup/tree/bs4?h=4.13)

alexandre-fabra commented 5 months ago

This is the new error message with 3.41.6:

Traceback (most recent call last):
  File "C:\python\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\python\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\day9lr\AppData\Local\Temp\venv\onedriving\Scripts\onedriving.exe\__main__.py", line 4, in <module>
  File "C:\Users\day9lr\AppData\Local\Temp\venv\onedriving\lib\site-packages\cli\od.py", line 10, in <module>
    from dx_pr_manager import cli as pr_manager_cli
  File "C:\Users\day9lr\AppData\Local\Temp\venv\onedriving\lib\site-packages\dx_pr_manager\cli.py", line 10, in <module>
    from dx_pr_manager import pr_manager
  File "C:\Users\day9lr\AppData\Local\Temp\venv\onedriving\lib\site-packages\dx_pr_manager\pr_manager.py", line 10, in <module>
    from dx_core.bitbucket import BitBucket  # type: ignore
  File "C:\Users\day9lr\AppData\Local\Temp\venv\onedriving\lib\site-packages\dx_core\bitbucket.py", line 6, in <module>
    from atlassian import Bitbucket
  File "C:\Users\day9lr\AppData\Local\Temp\venv\onedriving\lib\site-packages\atlassian\__init__.py", line 5, in <module>
    from .confluence import Confluence
  File "C:\Users\day9lr\AppData\Local\Temp\venv\onedriving\lib\site-packages\atlassian\confluence.py", line 10, in <module>
    from beautifulsoup4 import BeautifulSoup
ModuleNotFoundError: No module named 'beautifulsoup4'
alonsomoya commented 5 months ago

same here

11:22:50  /usr/local/lib/python3.10/site-packages/atlassian/__init__.py:5: in <module>
11:22:50      from .confluence import Confluence
11:22:50  /usr/local/lib/python3.10/site-packages/atlassian/confluence.py:10: in <module>
11:22:50      from beautifulsoup4 import BeautifulSoup
11:22:50  E   ModuleNotFoundError: No module named 'beautifulsoup4'
OmerFarukMerey commented 5 months ago

I have the same issue here for release 3.41.6 image

gsemet commented 5 months ago
from bs4 import BeautifulSoup

not difficult, just follow the doc

OmerFarukMerey commented 5 months ago
from bs4 import BeautifulSoup

not difficult, just follow the doc

This is not an useful comment. The problem still arises. see: #1295

zbika73 commented 5 months ago

Check this PR addressing requirements.txt file as a source of dependencies https://github.com/atlassian-api/atlassian-python-api/pull/1298