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

Issue Using Poetry in Non-package mode #39

Open
rhit-mierowir opened this issue May 8, 2024 · 2 comments
Open

Issue Using Poetry in Non-package mode #39

rhit-mierowir opened this issue May 8, 2024 · 2 comments

Comments

@rhit-mierowir
Copy link

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
Copy link
Member

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
Copy link
Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants