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

Fails with poetry-core 1.6.0 #1

Closed
brandonchinn178 opened this issue May 22, 2023 · 8 comments
Closed

Fails with poetry-core 1.6.0 #1

brandonchinn178 opened this issue May 22, 2023 · 8 comments

Comments

@brandonchinn178
Copy link

Getting the following error:

  ModuleNotFoundError

  No module named 'poetry.core.toml'

  at ~/.lydev/poetry/venv/lib/python3.8/site-packages/poetry_source_env/plugin.py:7 in <module>
        3│ from os.path import expandvars
        4│
        5│ from cleo.io.io import IO
        6│ from dict_deep import deep_get
    →   7│ from poetry.core.toml.file import TOMLFile
        8│ from poetry.plugins.plugin import Plugin
        9│ from poetry.poetry import Poetry
       10│ from poetry.repositories.legacy_repository import LegacyRepository
       11│ from pydantic import BaseSettings, validate_arguments

That module seems to have been deleted in poetry-core 1.6.0, bundled with poetry 1.5.0: python-poetry/poetry-core#483

@brandonchinn178
Copy link
Author

brandonchinn178 commented May 22, 2023

Downgrading to poetry 1.4, I'm getting

Only one repository can be the default

Also, installing poetry-source-env itself doesn't use the repository information (understandably so, since that's why we're installing the plugin in the first place), which kinda defeats the purpose

@celsiusnarhwal
Copy link
Owner

celsiusnarhwal commented May 22, 2023

Hi, thanks for reporting. I'll look into this when I get a chance. 👍🏾

@celsiusnarhwal
Copy link
Owner

celsiusnarhwal commented May 23, 2023

That module seems to have been deleted in poetry-core 1.6.0, bundled with poetry 1.5.0: python-poetry/poetry-core#483

That and other changes made in Poetry 1.5.0 break poetry-source-env in ways that are totally fixable but would themselves break the plugin on earlier versions of Poetry (namely python-poetry/poetry#7658). Save for a satisfactory way to maintain support for both Poetry ≤ 1.4.x and Poetry ≥ 1.5.0, the next version of poetry-source-env will be a major release that supports Poetry 1.5.x and later exclusively.

Downgrading to poetry 1.4, I'm getting

Only one repository can be the default

This error arises from Poetry. PyPI is implicitly configured as the default source; if you configure another source as the default without explicitly making PyPI not the default, you'll get that error message. If you're sure that a faulty configuration on your end isn't the problem, we can investigate this further.

Also, installing poetry-source-env itself doesn't use the repository information (understandably so, since that's why we're installing the plugin in the first place), which kinda defeats the purpose

What do you mean by this?

@brandonchinn178
Copy link
Author

What do you mean by this?

Running poetry self add poetry-source-env fetches poetry-source-env from files.pythonhosted.com, not the repos configured in env vars.

This makes sense, because poetry doesnt know to use the env vars before installing poetry-source-env. But I'm just pointing this out as a problem poetry-source-env might want to take a look at; e.g. in the original poetry issue, someone pointed out a solution using ~/.config/poetry/pyproject.toml

@celsiusnarhwal
Copy link
Owner

celsiusnarhwal commented May 23, 2023

Running poetry self add poetry-source-env fetches poetry-source-env from files.pythonhosted.com, not the repos configured in env vars.

As far as I can tell, Poetry does not load plugins when executing poetry self commands, so what you're asking is unfortunately impossible. If and when python-poetry/poetry#5958 is resolved, Poetry will hopefully be able to do this on its own.

@celsiusnarhwal
Copy link
Owner

celsiusnarhwal commented May 23, 2023

poetry-source-env 2.0.0 has been released, requiring Poetry 1.5.0 or later. You may need to invoke Poetry with the --no-plugins option in order to get around failures that could arise from temporary incompatibilities between Poetry and poetry-source-env as you update both.

If your issues persist, feel free to leave another comment here.

@brandonchinn178
Copy link
Author

what you're asking is impossible

That's not true, this is one way you can do it:

python-poetry/poetry#5958 (comment)

The README should mention this step before running poetry self add poetry-source-env, in case someone wanting to use poetry-source-env can't access the internet at all

@celsiusnarhwal
Copy link
Owner

That's not true, this is one way you can do it:

python-poetry/poetry#5958 (comment)

Minor clarification: it's impossible for poetry-source-env to accomplish.

I appreciate your suggestion, though — I'll add that information to the README.

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

No branches or pull requests

2 participants