What is the difference between `extras_require()` and `install_requires()` in setup.py?

According to the setuptools documentation, extras_require A dictionary mapping names of “extras” (optional features of your project) to strings or lists of strings specifying what other distributions must be installed to support those features. and install_requires A string or list of strings specifying what other distributions need to be installed when this one is. The … Read more

How to include and install local dependencies in setup.py in Python?

There is a new technique (Since version 19.1) called Direct references. Just pretend like your file is hosted on localhost. from setuptools import setup path_to_my_project = “/home/user/projects/my_package” # Do any sort of fancy resolving of the path here if you need to setup(# … other arguments install_requires=[f”my_package @ file://localhost/{path_to_my_project}#egg=my_package”] )

distutils: How to pass a user defined parameter to setup.py?

As Setuptools/Distuils are horribly documented, I had problems finding the answer to this myself. But eventually I stumbled across this example. Also, this similar question was helpful. Basically, a custom command with an option would look like: from distutils.core import setup, Command class InstallCommand(Command): description = “Installs the foo.” user_options = [ (‘foo=’, None, ‘Specify … Read more

requirements.txt vs setup.py

requirements.txt: This helps you to set up your development environment. Programs like pip can be used to install all packages listed in the file in one fell swoop. After that you can start developing your python script. Especially useful if you plan to have others contribute to the development or use virtual environments. This is … Read more

pip install . creates only the dist-info not the package

Since the question has become quite popular, here are the diagnosis steps to go through when you’re missing files after installation. Imagine having an example project with the following structure: root ├── spam │ ├── __init__.py │ ├── data.txt │ ├── eggs.py │ └── fizz │ ├── __init__.py │ └── buzz.py ├── bacon.py └── setup.py … Read more