Installing a local Python project
You can make your own projects installable into your other projects as if you had downloaded them from PyPI following these steps.
1. In the project’s root folder, create a file named setup.py with these contents:
import setuptools
setuptools.setup()
2. In the same folder, create a file named setup.cfg with these contents:
[metadata]
name = Your App Name Here
[options]
packages = your_package_name_here
python_requires = >=3.7
package_dir =
=.
You may want to change the app name, package name, and minimum Python version. There’s also a lot more that can be added to this file to help with certain situations (see links below).
3. In each package folder in your project, create an empty file named __init__.py.
4. Use this terminal command while in the project’s directory: pip install -e .
Now you can import your projects using statements like these:
from app_name.module_name import class_or_function_or_variable
from app_name import other_module_name
You might want to add import statements to your __init__.py files to simplify the import statements used for this project elsewhere.