Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip install .[dev] with pyproject.toml not working

Tags:

python

When I run pip install .[dev]

I get zsh: no matches found: .[dev]

I have the following pyproject.toml and python version 3.10.2

[project]
name = "kafka-test-1"
version = "3.0.0"  # Required
description = "A sample kafka Python project"

readme = "README.md"

requires-python = ">=3.10"

license = { file = "LICENSE.txt" }

keywords = ["kafka", "python", "test"]

authors = [
    { name = "piwero", email = "[email protected]" }
]

dependencies = [
    "confluent-kafka", "confluent-kafka", "configparser"
]

[project.optional-dependencies] # Optional
dev = ["black", "ruff"]
test = ["coverage", "pytest"]


[tool.setuptools]
package-data = { "sample" = ["*.dat"] }

[build-system]
requires = ["setuptools>=43.0.0", "wheel"]
build-backend = "setuptools.build_meta"

Any idea why is this? When I do pip install . works fine but I want to install dev and test.

like image 689
Piwero Avatar asked Feb 26 '26 13:02

Piwero


1 Answers

Quote the .dev part:

pip install '.[dev]'

Nothing to do with Python, Pip or a pyproject.toml file. Just the shell.

That is because the most common shells interpret the brackets, [], as special, for character sets, such as [1234] (meaning any one characater of the set of characters 1, 2, 3 or 4). Here's the documentation for zsh on this type of globbing pattern.

That is why you get this error: the shell can't match .[dev] with anything. Quoting it (double quotes probably also work in this case) will avoid the shell interpreting this, and the result gets passed on to pip as the single string .[dev].

like image 56
9769953 Avatar answered Mar 01 '26 02:03

9769953



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!