简体   繁体   中英

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?

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.

    The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

     
    粤ICP备18138465号  © 2020-2024 STACKOOM.COM