useblocks / sphinx-simplepdf

A simple PDF builder for Sphinx documentations
https://sphinx-simplepdf.readthedocs.io
MIT License
36 stars 15 forks source link

PDF theme not pointing to latest theme without activating Virtualenv #38

Closed sachin-suresh-rapyuta closed 1 year ago

sachin-suresh-rapyuta commented 1 year ago

@1kastner: Thanks for the test. Your output gave me the hint to recheck my path-calculation, as it may not work on windows. And indeed, one path may not have worked.

Can you please pull the latest commit and recheck it again? Thanks.

@danwos I guess still the new theme is not picking without activating virtualenv. I just tested this twice with & without virtual env. This is what I observed:

Case 1: When virtualenv (simplepdfvenv2) is activated:

$ which sphinx-build
/home/sachin/Workspace/my-project-path/docs/simplepdfvenv2/bin/sphinx-build

PDF Result:

Case 2: When virtualenv is not activated:

$ which sphinx-build
/usr/local/bin/sphinx-build

PDF Result:

danwos commented 1 year ago

That's for me the normal case.

It all depends on what environment you are using and in which one you have installed what kind of Sphinx-SimplePDF version.

If you have e.g. 2 environments (1 system-wide, 1 virtualenv), you need to install it in both separately. Their installation is completely separated and they do not have access to each other.

So in your virtualenv you could install the latest version from github. In a system-wide env the latest release from PyPi (which would not contain all the fixes yet.)

In my understanding, there is nothing Sphinx-SimplePDF can do here. It's all about how the virtualenvs get handled.

So in your case, I would simply install Sphinx-SimplePDF again with deactivated venv: pip install --upgrade git+https://github.com/useblocks/sphinx-simplepdf.git@main Then it should work.

sachin-suresh-rapyuta commented 1 year ago

Yes, I did that too in my deactivated env. Removed build folder and ran make simplepdf, I get old theme pdf. These are the steps I followed:

pip3 install --upgrade git+https://github.com/useblocks/sphinx-simplepdf.git@main
pip3 install -r requirements.txt
make simplepdf
sachin-suresh-rapyuta commented 1 year ago

@danwos - Would be happy to hear if this was fixed. Was there something I am missing from the above commands that I am running in deactivated env?

danwos commented 1 year ago

I have some problems with seeing the described behavior as a problem inside Sphinx-SimplePDF.

Sphinx-SimplePDF knows nothing about old themes. It only knows the current installed one. And the path to it is hard-coded and not somehow calculated dynamically based on other factors.

So for me it sounds like 2 envs are used, and usage or installation is done somehow incorrectly.

As I'm also unable to reproduce it, I am closing this issue for now. But feel free to reopen, if any new information is coming up.

sachin-suresh-rapyuta commented 1 year ago

@danwos - If I need to keep one installation with a new PDF theme, what do you suggest to uninstall? Like remove Python3 completely and reinstall? What is the path I need to be on to avoid all ambiguities? Here are the steps I did:

Now on my system-wide env, I installed the simplepdf from github using: pip3 install ../../../../../Test/sphinx-simplepdf where Test/simplepdf folder has the latest from the pip install --upgrade git+https://github.com/useblocks/sphinx-simplepdf.git@main.

When I run make simplepdf, I still get the old theme PDF. I just need to have the new theme PDF irrespective of the environment I am in.

danwos commented 1 year ago

To be honest I have no idea what is going wrong on your machine. Your description sounds all valid and that's the way how I would do it as well.

Last thing, which is coming into my mind: Can you install it via pip3 install --upgrade -e ../../../../../Test/sphinx-simplepdf?

--upgrade makes sure its gets installed, even if pip things the version has not changed.

-e installs it in dev mode, which means no files get copied to the pythone-env. Instead, a symbolic link to ../../../../../Test/sphinx-simplepdf is set. So each change in this folder is directly available in your system-wide Python env. If -e is not used, with each change in the repo, you also have to pip install it again.

sachin-suresh-rapyuta commented 1 year ago

Ah!! That works. Hopefully, I tested it properly in a non-virtual env. Just a quick question: When are you planning to push the new theme, and latest changes to pip instead of the Github Test folder?

I am thinking to make the simplepdf as default PDF during the build. Maybe I have to ask you about this on a separate ticket? I tried modifying the .readthedocs.yaml following this ReadtheDocs configuration. But considering this temporary way of using the new theme from Github, I was unsure of the commands I need to use in the .yaml.

danwos commented 1 year ago

It is already, 1.4.0 is available on PyPI: https://pypi.org/project/sphinx-simplepdf/

The upcoming version 1.5 is containing mostly new features, but not so many theme bugfixes.

sachin-suresh-rapyuta commented 1 year ago

Ok, if it is already on PyPI, why was I still using pip3 install --upgrade -e ../../../../../Test/sphinx-simplepdf to get the new theme? Was it recently moved? So, If I uninstall the simplepdf and just use pip install sphinx-simplepdf, I should get the latest theme?

danwos commented 1 year ago

Yes, pip install sphinx-simplepdf should be enough.

Ok, if it is already on PyPI, why was I still using pip3 install --upgrade -e ../../../../../Test/sphinx-simplepdf to get the new theme? Was it recently moved?

Was released ~4 weeks ago.

sachin-suresh-rapyuta commented 1 year ago

Oh, this is the issue: I again completely uninstalled simplepdf.

Now, I just tried pip install sphinx-simplepdf. I get Successfully installed sphinx-simplepdf-1.3.0. --> I get old theme PDF But when I pip3 install --upgrade -e ../../../../../Test/sphinx-simplepdf, I get: Successfully installed sphinx-simplepdf-1.4.0. ---> I get new theme PDF.

danwos commented 1 year ago

Now, I just tried pip install sphinx-simplepdf. I get Successfully installed sphinx-simplepdf-1.3.0...

I'm confused, you should get version 1.4.0, as this is the latest on PyPI. Are you using any company internal PyPI caches (e.g. Artifactory) or so?

Maybe install also via: pip install --upgrade sphinx-simplepdf

sachin-suresh-rapyuta commented 1 year ago

Here is the traceback. Tried the below 2 commands. Both installs 1.3.0 :(

pip install --upgrade sphinx-simplepdf

Defaulting to user installation because normal site-packages is not writeable
Collecting sphinx-simplepdf
  Using cached sphinx_simplepdf-1.3.0-py3-none-any.whl
...
...
Installing collected packages: sphinx-simplepdf
Successfully installed sphinx-simplepdf-1.3.0

And now with --no-cache-dir option:

pip install --upgrade sphinx-simplepdf --no-cache-dir
Defaulting to user installation because normal site-packages is not writeable
Collecting sphinx-simplepdf
  Downloading sphinx-simplepdf-1.3.0.tar.gz (1.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.7/1.7 MB 27.7 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
...
...
Building wheels for collected packages: sphinx-simplepdf
  Building wheel for sphinx-simplepdf (setup.py) ... done
  Created wheel for sphinx-simplepdf: filename=sphinx_simplepdf-1.3.0-py3-none-any.whl size=1754139 sha256=0b87471e3a6971c718b5786e91208c6ca91a3d015c53cfdb13fac7ef24b4153c
  Stored in directory: /tmp/pip-ephem-wheel-cache-f7vfi3gb/wheels/9b/49/99/6f8cf450d6b43c83feabc89e0fea981cc5a3a3f0f280e8892e
Successfully built sphinx-simplepdf
Installing collected packages: sphinx-simplepdf
Successfully installed sphinx-simplepdf-1.3.0
danwos commented 1 year ago

You are right, I can reproduce it. Let me create a fresh, clean 1.5.0 and deploy it. One moment please...

danwos commented 1 year ago

1.5.0 got released. Downloading the correct version works on my side.

sachin-suresh-rapyuta commented 1 year ago

Just installed with pip3 install sphinx-simplepdf. I have 1.5.0 now. Had to remove the main.css file under /home/sachin/.local/lib/python3.8/site-packages/sphinx_simplepdf/themes/simplepdf_theme/static/main.css. May be it had reference to old theme. Now the PDF has new theme with make simplepdf.

Just a suggestion: If we can get a clean build removing the multiple WARNING: Anchor defined twice: 'id1' messages, it would be nice!