0

The Python Package Index (PyPI) is a public repository, and it seems that anyone can upload packages to it using a tool like twine. The openness of the system raises some questions:

  1. Say, a person/organization tries to publish a package, but discovers that the name is already taken. How does PyPI resolve these situations? Is there a bidding mechanism? Or is it just first-come-first-serve?
  2. Let's say someone tries to publish a malicious version of an important package that is in wide use (let's say, sklearn). How do the developers/maintainers of sklearn prevent this from happening? Does PyPI provide any mechanisms to ensure that a given package is only published from verified sources?

1 Answer 1

1

Say, a person/organization tries to publish a package, but discovers that the name is already taken. How does PyPI resolve these situations? Is there a bidding mechanism? Or is it just first-come-first-serve?

It's first-come-first-serve. Unless the person has a valid trademark claim to the name, they'll need to rename their package to something else. (There are procedures for reclaiming a name of a project that's been abandoned, but that can take some time.)

Let's say someone tries to publish a malicious version of an important package that is in wide use (let's say, sklearn). How do the developers/maintainers of sklearn prevent this from happening? Does PyPI provide any mechanisms to ensure that a given package is only published from verified sources?

Each project on PyPI has one or more user accounts associated with it, and only these accounts are allowed to upload files for the project. (When a project is first created, the account that uploaded the initial files will be the only one that can upload additional files. That account can then designate other accounts that will have upload privileges.) Protecting these accounts from hackers is largely outside of PyPI's scope.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.