FordPrefect
FordPrefect

Reputation: 406

Python package naming convention

I want to create some python packages and deploy them in my company, not on PyPi.

I stumbled over the problem that one package name already existed. So instead of mypackage from our repo I installed a PyPi package.

The obvious solution is to change the name of the package. However, if I don't put the package on PyPi, there are chances somebody will place another package with that name.

I currently see two options. Create a dummy package and put it on PyPi to reserve the name. Or use something like a namespace.

I read about PEP 423, which propose this idea, but it seems not to be agreed on.

Is it anyway a good idea to use this? How would I do it? company.package or company_package? Both are not confirming to PEP 8.

Or is there another way?

Edit:
Playing around with different name spaces I observed the following:

  1. Having a dot in the name is really a bad idea, as it seems not to work.
  2. Underscore does work with one minor annoyance. To install one must run pip install my-package and for import it's import my_package.

Upvotes: 1

Views: 844

Answers (1)

Aaron
Aaron

Reputation: 11075

Don't squat on a name with an empty project. You have already proven your project may have names that are somewhat common "one package name already existed".

According to PEP541 (which was accepted), Your project would be invalid and considered for removal.

A project published on the Package Index meeting ANY of the following is considered invalid and will be removed from the Index:

  • ...
  • project is name squatting (package has no functionality or is empty);
  • ...

  • Instead, use a namespace as you already mentioned.

    Upvotes: 1

    Related Questions