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

reword the --with help text and deprecate --without #212

Merged
merged 11 commits into from
Nov 17, 2024

Conversation

jonapich
Copy link
Contributor

This fixes #299

  • The help text for --with has been updated to express that groups are never included by default
  • The readme has been updated with this precision as well
  • The --without option has been marked deprecated since it serves no purpose anymore.

Deprecation rationale:

  • No groups are ever included by default, so --without cannot remove anything
  • --only already disables --with and --without (ref)
  • Therefore, --without can only remove groups that the user also provided in --with, which means that the priority (who wins? with or without?) is an implementation detail that isn't documented.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Member

@radoering radoering left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--without main is still a thing, but since --with group --without main is the same as --only group here, there is probably no need for --without.

README.md Outdated Show resolved Hide resolved
@jonapich
Copy link
Contributor Author

pre-commit.ci autofix

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@jonapich jonapich requested a review from radoering November 6, 2024 11:38
README.md Outdated Show resolved Hide resolved
@radoering radoering merged commit 13541e1 into python-poetry:main Nov 17, 2024
17 checks passed
@jonapich jonapich deleted the fix/export-with-documentation branch November 18, 2024 11:20
@bperkins24
Copy link

What is the best way to accomplish this use case? Imagine we have a pyproject.toml as follows:

[tool.poetry.dependencies]
python = "~3.12"

[tool.poetry.group.graphql.dependenvies]
strawberry = ...

[tool.poetry.group.database.dependenvies]
sqlalchemy = ...

[tool.poetry.group.in house tool.dependenvies]
in house library = ...

[tool.poetry.group.dev.dependencies]
pytest = ...

How do we export requirements for main, graphql, database and in house tool groups without explicitly requesting them from poetry export --with ...? The reason for the ask if that we have a cookiecutter template with feature flags and we would like to use that to dynamically create groups in pyproject.toml (mainly for organizational purposes). From there we have a base image that we build which uses poetry export as follows:

  • For our dev image: poetry export --with dev
  • For our prod image: poetry export

Currently, this works fine for us because we only have main and dev groups. However, if we were to add more groups there doesn't seem to be a built-in way to have all requirements except dev exported without explicitly defining them in the command. The options seem to be as follows:

  1. Pass the groups as a docker build arg (con: cumbersome and repetitive across all of our repos)
  2. Parse the groups available in pyproject.toml and build the command manually. I don't see a way via the CLI to get the list of groups from the toml, so we would have to parse ourselves, which is fine but not ideal.

carlcsaposs-canonical added a commit to carlcsaposs-canonical/craft-parts that referenced this pull request Dec 18, 2024
--with is required for optional and non-optional dependencies
see python-poetry/poetry-plugin-export#212 and python-poetry/poetry-plugin-export#299
carlcsaposs-canonical added a commit to carlcsaposs-canonical/charmcraft that referenced this pull request Dec 18, 2024
--with is required for optional and non-optional dependencies

see python-poetry/poetry-plugin-export#212 and python-poetry/poetry-plugin-export#299

corresponding PR in canonical/craft-parts#946
carlcsaposs-canonical added a commit to carlcsaposs-canonical/charmcraft that referenced this pull request Dec 18, 2024
--with is required for optional and non-optional dependencies

see python-poetry/poetry-plugin-export#212 and python-poetry/poetry-plugin-export#299

corresponding PR in canonical/craft-parts#946
carlcsaposs-canonical added a commit to carlcsaposs-canonical/charmcraft that referenced this pull request Dec 19, 2024
--with is required for optional and non-optional dependencies

see python-poetry/poetry-plugin-export#212 and python-poetry/poetry-plugin-export#299

corresponding PR in canonical/craft-parts#946
github-merge-queue bot pushed a commit to canonical/charmcraft that referenced this pull request Dec 19, 2024
--with is required for optional and non-optional dependencies

see python-poetry/poetry-plugin-export#212 and python-poetry/poetry-plugin-export#299

corresponding PR in canonical/craft-parts#946
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

poetry export doesn't include non-optional groups
3 participants