In my Node.JS projects, I save my project metadata into package.json: dependencies, version number, author, description, and so on. This makes it so anyone can clone my project and run npm install to create a virtually identical local environment.

Is there a such thing for Python? Some sort of standard file where I can save project metadata, including a version number and PIP dependencies?

  • Possibly Python eggs is what you are looking for. This is the standard format for Python code distribution.
    – 9000
    Commented Jan 22, 2015 at 5:20
  • 1
    There's a good guide to getting an open-source Python project set up here: jeffknupp.com/blog/2013/08/16/…
    – jonrsharpe
    Commented Jan 22, 2015 at 10:26

1 Answer 1


Python setuptools is a module that you use to write a script, called setup.py in the main directory of your Python project. For distribution purposes, you can use your setup.py to make a Python egg. 9000's link goes into more detail about how to make the egg.

The first link contains detailed documentation on how to write the perfect setup.py, but below is a complete example modified for a Python project I wrote some time ago.

from setuptools import setup

def readme():
    This is a function I wrote to read my README file and return it.
    with open('README.rst') as f:
        return f.read()

      description='An answer to a question on StackOverflow',
      long_description=readme(), # Get that README.rst
          'Development Status :: 3 - Alpha',
          'License :: OSI Approved :: MIT License',
          'Programming Language :: Python :: 3.0'
      keywords='questions answers programming',
      author_email='[email protected]',
      entry_points = {
          'console_scripts' :
      test_requires=['nose', 'nose-cover3'], # Requirements for the test suite

You can also use a requirements.txt file to list dependencies. This blog post goes into pretty good detail about the difference between requirements.txt and setup.py.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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