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

Exported requirements.txt contains spurious messages if lock file does not exist #175

Open
3 of 4 tasks
pdecat opened this issue Jan 11, 2023 · 4 comments
Open
3 of 4 tasks

Comments

@pdecat
Copy link

pdecat commented Jan 11, 2023

  • Poetry version: 1.3.2
  • Python version: 3.10.6
  • OS version and name: Ubuntu 22.04.1
  • pyproject.toml: just create it with poetry new poetry-demo:
[tool.poetry]
name = "poetry-demo"
version = "0.1.0"
description = ""
authors = ["Patrick Decat"]
readme = "README.md"
packages = [{include = "poetry_demo"}]

[tool.poetry.dependencies]
python = "^3.10"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
  • I am on the latest stable Poetry version, installed using a recommended method.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

When lock file does not exist, poetry export writes some messages to standard output:

# poetry --version
Poetry (version 1.3.2)

# poetry new poetry-demo
Created package poetry_demo in poetry-demo

# cd poetry-demo/

# poetry export -f requirements.txt > requirements.txt
The lock file does not exist. Locking.
Creating virtualenv poetry-demo in /home/patrick/workspaces/tests/poetry/poetry-demo/.venv

# cat requirements.txt
Updating dependencies
Resolving dependencies...

Writing lock file

Related:

@dimbleby
Copy link
Contributor

poetry export -o requirements.txt

@pdecat
Copy link
Author

pdecat commented Jan 11, 2023

Hi @dimbleby, I know that option to output directly to a file, but as I need to post-process it to remove some dependencies which are provided by AWS Lambda python runtime, it is more practical to process the standard output directly, e.g.:

poetry export -f requirements.txt --without-hashes | grep -v '^\(boto3\|botocore\|s3transfer\)==' | tee layer/requirements.txt

Given precedent on python-poetry/poetry#4110, it was my impression redirecting standard output to a requirements.txt file or pipe it into another command was an accepted use case.

Isn't that the case anymore?

@dimbleby
Copy link
Contributor

IMO it never was, but there's no harm in being helpful in the main line case.

Your particular sub-issue could also be solved by locking before exporting, which seems pretty reasonable.

@pdecat
Copy link
Author

pdecat commented Jan 11, 2023

Your particular sub-issue could also be solved by locking before exporting, which seems pretty reasonable.

Indeed. Anyway, we do have checks to catch this in our CI.

@neersighted neersighted transferred this issue from python-poetry/poetry Jan 11, 2023
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

No branches or pull requests

2 participants