sphinx-notes / pages

Github Actions for publishing Sphinx HTML output to github pages
https://sphinx.silverrainz.me/pages/
MIT License
74 stars 33 forks source link

Issue Using Poetry in Non-package mode #39

Open rhit-mierowir opened 1 month ago

rhit-mierowir commented 1 month ago

I have been trying to use this to deploy sphinx pages automatically. The issue seems to involve loading requirements from my pyproject.toml function, which was mostly generated using Poetry. For my use case I didn't want to run Poetry in package mode, as I didn't see the value in having the code available from Pypi. This, however, seems to make poetry fail to build the package (as it should, I just don't think this should be invoked), and I can't figure out why this issue is occurring or how to avoid it. I tried messing with some optional arguments, but they didn't seem to help.

I have included a link to my testing repo below. https://github.com/rhit-mierowir/TestingGithub/blob/main/.github/workflows/sphinx-to-GHPages.yml

I think the error is happening here, and I am not sure what to do about it. image

This is the error message I get: image ... image

Is there a way to compile sphinx in a non-package mode?

SilverRainZ commented 1 month ago

It seems the value of build-system in pyproejct.toml changes the behavior of pip? I am not poetry user so I know nothing about poetry's "non-package mode".

Does python -mpip install .[docs] work on your local?

rhit-mierowir commented 1 month ago

Sorry for the delay, but I finally got around to testing that command out. It doesn't work, and I don't think I can get it to. From what I can tell, this call to pip requires the following structure: image

However, Poetry creates the following structure for dependencies in the "docs" group shown below: image

I looked around a bit and I am unaware of a way to map this structure into the one shown above, and the two don't seem particularly compatible. Now that I know the command giving me the error, it seems that pip is automatically invoking poetry for some reason in a way that requires package mode, causing the previous error.

I believe all this part is doing is grabbing the dependencies necessary to build the sphinx page, and if so that could be done with poetry, as I will explain below. If so, would it be possible to add support to poetry?

Create a dependency group and add sphinx to it, this can be done to add each additional dependency to the docs group: ProjectDirectory$ poetry add sphinx --group docs

Install all packages only from the docs group: (to show dependencies replace "install" with "show") ProjectDirectory$ poetry install --only docs

To detect if a project uses poetry you could run: "poetry show", which fails with no pyproject.toml file or if [tool.poetry] can't be found. More commands: https://python-poetry.org/docs/cli/#add

Would it be reasonable to add a flag/setting to the interface that runs the install command instead using poetry instead of the "pip install .[docs]" method?