Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to have optional extra dependencies #7911

Closed
2 tasks done
matt035343 opened this issue May 12, 2023 · 3 comments
Closed
2 tasks done

Ability to have optional extra dependencies #7911

matt035343 opened this issue May 12, 2023 · 3 comments
Labels
kind/feature Feature requests/implementations status/triage This issue needs to be triaged

Comments

@matt035343
Copy link

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the FAQ and general documentation and believe that my question is not already covered.

Feature Request

With pandas 2.0 also comes optional dependencies. However, I only sometimes need some of the extras, depending on the selected extras in my own project, to avoid bloating of the installation. For example, in my Poetry project I always need pandas, but only when my database extra is installed, the pandas SQL extra dependencies (postgresql, mysql, sql-other) should be installed.
I currently have not found a way to do this that the installed extra dependencies of a dependency can depend on the extra chosen for my own project.

I believe there are multiple ways of going about this, I have two suggestions below.

Being able to label dependency specifications and use those in the extra specification

[tool.poetry]
name = "packagename"
version = "0.0.0"
description = "..."
authors = ["..."]
maintainers = ['...']
license = 'Apache 2.0'
readme = "README.md"
repository = 'https://github.com/...'

[tool.poetry.dependencies]
python = ">=3.9, <3.12"
pandas = { version = "^2.0.0"}
pandas = { version = "^2.0.0", extras = ["performance", "postgresql", "mysql", "sql-other"], label="pandas-databases", optional=true }


[tool.poetry.extras]
databases = [
    'SQLAlchemy',
    'pyodbc',
    'pandas-databases'
]

Use a notation similar to pip in the extra specification, potentially with declaration of optional extras

[tool.poetry]
name = "packagename"
version = "0.0.0"
description = "..."
authors = ["..."]
maintainers = ['...']
license = 'Apache 2.0'
readme = "README.md"
repository = 'https://github.com/...'

[tool.poetry.dependencies]
python = ">=3.9, <3.12"
pandas = { version = "^2.0.0", optional_extras=["performance", "postgresql", "mysql", "sql-other"]}


[tool.poetry.extras]
databases = [
    'SQLAlchemy',
    'pyodbc',
    'pandas[performance,postgresql,mysql,sql-other]'
]
@matt035343 matt035343 added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels May 12, 2023
@dimbleby
Copy link
Contributor

dimbleby commented May 12, 2023

duplicate #834, #3913, #5733, #6053, #7738, ...

@george-zubrienko
Copy link

george-zubrienko commented May 29, 2023

duplicate #834, #3913, #5733, #6053, #7738, ...

Alright, to be fair this is not a small repo, so assessing whether this is a duplicate or not is not easy from outside the contributor circle. I've read all those linked issues and the conclusion is, this is not possible atm? Or how should we understand a variable list of issue hyperlinks?

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Feature requests/implementations status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

4 participants