Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/window setup #665

Merged
merged 4 commits into from
Jan 21, 2023
Merged

Conversation

rachmadaniHaryono
Copy link
Collaborator

@rachmadaniHaryono rachmadaniHaryono commented Jan 21, 2023

  1. test install_require setup so it is similar to requirements.txt
  2. certifi is required and not optional anymore based on requirements.txt
  3. pyreadline3 is required on window based on requirements.txt
  4. flask-reverse-proxy is use latest version (only version bump to satisfy test)

fixes #664

@rachmadaniHaryono rachmadaniHaryono marked this pull request as draft January 21, 2023 02:43
@rachmadaniHaryono rachmadaniHaryono marked this pull request as ready for review January 21, 2023 02:48
@jarun jarun merged commit c19853c into jarun:master Jan 21, 2023
@jarun
Copy link
Owner

jarun commented Jan 21, 2023

Thank you!

@rachmadaniHaryono rachmadaniHaryono deleted the bugfix/window-setup branch January 21, 2023 03:06
@LeXofLeviafan
Copy link
Collaborator

certifi is required and not optional anymore

It's used on Windows but not on Linux (based on the source)

pyreadline3 is required on window

You haven't changed the actual import line

(Incidentally, the issue with it being imported globally wasn't fixed either; there's no need to load it when buku is used as a library.)

flask-reverse-proxy

Last time I checked, PyPI didn't allow such dependencies… Will the new version be installable via pip? (The current one isn't.)

@rachmadaniHaryono
Copy link
Collaborator Author

(Incidentally, the issue with it being imported globally wasn't fixed either; there's no need to load it when buku is used as a library.)

i thought if i move it to only this line

buku/buku

Line 5826 in c19853c

readline.add_history(' '.join(args.keywords))
there maybe another side effect

i can't find the document about it but this SO ask about how to undo it

https://stackoverflow.com/questions/48694676/how-to-undo-effects-of-import-readline

not sure if that actually true

Last time I checked, PyPI didn't allow such dependencies… Will the new version be installable via pip? (The current one isn't.)

you mean pip?

i can sucessfully install it locally

log

python -m pip install -e ".[reverse_proxy]"
Obtaining file:///mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/Buku
Collecting flask-reverse-proxy-fix@ https://github.com/rachmadaniHaryono/flask-reverse-proxy-fix/archive/refs/tags/v0.2.3.zip
  Downloading https://github.com/rachmadaniHaryono/flask-reverse-proxy-fix/archive/refs/tags/v0.2.3.zip
     / 14 kB 205 kB/s
Collecting beautifulsoup4>=4.4.1
  Using cached beautifulsoup4-4.11.1-py3-none-any.whl (128 kB)
Collecting certifi
  Using cached certifi-2022.12.7-py3-none-any.whl (155 kB)
Collecting cryptography>=1.2.3
  Using cached cryptography-39.0.0-cp36-abi3-manylinux_2_28_x86_64.whl (4.2 MB)
Collecting html5lib>=1.0.1
  Using cached html5lib-1.1-py2.py3-none-any.whl (112 kB)
Collecting urllib3>=1.23
  Using cached urllib3-1.26.14-py2.py3-none-any.whl (140 kB)
Collecting soupsieve>1.2
  Using cached soupsieve-2.3.2.post1-py3-none-any.whl (37 kB)
Collecting cffi>=1.12
  Using cached cffi-1.15.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (441 kB)
Collecting pycparser
  Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Collecting webencodings
  Using cached webencodings-0.5.1-py2.py3-none-any.whl (11 kB)
Collecting six>=1.9
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting flask
  Using cached Flask-2.2.2-py3-none-any.whl (101 kB)
Collecting itsdangerous>=2.0
  Using cached itsdangerous-2.1.2-py3-none-any.whl (15 kB)
Collecting Jinja2>=3.0
  Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB)
Collecting click>=8.0
  Using cached click-8.1.3-py3-none-any.whl (96 kB)
Collecting Werkzeug>=2.2.2
  Using cached Werkzeug-2.2.2-py3-none-any.whl (232 kB)
Collecting MarkupSafe>=2.0
  Downloading MarkupSafe-2.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB)
Using legacy 'setup.py install' for flask-reverse-proxy-fix, since package 'wheel' is not installed.
Installing collected packages: pycparser, MarkupSafe, Werkzeug, webencodings, soupsieve, six, Jinja2, itsdangerous, click, cffi, urllib3, html5lib, flask, cryptography, certifi, beautifulsoup4, flask-reverse-proxy-fix, buku
    Running setup.py install for flask-reverse-proxy-fix ... done
  Running setup.py develop for buku
Successfully installed Jinja2-3.1.2 MarkupSafe-2.1.2 Werkzeug-2.2.2 beautifulsoup4-4.11.1 buku-4.7 certifi-2022.12.7 cffi-1.15.1 click-8.1.3 cryptography-39.0.0 flask-2.2.2 flask-reverse-proxy-fix-0.2.3 html5lib-1.1 itsdangerous-2.1.2 pycparser-2.21 six-1.16.0 soupsieve-2.3.2.post1 urllib3-1.26.14 webencodings-0.5.1

there was this #616 but this error appear again on test

#596 which i thought already fix it, but i have to release new version of flask-reverse-proxy for an actual fix

@LeXofLeviafan
Copy link
Collaborator

i thought if i move it to only this line

I suggest moving it to the beginning of main() – this way it's imported at the start when running interactively, but not when buku is used as a library.

there maybe another side effect

I think when something (buku in this case) is imported as a library, it shouldn't affect how I/O works for the main program (unless that is specifically the purpose of the library) 😄

i can sucessfully install it locally

I'm pretty sure that installs from local folder simply aren't checked for this one, seeing as it explicitly says about installing from PyPI:

ERROR: Packages installed from PyPI cannot depend on packages which are not also hosted on PyPI.

@rachmadaniHaryono
Copy link
Collaborator Author

I suggest moving it to the beginning of main() – this way it's imported at the start when running interactively, but not when buku is used as a library.

this could be better solution can you add that to ongoing #660

I'm pretty sure that installs from local folder simply aren't checked for this one, seeing as it explicitly says about installing from PyPI:

it could be

there are several solution here https://discuss.python.org/t/packages-installed-from-pypi-cannot-depend-on-packages-which-are-not-also-hosted-on-pypi/3736/4

in case there is failure when installing through pypi, user could also manually install it after installing buku

can't check it with current buku pypi version

but this installation is succesful

python -m pip install "git+https://github.com/jarun/buku.git#egg=buku[reverse_proxy]"

Collecting buku[reverse_proxy]
  Cloning https://github.com/jarun/buku.git to ./pip-install-0jqcirhy/buku_a5293c6c772c4fa8963168026f7cb5cd
  Running command git clone --filter=blob:none --quiet https://github.com/jarun/buku.git /tmp/pip-install-0jqcirhy/buku_a5293c6c772c4fa8963168026f7cb5cd
  Resolved https://github.com/jarun/buku.git to commit c19853cda09ee10441c42d0ba0955100583a47af
  Preparing metadata (setup.py) ... done
Collecting flask-reverse-proxy-fix@ https://github.com/rachmadaniHaryono/flask-reverse-proxy-fix/archive/refs/tags/v0.2.3.zip
  Using cached https://github.com/rachmadaniHaryono/flask-reverse-proxy-fix/archive/refs/tags/v0.2.3.zip
  Preparing metadata (setup.py) ... done
Collecting beautifulsoup4>=4.4.1
  Using cached beautifulsoup4-4.11.1-py3-none-any.whl (128 kB)
Collecting certifi
  Using cached certifi-2022.12.7-py3-none-any.whl (155 kB)
Collecting cryptography>=1.2.3
  Using cached cryptography-39.0.0-cp36-abi3-manylinux_2_28_x86_64.whl (4.2 MB)
Collecting html5lib>=1.0.1
  Using cached html5lib-1.1-py2.py3-none-any.whl (112 kB)
Collecting urllib3>=1.23
  Using cached urllib3-1.26.14-py2.py3-none-any.whl (140 kB)
Collecting soupsieve>1.2
  Using cached soupsieve-2.3.2.post1-py3-none-any.whl (37 kB)
Collecting cffi>=1.12
  Using cached cffi-1.15.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (462 kB)
Collecting six>=1.9
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting webencodings
  Using cached webencodings-0.5.1-py2.py3-none-any.whl (11 kB)
Collecting flask
  Using cached Flask-2.2.2-py3-none-any.whl (101 kB)
Collecting pycparser
  Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Collecting Werkzeug>=2.2.2
  Using cached Werkzeug-2.2.2-py3-none-any.whl (232 kB)
Collecting Jinja2>=3.0
  Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB)
Collecting itsdangerous>=2.0
  Using cached itsdangerous-2.1.2-py3-none-any.whl (15 kB)
Collecting click>=8.0
  Using cached click-8.1.3-py3-none-any.whl (96 kB)
Collecting MarkupSafe>=2.0
  Downloading MarkupSafe-2.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (27 kB)
Installing collected packages: webencodings, urllib3, soupsieve, six, pycparser, MarkupSafe, itsdangerous, click, certifi, Werkzeug, Jinja2, html5lib, cffi, beautifulsoup4, flask, cryptography, flask-reverse-proxy-fix, buku
  DEPRECATION: flask-reverse-proxy-fix is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for flask-reverse-proxy-fix ... done
  DEPRECATION: buku is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for buku ... done
Successfully installed Jinja2-3.1.2 MarkupSafe-2.1.2 Werkzeug-2.2.2 beautifulsoup4-4.11.1 buku-4.7 certifi-2022.12.7 cffi-1.15.1 click-8.1.3 cryptography-39.0.0 flask-2.2.2 flask-reverse-proxy-fix-0.2.3 html5lib-1.1 itsdangerous-2.1.2 pycparser-2.21 six-1.16.0 soupsieve-2.3.2.post1 urllib3-1.26.14 webencodings-0.5.1

[notice] A new release of pip available: 22.3 -> 22.3.1
[notice] To update, run: pip install --upgrade pip

@LeXofLeviafan
Copy link
Collaborator

I'm pretty sure that installs from local folder simply aren't checked for this one, seeing as it explicitly says about installing from PyPI:

it could be

can't check it with current buku pypi version

but this installation is succesful

python -m pip install "git+https://github.com/jarun/buku.git#egg=buku[reverse_proxy]"

To be clear, my interpretation of the error text ("Packages installed from PyPI cannot depend on packages which are not also hosted on PyPI") is as follows:
"If the pip install command is given a package name as source (thus making it look up the package on PyPI), i.e. pip install buku, then before proceeding with the install, pip runs an additional check on the resulting list of packages-to-be-installed to ensure that PyPI is the only installation source (at least for the dependency tree of the said package)"

@LeXofLeviafan
Copy link
Collaborator

…Incidentally, 'windows' is not a value that sys_platform can have.

@LeXofLeviafan
Copy link
Collaborator

there are several solution here https://discuss.python.org/t/packages-installed-from-pypi-cannot-depend-on-packages-which-are-not-also-hosted-on-pypi/3736/4

Speaking of which – why isn't this package on PyPI anyway? If it merits a separate package, it should be easily distributable, should it not?

@rachmadaniHaryono
Copy link
Collaborator Author

@LeXofLeviafan

…Incidentally, 'windows' is not a value that sys_platform can have.

based on this window is valid value

https://peps.python.org/pep-0508/#environment-markers

maybe not sys.platform but platform.system https://docs.python.org/3/library/platform.html#platform.system

Speaking of which – why isn't this package on PyPI anyway? If it merits a separate package, it should be easily distributable, should it not?

https://pypi.org/project/flask-reverse-proxy-fix/

that is the package but it is not updated yet since i create pr on feb 8 2020 antarctica/flask-reverse-proxy-fix#1

@LeXofLeviafan
Copy link
Collaborator

based on this window is valid value

https://peps.python.org/pep-0508/#environment-markers

See the link for the full list of possible values.

maybe not sys.platform but platform.system https://docs.python.org/3/library/platform.html#platform.system

I've considered it but it's not actually stable (i.e. can be tampered with).

that is the package but it is not updated yet since i create pr on feb 8 2020 antarctica/flask-reverse-proxy-fix#1

The last commit is from 2019-03-04; the package is stale. I believe you should put your fork on PyPI instead (same thing happened to pyreadline BTW, that's why I'm replacing it with pyreadline3)

@LeXofLeviafan
Copy link
Collaborator

…Just checked on my work machine: the current master doesn't pull pyreadline as dependency on Windows (the version in #660 does).

Also stumbled upon a bug caused by new cassettes (Windows-specific); not sure how I missed it before 😅

@LeXofLeviafan
Copy link
Collaborator

…Another thing about flask-reverse-proxy-fix: you forgot to update version in bukuserver/requirements.txt (pip actually fails to build a wheel for it due to bad version number 😅)

@thetechnodino
Copy link

Where can I download a version of buku[server] that can be installed and works??
I am sorry to be so slow but I have to learn how to do your suggestions from 0 knowledge as I am not a coder by profession and self taught.
I can create a virtual environment on Windows 11 and hopefully figure out to get a working version installed and working. Once i figure installing, getting to run I should be able to a bat script to automate the process.

Every once in a while a slow poke newbie amateur tries to get a useful program working from 0 knowledge. I just happen to be such a newbie slow poke.

Thanks
John

@rachmadaniHaryono
Copy link
Collaborator Author

@thetechnodino try something equivalent on window

python -m pip install "git+https://github.com/jarun/buku.git#egg=buku[server]"

replace [server] with [server,reverse_proxy] if you need reverse proxy

#660 have more fix for window user

@LeXofLeviafan
Copy link
Collaborator

#660 was merged already, its changes are in master now.
Also, installing won't work unless he uninstalls the previously installed version (or uses a venv).

@thetechnodino
On Windows, you can try doing something like this for installation (in a folder where you want to install buku):

@rem obviously the virtualenv module must be installed for this to work, i.e. "pip install virtualenv"
py -m virtualenv buku
@rem remove the word 'call' when using PowerShell
call buku\Scripts\activate
pip install "git+https://github.com/jarun/buku.git#egg=buku[server]"
deactivate

And for running, you can make a script named bukuserver.bat next to the buku venv folder (or inside but you'll need to change activation path accordingly):

call buku\Scripts\activate
@rem configuration can be applied here, i.e.:
set BUKUSERVER_DISABLE_FAVICON=false
bukuserver run
deactivate

@thetechnodino
Copy link

thetechnodino commented Jan 28, 2023 via email

@thetechnodino
Copy link

thetechnodino commented Jan 28, 2023 via email

@github-actions github-actions bot locked and limited conversation to collaborators Feb 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Buku Server Python Module Missing
4 participants