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

Poetry scripts in optimized mode #3335

Closed
2 tasks done
jeremysprofile opened this issue Nov 7, 2020 · 4 comments
Closed
2 tasks done

Poetry scripts in optimized mode #3335

jeremysprofile opened this issue Nov 7, 2020 · 4 comments
Labels
kind/feature Feature requests/implementations

Comments

@jeremysprofile
Copy link

jeremysprofile commented Nov 7, 2020

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

Feature Request

I have a pyproject.toml:

[tool.poetry.scripts]
# aka entry points or console scripts for setup.py users
merge = 'mypackage.__main__:main'

mypackage contains some assert statements that I do not want run in production, but I would like to run these scripts in "optimized" mode, aka python -O mypackage.__main__.

Is this possible to do with a poetry script? If not, is this easy to add?
Originally asked on StackOverflow

@jeremysprofile jeremysprofile added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Nov 7, 2020
@n8sty
Copy link
Contributor

n8sty commented Nov 9, 2020

Why not run it with PYTHONOPTIMIZE=1?

@jeremysprofile
Copy link
Author

Indeed, why not do that? I'm embarrassed. Thank you for your solution.

@abn abn removed the status/triage This issue needs to be triaged label Mar 3, 2022
@CmdQ
Copy link

CmdQ commented Jan 21, 2023

And how could I do that for only one of my two commands defined in there? Let's say the two commands are

  • test (needs assert to work)
  • benchmark (assert should not run)

Can that be achieved through the settings of a script entry?

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
Projects
None yet
Development

No branches or pull requests

4 participants