balta2ar / brotab

Control your browser's tabs from the command line
MIT License
406 stars 29 forks source link

ModuleNotFoundError: No module named 'brotab.search' #23

Closed doronbehar closed 4 years ago

doronbehar commented 4 years ago

Trying to update to 1.2.0 on NixOS, I encounter the error:

Traceback (most recent call last):
  File "/nix/store/72mr8gx1a0lqf8bb3b5b4q65vlfdi0x4-brotab-1.2.0/bin/.brotab-wrapped", line 6, in <module>
    from brotab.main import main
  File "/nix/store/72mr8gx1a0lqf8bb3b5b4q65vlfdi0x4-brotab-1.2.0/lib/python3.7/site-packages/brotab/main.py", line 73, in <module>
    from brotab.search.query import query
ModuleNotFoundError: No module named 'brotab.search'

I don't encounter it when installing brotab in a git checkout with a virtual environment, can't figure out yet why...

doronbehar commented 4 years ago

See https://github.com/NixOS/nixpkgs/pull/80522

doronbehar commented 4 years ago

Update: I've discovered that this patch solves the issue for us:

diff --git i/setup.py w/setup.py
index 687edec..2b75136 100644
--- i/setup.py
+++ w/setup.py
@@ -97,7 +97,7 @@ packages = find_packages(
     # where='brotab',
     # exclude=('brotab.tests', 'firefox_extension', 'firefox_mediator')
     #exclude=('tests', 'firefox_extension', 'firefox_mediator')
-    include=('brotab', 'brotab.tests'),
+    include=('brotab', 'brotab.search', 'brotab.mediator'),
     exclude=('firefox_extension', 'firefox_mediator')
 )
 print('>>', packages)

Not sure why though..

balta2ar commented 4 years ago

@doronbehar Thank you for reporting this! Could you please try again with version 1.2.1? I've created a smoke test github action (https://github.com/balta2ar/brotab/commit/bb5a42216f408227b4864f73327cbcf298d31204) that builds python package and runs several basic commands (bt list, bt clients, etc) with a dummy mediator. Hopefully, this will help me catch similar packaging issues earlier in the future.

doronbehar commented 4 years ago

1.2.1 works :+1:. Just out of curiosity, why do you include the brotab.tests as well? https://github.com/balta2ar/brotab/compare/1.2.0...1.2.1#diff-2eeaed663bd0d25b7e608891384b7298R102

balta2ar commented 4 years ago

currently this smoke test code uses mocks from the tests package so that I can run mediator in mocked mode after installing the package. don't really have strong opinion on this, maybe I'll reshuffle it later, but I'm not sure it is really worth the time