alicia-ziying-yang / conTEXT-explorer

ConTEXT Explorer is an open Web-based system for exploring and visualizing concepts (combinations of occurring words and phrases) over time in the text documents.
Apache License 2.0
9 stars 3 forks source link

[wish list] publish package on pypi #16

Closed alicia-ziying-yang closed 2 years ago

alicia-ziying-yang commented 2 years ago

As suggested in #15 , should we publish the current version to pypi?

faroit commented 2 years ago

I think pypi deployment is generally a good idea as this would simply installation for users.

publishing to pypi is not part of the JOSS review guidelines right now, but it will certainly be added soon: https://github.com/openjournals/joss/pull/976

https://github.com/openjournals/joss-reviews/issues/3347

alicia-ziying-yang commented 2 years ago

built and uploaded for test here: https://test.pypi.org/project/ConTEXT-Explorer/ But, the user need to install all required packages by themselves (otherwise cannot install), plus run python -m spacy download en before starting the app.

For me, git clone this repo, and install via setup.py (pip install .) is much better though. @turpinandrew what do you think?

faroit commented 2 years ago

@alicia-ziying-yang

But, the user need to install all required packages by themselves (otherwise cannot install)

the dependencies should be added to the install_requires section of setup.py to make this work. I know this is redundant, but it would really make the installation a one-liner then... (assuming the right python version ;-) )

plus run python -m spacy download en before starting the app.

wouldn't this workaround work?

alicia-ziying-yang commented 2 years ago

the dependencies should be added to the install_requires section of setup.py to make this work. I know this is redundant, but it would really make the installation a one-liner then... (assuming the right python version ;-) )

They had been there (in the setup.py) since the first time. And if run pip install . which runs the setup.py, it installs 'python -m spacy download en'. That are the steps in my README.md. It works well.

But if install by pypi, I will get these errors if I create a clean venv for testing: % pip install -i https://test.pypi.org/simple/ ConTEXT-Explorer==1.0.1 Looking in indexes: https://test.pypi.org/simple/ Collecting ConTEXT-Explorer==1.0.1 Downloading https://test-files.pythonhosted.org/packages/75/e6/09322a3c6c16f41c56597510cbcbb5c4a9afb96d73f0073e82bc3d8dabd4/ConTEXT_Explorer-1.0.1-py3-none-any.whl (35 kB) ERROR: Could not find a version that satisfies the requirement dash-core-components==1.10.2 (from context-explorer) (from versions: none) ERROR: No matching distribution found for dash-core-components==1.10.2

until, I install everything in the requirements by hand

alicia-ziying-yang commented 2 years ago

I can attach how I build the package by following the official guide (https://packaging.python.org/tutorials/packaging-projects/):

% python3 -m build

% python3 -m pip install --upgrade twine Downloading twine-3.4.2-py3-none-any.whl (34 kB) Collecting colorama>=0.4.3 Downloading colorama-0.4.4-py2.py3-none-any.whl (16 kB) Collecting tqdm>=4.14 Downloading tqdm-4.62.3-py2.py3-none-any.whl (76 kB) |████████████████████████████████| 76 kB 6.5 MB/s Collecting readme-renderer>=21.0 Downloading readme_renderer-29.0-py2.py3-none-any.whl (15 kB) Requirement already satisfied: importlib-metadata>=3.6 in /Users/ziyingy3/opt/anaconda3/envs/ce-test2/lib/python3.7/site-packages (from twine) (4.8.1) Collecting requests>=2.20 Downloading requests-2.26.0-py2.py3-none-any.whl (62 kB) |████████████████████████████████| 62 kB 12.9 MB/s Collecting rfc3986>=1.4.0 Downloading rfc3986-1.5.0-py2.py3-none-any.whl (31 kB) Collecting requests-toolbelt!=0.9.0,>=0.8.0 Downloading requests_toolbelt-0.9.1-py2.py3-none-any.whl (54 kB) |████████████████████████████████| 54 kB 10.7 MB/s Collecting keyring>=15.1 Downloading keyring-23.2.1-py3-none-any.whl (33 kB) Collecting pkginfo>=1.4.2 Downloading pkginfo-1.7.1-py2.py3-none-any.whl (25 kB) Requirement already satisfied: typing-extensions>=3.6.4 in /Users/ziyingy3/opt/anaconda3/envs/ce-test2/lib/python3.7/site-packages (from importlib-metadata>=3.6->twine) (3.10.0.2) Requirement already satisfied: zipp>=0.5 in /Users/ziyingy3/opt/anaconda3/envs/ce-test2/lib/python3.7/site-packages (from importlib-metadata>=3.6->twine) (3.6.0) Collecting six Downloading six-1.16.0-py2.py3-none-any.whl (11 kB) Collecting docutils>=0.13.1 Downloading docutils-0.17.1-py2.py3-none-any.whl (575 kB) |████████████████████████████████| 575 kB 6.4 MB/s Collecting bleach>=2.1.0 Downloading bleach-4.1.0-py2.py3-none-any.whl (157 kB) |████████████████████████████████| 157 kB 7.4 MB/s Collecting Pygments>=2.5.1 Downloading Pygments-2.10.0-py3-none-any.whl (1.0 MB) |████████████████████████████████| 1.0 MB 8.6 MB/s Requirement already satisfied: packaging in /Users/ziyingy3/opt/anaconda3/envs/ce-test2/lib/python3.7/site-packages (from bleach>=2.1.0->readme-renderer>=21.0->twine) (21.0) Collecting webencodings Downloading webencodings-0.5.1-py2.py3-none-any.whl (11 kB) Collecting charset-normalizer~=2.0.0 Downloading charset_normalizer-2.0.6-py3-none-any.whl (37 kB) Collecting urllib3<1.27,>=1.21.1 Downloading urllib3-1.26.7-py2.py3-none-any.whl (138 kB) |████████████████████████████████| 138 kB 6.4 MB/s Requirement already satisfied: certifi>=2017.4.17 in /Users/ziyingy3/opt/anaconda3/envs/ce-test2/lib/python3.7/site-packages (from requests>=2.20->twine) (2021.5.30) Collecting idna<4,>=2.5 Downloading idna-3.2-py3-none-any.whl (59 kB) |████████████████████████████████| 59 kB 8.2 MB/s Requirement already satisfied: pyparsing>=2.0.2 in /Users/ziyingy3/opt/anaconda3/envs/ce-test2/lib/python3.7/site-packages (from packaging->bleach>=2.1.0->readme-renderer>=21.0->twine) (2.4.7) Installing collected packages: webencodings, urllib3, six, idna, charset-normalizer, requests, Pygments, docutils, bleach, tqdm, rfc3986, requests-toolbelt, readme-renderer, pkginfo, keyring, colorama, twine Successfully installed Pygments-2.10.0 bleach-4.1.0 charset-normalizer-2.0.6 colorama-0.4.4 docutils-0.17.1 idna-3.2 keyring-23.2.1 pkginfo-1.7.1 readme-renderer-29.0 requests-2.26.0 requests-toolbelt-0.9.1 rfc3986-1.5.0 six-1.16.0 tqdm-4.62.3 twine-3.4.2 urllib3-1.26.7 webencodings-0.5.1 (ce-test2) ziyingy3@9999L-206579-M conTEXT-explorer % python3 -m twine upload --repository testpypi dist/* Uploading distributions to https://test.pypi.org/legacy/ Uploading ConTEXT_Explorer-1.0.2-py3-none-any.whl 100%|███████████████████████████████████| 40.0k/40.0k [00:02<00:00, 17.1kB/s] Uploading ConTEXT-Explorer-1.0.2.tar.gz 100%|███████████████████████████████████| 36.8k/36.8k [00:02<00:00, 16.6kB/s]

View at: https://test.pypi.org/project/ConTEXT-Explorer/1.0.2/

So if I try % pip install -i https://test.pypi.org/simple/ ConTEXT-Explorer==1.0.2 It gives me ERROR like:

ERROR: Could not find a version that satisfies the requirement dash-uploader==0.4.1 (from context-explorer) (from versions: none)
ERROR: No matching distribution found for dash-uploader==0.4.1

for random package in the requirement.

I do not understand what's wrong. Have googled for a whole day, many people have this issue but for now I have not found any solution.

alicia-ziying-yang commented 2 years ago

The latest upload: https://test.pypi.org/project/ConTEXT-Explorer/1.0.2/ But I cannot install it via % pip install -i https://test.pypi.org/simple/ ConTEXT-Explorer==1.0.2 though.

alicia-ziying-yang commented 2 years ago

Clearly, pypi does not run "setup.py" after downloading.

Also a new problem: even successfully install it into python site-package via pypi, user cannot upload new corpus because of path problem: FileNotFoundError: [Errno 2] No such file or directory: './topic_model/sample_data_2/processed_content_sample_data_2.pkl' it cannot write file into the sys path, even I already use "sudo".

This is because this application was not designed for system package use, but a stand-alone Application. Of course we can further improve it to archive that, but we now can only put it into [wish list] because of time limitation. @turpinandrew ?

@faroit Thanks for suggesting to make it a pypi package. But for now I still recommend people to install it via the method via git clone, and pip install . (shown in README.md) which handles everything.

turpinandrew commented 2 years ago

Clearly, pypi does not run "setup.py" after downloading.

Also a new problem: even successfully install it into python site-package via pypi, user cannot upload new corpus because of path problem: FileNotFoundError: [Errno 2] No such file or directory: './topic_model/sample_data_2/processed_content_sample_data_2.pkl' it cannot write file into the sys path, even I already use "sudo".

This is because this application was not designed for system package use, but a stand-alone Application. Of course we can further improve it to archive that, but we now can only put it into [wish list] because of time limitation. @turpinandrew ?

@faroit Thanks for suggesting to make it a pypi package. But for now I still recommend people to install it via the method via git clone, and pip install . (shown in README.md) which handles everything.

turpinandrew commented 2 years ago

Doh - think I closed it, which is probably rude! I agree, Alicia, this was never intended to be a 'package', but a standalone application. It seems a bit odd to jump through hoops to have it on pypi. If there is a two step process (download, run setup.py), that would seem appropriate for an application?

faroit commented 2 years ago

@turpinandrew @alicia-ziying-yang thanks for trying. It looks indeed like to be a lot of a work and I value that you tried this. Maybe as a compromise you could add a conda environment.yaml (+documentation in readme) file that includes the python version thus making it simpler to recreate the environment from scratch.

Update I saw you already did this

faroit commented 2 years ago

@turpinandrew can be closed then

alicia-ziying-yang commented 2 years ago

@turpinandrew @alicia-ziying-yang thanks for trying. It looks indeed like to be a lot of a work and I value that you tried this. Maybe as a compromise you could add a conda environment.yaml (+documentation in readme) file that includes the python version thus making it simpler to recreate the environment from scratch.

Update I saw you already did this

Hi @faroit @turpinandrew , thank you very much. I have updated the conda env file, and added instructions in README.md. Please check, and @turpinandrew can close this issue.

turpinandrew commented 2 years ago

Thanks for all your efforts @alicia-ziying-yang.