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

Fix plugin get directory from poetry #211

Merged
merged 3 commits into from
Apr 13, 2024
Merged

Conversation

worldworm
Copy link
Contributor

#209

With a bit of tinkering, I found application.poetry.pyproject_path. This contains the path to pyproject.toml

Using the example of #209:
Running poetry --directory backend install from the dir project/ the attribute application.poetry.pyproject_path has the value backend/pyproject.toml
Running poetry install from the dir project/backend/ the attribute application.poetry.pyproject_path has the value /project/backend/pyproject.toml

I hope I haven't missed anything essential 😃

@nat-n
Copy link
Owner

nat-n commented Apr 6, 2024

Hey @worldworm, thanks for contributing this fix! It looks good.

It might be a good idea to add a test case for this to make sure it stays fixed: https://github.com/nat-n/poethepoet/blob/main/tests/test_poetry_plugin.py What do you think?

@nat-n nat-n added the bug Something isn't working label Apr 6, 2024
@worldworm
Copy link
Contributor Author

Oh, that's an excellent idea. I totally forgot about those. 😄

Unfortunately, after several attempts, I still haven't managed to get the test cases green. The --directory command doesn't seem to be recognized.
I have a feeling that it might have something to do with the older version of poetry that is used for the test cases.

"./tests/fixtures/packages/poetry-1.2.1-py3-none-any.whl",

I'll take a closer look tomorrow and get back to you.

@nat-n
Copy link
Owner

nat-n commented Apr 8, 2024

"./tests/fixtures/packages/poetry-1.2.1-py3-none-any.whl",

Indeed, hopefully it's easy to update the poetry version for testing!

@worldworm
Copy link
Contributor Author

So, it seems to me that the attribute from which I organised the path (application.poetry.pyproject_path) was introduced in a newer poetry version that is > 1.2.1. That explains why i had no success with test cases yesterday.

I have now simply downloaded a new poetry version (the wheel directly from here). If I understand correctly, this is only used for the test cases and should therefore have no effect on other things.

However, this shows that my changes are not breaking changes, as in the case of an older poetry version my except statement applies and the cwd is calculated as before. 😃

Copy link
Owner

@nat-n nat-n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the contribution!

@nat-n nat-n merged commit 262017f into nat-n:main Apr 13, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants