zestsoftware / zest.releaser

Python software releasing made easy and repeatable
https://zestreleaser.readthedocs.io
GNU General Public License v2.0
198 stars 62 forks source link

Unable to choose repository for upload automatically #351

Closed LvffY closed 3 years ago

LvffY commented 4 years ago

Hello,

First, thanks your all your work :)

I'm kind of a newbie in Python package releases but from what I saw from my other experiences, your project is very simple to use and effective ! :)

Here is my problem : In my case, I could have many private PyPi. Actually, our purpose is to have 1 PyPi repository per projet grouped in 1 big group nexus repository for customers entry point.

For this, I have setup my `~/.pypirc' file like this :

[distutils]
index-servers =
    pypi-project1
    pypi-project2

[pypi-project1]
repository=http://myServer1/repository/PROJECT1_RELEASE/
username=user1
password=pwd1

[pypi-project1]
repository=http://myServer2/repository/PROJECT2_RELEASE/
username=user2
password=pwd2

For now, with manual fullrelease command, I'm always asked for each repository if I want to upload my codes. Is there any configurations that I missed that could, in case of --no-input option, automatically upload to only one of my repository ?

Sorry, if I missed an issue discussing about this and thanks in advance for your responses !

LvffY commented 4 years ago

Apologize for not reading the docs, I found my solution ...

If anyone fall into this problem, I solved my problem by :

[distutils]
index-servers =
    pypi-project1
    pypi-project2

[pypi-project1]
repository=http://myServer1/repository/PROJECT1_RELEASE/
username=user1
password=pwd1

[pypi-project1]
repository=http://myServer2/repository/PROJECT2_RELEASE/
username=user2
password=pwd2
[distutils]
index-servers =
    pypi-project1

I found the solution by reading (more properly) the docs especially :

« Note that since version 3.15, zest.releaser also looks for this information in the setup.cfg if your package has that file. One way to use this, is to restrict the servers that zest.releaser will ask you to upload to. If you have defined 40 index-servers in your pypirc but you have the following in your setup.cfg, you will not be asked to upload to any server:

distutils]
index-servers =

»

By analogy, I solved my own problem. May be another example could be a good idea to image this problem ?

Anyway, sorry for the issue that wasn't one ... And once again, thanks for your work ! :)

reinout commented 4 years ago

Good that you found it in the docs. I only upload to pypi myself, so I didn't know this setting existed :-) Probably @mauritsvanrees added this functionality.

Your example looks like it is handy to add to the docs:

[distutils]
index-servers =
    pypi-project1

? @mauritsvanrees, do you agree?

mauritsvanrees commented 4 years ago

PR made: https://github.com/zestsoftware/zest.releaser/pull/352

LvffY commented 4 years ago

@mauritsvanrees Thanks a lot ! :)

mauritsvanrees commented 3 years ago

As an alternative to the above, since version 6.21.0 you can set an environment variable that twine picks up. In your case:

export TWINE_REPOSITORY=pypi-project1
fullrelease