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

Period(s) in repository "name" causes issues #1328

Open
3 tasks done
Caligatio opened this issue Aug 25, 2019 · 7 comments
Open
3 tasks done

Period(s) in repository "name" causes issues #1328

Caligatio opened this issue Aug 25, 2019 · 7 comments
Assignees
Labels
good first issue kind/bug Something isn't working as expected

Comments

@Caligatio
Copy link
Contributor

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Win10
  • Poetry version: 1.0.0b1
  • Link of a Gist with the contents of your pyproject.toml file: N/A

Issue

Adding a custom [[tool.poetry.source]] whose name includes a period causes issues when paired with http_basic settings. The add_property method on the ConfigSource object blindly splits on periods, including those in the repo name. The side effect of this is that the resulting TOML becomes very "deep."

I'm happy to do a PR but I'm curious to know how much name checking is appropriate.

@brycedrennan brycedrennan added the kind/bug Something isn't working as expected label Aug 25, 2019
@stale
Copy link

stale bot commented Nov 13, 2019

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the wontfix label Nov 13, 2019
@sdispater sdispater added stale and removed wontfix labels Nov 14, 2019
@stale stale bot removed the stale label Nov 14, 2019
@abn
Copy link
Member

abn commented Apr 28, 2022

This is still an issue. The following does not work, when parsing the property we either need to canonicalise the name or qoute the key.

poetry config http-basic."foo.bar" username password

@John15321
Copy link
Contributor

@abn
What is the desired behavior?

@Mohsin-Ul-Islam
Copy link

@abn Hi, can I work on this if available?

@rumbleFTW
Copy link

Is this still an issue, as of August 2023?
If yes, then can I have some pointers on how to fix this? Thank you.

@abn
Copy link
Member

abn commented Mar 23, 2024

The relevant code that handles the parsing of name is at

m = re.match(r"^(http-basic|pypi-token)\.(.+)", self.argument("key"))
if m:
from poetry.utils.password_manager import PasswordManager
password_manager = PasswordManager(config)
if self.option("unset"):
if m.group(1) == "http-basic":
password_manager.delete_http_password(m.group(2))
elif m.group(1) == "pypi-token":
password_manager.delete_pypi_token(m.group(2))
return 0
if m.group(1) == "http-basic":
if len(values) == 1:
username = values[0]
# Only username, so we prompt for password
password = self.secret("Password:")
assert isinstance(password, str)
elif len(values) != 2:
raise ValueError(
"Expected one or two arguments "
f"(username, password), got {len(values)}"
)
else:
username = values[0]
password = values[1]
password_manager.set_http_password(m.group(2), username, password)
.

Fixing this also requires handling the repository configuration regexes, both fetching values and setting values.

@jawadMansoor
Copy link

This seemed to be solved in main. @abn

@Secrus Secrus self-assigned this Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

10 participants