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

Add an option to set output directory on build #7208

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ Note that, at the moment, only pure python wheels are supported.
### Options

* `--format (-f)`: Limit the format to either `wheel` or `sdist`.
* `--output (-o)`: Set output directory for build artifacts.

## publish

Expand Down
16 changes: 10 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ generate-setup-file = false
[tool.poetry.dependencies]
python = "^3.7"

poetry-core = "1.4.0"
# subject to change after poetry-core is released
poetry-core = {git = "https://github.com/python-poetry/poetry-core", branch = "main"}
poetry-plugin-export = "^1.2.0"
"backports.cached-property" = { version = "^1.0.2", python = "<3.8" }
cachecontrol = { version = "^0.12.9", extras = ["filecache"] }
Expand Down
5 changes: 3 additions & 2 deletions src/poetry/console/commands/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class BuildCommand(EnvCommand):
description = "Builds a package, as a tarball and a wheel by default."

options = [
option("format", "f", "Limit the format to either sdist or wheel.", flag=False)
option("format", "f", "Limit the format to either sdist or wheel.", flag=False),
option("output", "o", "Set output directory name", flag=False, default="dist"),
]

loggers = [
Expand All @@ -31,6 +32,6 @@ def handle(self) -> int:
)

builder = Builder(self.poetry)
builder.build(fmt, executable=env.python)
builder.build(fmt, executable=env.python, target_dir=self.option("output"))
Copy link
Member

Choose a reason for hiding this comment

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

I haven't tested it, but I'm afraid that now the default behavior would be to use a dist folder relative to the current working directory instead of relative to the pyproject.toml file.

Furthermore target_dir expects Path and not str :)


return 0