How to define my package name in Pypi?

Asked

Viewed 40 times

0

I am creating a python module to distribute in pypi, I am studying the process of creating distribution of modules by some tutorials and the pypi guide itself, but even so I still have some doubts. Follow the tree of my project to help with the questions:

    |_ meupacote
      |_ DESCRIPTION.rst
      |_ LICENSE
      |_ README.md
      |_ setup.cfg
      |_ setup.py
      |_ src
        |_ __pycache__
        |_ __init__.py
        |_ __main__.py
        |_ meupacote.py
      |_ tests
      |_ venv

I wanted to know:

1 - What will be the name that will be in the module, whether it will be "mypackage" or will be "src"?

2 - How will it look to import, after the module is ready and distributed?

3 - Is there anything I can do in "setup" or other place to specify how I want the module/package to be?

Ps.: The name "meupacote" is merely illustrative.

  • consider the possibility of listing the question title to better reflect the content. Something like "How to define the name of my package in Pypi?"

  • Thanks for the suggestion Lucas

1 answer

1


All metadata of your package (such as name, version, author, etc.) are in the file setup.py. Here an example file of this type:

from distutils.core import setup

setup(
  name = 'YOURPACKAGENAME',          
  packages = ['YOURPACKAGENAME'],   
  version = '0.1',       
  license='MIT',        
  description = 'TYPE YOUR DESCRIPTION HERE',   
  author = 'YOUR NAME',                  
  author_email = '[email protected]',      
  url = 'https://github.com/user/reponame',   
  download_url = 'https://github.com/user/reponame/archive/v_01.tar.gz',    
  keywords = ['SOME', 'MEANINGFULL', 'KEYWORDS'],   
  install_requires=[            
          'validators',
          'beautifulsoup4',
      ],
  classifiers=[
    'Development Status :: 3 - Alpha',      
    'Intended Audience :: Developers',      
    'Topic :: Software Development :: Build Tools',
    'License :: OSI Approved :: MIT License',   
    'Programming Language :: Python :: 3',      
    'Programming Language :: Python :: 3.4',
    'Programming Language :: Python :: 3.5',
    'Programming Language :: Python :: 3.6',
  ],
)

Note that PACKAGENAME is the name your package will receive in Pypi and you will use to import.

This example setup.py I took from this text. I always use it when I create a new package.

If you want to see a practical example, see the files for this bundle that I recently created.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.