rye icon indicating copy to clipboard operation
rye copied to clipboard

Rye defaults to pypi regardless of configured custom servers.

Open narigama opened this issue 1 year ago • 4 comments

Steps to Reproduce

  • Start up an instance of pypiserver/pypiserver using docker [0].
  • Configure the instance in $HOME/.rye/config.toml as an additional source [1].
  • rye build --clean --wheel
  • rye publish --repository foobar

[0]

docker run --rm -d --name pypi -p 8080:8080 pypiserver/pypiserver

[1]

[[sources]]
name = "foobar"
url = "http://localhost:8080/simple/"
verify-ssl = false

Expected Result

Rye should push a build to the custom pypi server.

Actual Result

Rye defaults to pypi and asks for an access token.

$ rye publish --repository foobar
No access token found, generate one at: https://pypi.org/manage/account/token/
Access token:

Version Info

rye 0.37.0 commit: 0.37.0 (09b67c469 2024-07-20) platform: linux (x86_64) self-python: [email protected] symlink support: true uv enabled: true

Stacktrace

No response

narigama avatar Jul 28 '24 19:07 narigama

when are you first run, you need use:

rye publish --repository foobar --repository_url http://localhost:8080/simple/

rye publish doesn't read config.toml, it looks up ~/.rye/credentials based on the parameters you enter.

Zander-1024 avatar Aug 03 '24 01:08 Zander-1024

I don't think that's it either:

$ rye publish --repository foobar --repository_url http://localhost:8080/simple/

error: unexpected argument found

narigama avatar Aug 03 '24 11:08 narigama

sorry ··· rye publish --repository foobar --repository-url http://localhost:8080/simple/ ···

Zander-1024 avatar Aug 04 '24 01:08 Zander-1024

That doesn't work either, I'm trying to publish to a self-hosted Sonatype Nexus repository, which worked fine with Poetry:

$ ❯ rye publish --repository nexus --repository-url https://nexus.internal/repository/pypi-myrepo/simple
No access token found, generate one at: https://pypi.org/manage/account/token/
Access token:

My ~/.pypirc:

[distutils]
index-servers =
    nexus

[mdz]
repository = https://nexus.internal/repository/pypi-myrepo
username = nexuspypi

The password was stored with keyring as documented in the Twine docs.

Publishing with --repository nexus behaves just the same. How can I published to a custom internal repository with Rye?

-- Update: Specifying --username and --token made it work for me. I think this needs more documentation, publishing to a custom repository is very common and the docs are very bare bones on that use case at the moment.

jbaiter avatar Oct 25 '24 09:10 jbaiter