-
-
Notifications
You must be signed in to change notification settings - Fork 619
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
When using self-referential extras in pyproject.toml, the package is added to the requirements #2002
Comments
|
I understand what you're actually trying to do, but I'm not sure that it's possible to express. Personally, I would just include |
Alternative opinion: I dislike the use of extras for test/dev deps — they are basically your public API so why would you expose them to the non-contributing end-users? I think, it's semantically wrong. |
Though, I've seen this |
The example I gave above was intended to be easy to replicate. Here is a real world example using pandas pyproject.toml [project.optional-dependencies]
test = ['hypothesis>=6.46.1', 'pytest>=7.3.2', 'pytest-xdist>=2.2.0', 'pytest-asyncio>=0.17.0']
performance = ['bottleneck>=1.3.4', 'numba>=0.55.2', 'numexpr>=2.8.0']
computation = ['scipy>=1.8.1', 'xarray>=2022.03.0']
fss = ['fsspec>=2022.05.0']
aws = ['s3fs>=2022.05.0']
gcp = ['gcsfs>=2022.05.0', 'pandas-gbq>=0.17.5']
excel = ['odfpy>=1.4.1', 'openpyxl>=3.0.10', 'python-calamine>=0.1.6', 'pyxlsb>=1.0.9', 'xlrd>=2.0.1', 'xlsxwriter>=3.0.3']
parquet = ['pyarrow>=7.0.0']
feather = ['pyarrow>=7.0.0']
hdf5 = [# blosc only available on conda (https://github.com/Blosc/python-blosc/issues/297)
#'blosc>=1.20.1',
'tables>=3.7.0']
spss = ['pyreadstat>=1.1.5']
postgresql = ['SQLAlchemy>=1.4.36', 'psycopg2>=2.9.3']
mysql = ['SQLAlchemy>=1.4.36', 'pymysql>=1.0.2']
sql-other = ['SQLAlchemy>=1.4.36']
html = ['beautifulsoup4>=4.11.1', 'html5lib>=1.1', 'lxml>=4.8.0']
xml = ['lxml>=4.8.0']
plot = ['matplotlib>=3.6.1']
output-formatting = ['jinja2>=3.1.2', 'tabulate>=0.8.10']
clipboard = ['PyQt5>=5.15.6', 'qtpy>=2.2.0']
compression = ['zstandard>=0.17.0']
consortium-standard = ['dataframe-api-compat>=0.1.7']
all = ['beautifulsoup4>=4.11.1',
# blosc only available on conda (https://github.com/Blosc/python-blosc/issues/297)
#'blosc>=1.21.0',
'bottleneck>=1.3.4',
'dataframe-api-compat>=0.1.7',
'fastparquet>=0.8.1',
'fsspec>=2022.05.0',
'gcsfs>=2022.05.0',
'html5lib>=1.1',
'hypothesis>=6.46.1',
'jinja2>=3.1.2',
'lxml>=4.8.0',
'matplotlib>=3.6.1',
'numba>=0.55.2',
'numexpr>=2.8.0',
'odfpy>=1.4.1',
'openpyxl>=3.0.10',
'pandas-gbq>=0.17.5',
'psycopg2>=2.9.3',
'pyarrow>=7.0.0',
'pymysql>=1.0.2',
'PyQt5>=5.15.6',
'pyreadstat>=1.1.5',
'pytest>=7.3.2',
'pytest-xdist>=2.2.0',
'pytest-asyncio>=0.17.0',
'python-calamine>=0.1.6',
'pyxlsb>=1.0.9',
'qtpy>=2.2.0',
'scipy>=1.8.1',
's3fs>=2022.05.0',
'SQLAlchemy>=1.4.36',
'tables>=3.7.0',
'tabulate>=0.8.10',
'xarray>=2022.03.0',
'xlrd>=2.0.1',
'xlsxwriter>=3.0.3',
'zstandard>=0.17.0'] It would be possible to create a group of optional dependencies. For example, The |
AFAIK, there's no way to express dependencies this way in
|
This is understandable and ok, since installing
but having a reference to the local filesystem as indicated in the issue description
breaks compatibility of the resulting file with Since this syntax presumably is the only declarative way (within |
Pip supports only this way. |
As a workaround for now, I found applying the following CLI options works
Like this, the breaking reference of Note that this command now pins the previously "unsafe" packages (like |
Another thought in the arena of workarounds (sorry): For me, $ <dev-requirements.in
ruff
-r tests-requirements.in
$ <tests-requirements.in
pytest Then running the $ pypc
$ <pyproject.toml [project]
name = "my-pkg"
version = "0.0.1"
[project.optional-dependencies]
tests = ["pytest"]
dev = ["pytest", "ruff"] |
FYI there's a draft PEP 735 attempting to address this. |
If I run
with the following
pyproject.toml
The result includes a self-reference
I would expect
The text was updated successfully, but these errors were encountered: