“pip3 install -e . what is -e” was my first question. The next one came with a directory tree and an error. I could see the SQL service's pyproject.toml, yet pip, Python's package installer, printed this message (the beginning of the local path is omitted).
…/server-py/src does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.
I had asked pip to install server-py/src/. The project configuration was one directory up, in server-py/. The -e option selects an editable installation, which lets me work on the source in place. The path following it selects the project. For a local directory pip checks that directory for the project configuration. From server-py/, the right command is python -m pip install -e . because . means the current directory.12
Where did the path in the error come from?
My shell history had three successive installation targets: /src, src and .. Here is the part of the tree that explains the difference.2
SqlQueryManagement/
└── server-py/ ← working directory for the original command
├── pyproject.toml ← project name, dependencies and build settings
└── src/
└── sqlman/
└── main.py ← Python source for the service
On this machine /src meant a directory named src at the root of the filesystem. Without the leading slash, src meant the subdirectory of my current working directory. That second command therefore looked for server-py/src/pyproject.toml or the older server-py/src/setup.py. Neither file existed there. pip did not go looking in the parent directory.1
How do I install from the right directory?
Starting at the repository root, SqlQueryManagement/, enter the backend project first. The middle two lines use Python's venv module to create and activate a virtual environment on macOS or Linux. That gives the project its own set of installed packages.3
cd server-py
python3 -m venv .venv
. .venv/bin/activate
python -m pip install -e .
python -m pip runs pip with the Python interpreter from that environment. If you're already in server-py/, start at the second line. In Windows PowerShell, create the environment with py -m venv .venv and activate it with .\.venv\Scripts\Activate.ps1. The install command is the same.
If the environment is already active and you want to stay at the repository root, run python -m pip install -e ./server-py. Both forms reach the same configuration file. The project declares its optional development tools under the name dev. From the backend directory, python -m pip install -e ".[dev]" includes them too. The complete FastAPI project example.12
If pip installs server-py, how does Python find the code under src?
Once pip has found pyproject.toml it can read the build instructions. My project contained these settings for packaging and testing.2
📓 Note: Hatchling is the build tool this project selects. A wheel is a Python installation archive with a
.whlextension. In a regular build it holds the package files and installation metadata. For an editable installation, Hatchling creates a temporary wheel that lets pip set up imports from the source tree. PEP 660 calls that wheel “ephemeral communication between the build system and the front end.”45
[tool.hatch.build.targets.wheel]
packages = ["src/sqlman"]
[tool.pytest.ini_options]
pythonpath = ["src"]
Both settings refer to the same source file, src/sqlman/main.py. Hatchling needs the package to include. pytest needs the directory where Python should start looking for that package.
- At build time,
packages = ["src/sqlman"]selects thesqlmandirectory. The resulting wheel containssqlman/main.py. I also triedpackages = ["src"]in this layout. It selected the outer directory, and the wheel then containedsrc/sqlman/main.py.6 - At test time,
from sqlman import mainalready supplies the namesqlman. Withpythonpath = ["src"], Python searches insidesrc/, findssqlman/and thenmain.py. If this search entry weresrc/sqlman, Python would look for anothersqlmanunderneath it.7
Both settings live in server-py/pyproject.toml. The install target is still server-py/. After an editable install, restarting the service picks up edits to an existing main.py. Saving the file doesn't rebuild the wheel. A separate local dependency has its own installation mode.8
To verify the repair without relying on pytest's settings, import the module in the same virtual environment and print __file__, the path Python actually loaded.
python -c "from sqlman import main; print(main.__file__)"
I tried both correct installation paths. Each printed a filename ending in server-py/src/sqlman/main.py. The directory tree already worked. Moving the install target up one level let pip read the instructions that point to the source.
Footnotes
-
The pip developers. (2025). pip, v25.1.1. GitHub. Local project installs · Directory checks in is_installable_dir. ↩ ↩2 ↩3
-
CaiBorui [S2thend]. (2025, July 2). Add Python backend service [commit b088abf]. GitHub. server-py/pyproject.toml. ↩ ↩2 ↩3 ↩4
-
Python Software Foundation. (n.d.). venv — Creation of virtual environments. Python 3.12 Documentation. Creating and activating virtual environments. ↩
-
Holth, D. (2012, September 20). PEP 427 – The Wheel Binary Package Format 1.0. Python Enhancement Proposals. Abstract and wheel layout. ↩
-
Holth, D., & Bidoul, S. (2021, March 30). PEP 660 – Editable installs for pyproject.toml based builds (wheel based). Python Enhancement Proposals. Terminology and goals · The build_editable hook, paragraph on the temporary wheel. ↩
-
Hatch contributors. (2025). Build configuration. Hatchling 1.27.0. GitHub. Selecting packages. ↩
-
pytest developers. (n.d.). Configuration options. pytest 8.4 Documentation. The pythonpath configuration option. ↩
-
For example,
python -m pip install -e ../shared_libmakes edits to that library's Python source visible to a new interpreter. A regularpython -m pip install ../shared_libinstalls a copy that must be reinstalled after edits. Changing declared dependencies or command-line entry points also requires another install, even in editable mode. PEP 660, terminology and goals. ↩