-
Notifications
You must be signed in to change notification settings - Fork 251
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
Added script file feature #40
Conversation
So, will these scripts be be available when installing the app? Or only in dev mode? |
@yajo when installing the app. See “scripts” in setup.py |
Trying to push for poetry at my company, and this functionality is critical. Glad it's finally getting in! |
@muppetjones |
Perfect. That's exactly what I needed. Thanks! |
I managed to fix the failing build with a |
Hi. Can this be looked at please? |
@peterdeme thanks for pinging, I haven't looked at this one yet but will do so right after we finish up the 1.1.0 release. Apologies for not getting to this earlier. |
I had merge conflicts, so I rebased my branch. I also squashed my two commits into one. |
@abn did you mean poetry-core 1.1.0 or poetry 1.1.0? Since poetry 1.1.0 went out on Oct 1 and is on 1.1.4 now, would it be a good time to look into this again? |
@roxchkplusony I can appreciate that this is an important feature for you. But please do understand that this project is maintained by a small group of volunteers. This means that we do not always get the amount of time we would like to invest into the project. And other priorities take precedence, for example bug fix releases. Please rest assured that this is still on my rather long list of things to get to. And we appreciate your patience ;) |
Of course @abn, don't mean to pressure you. Just wanted clarity on what commitment/estimate you were making, and if it still held. Besides, what does it take to join that inner circle of a "small group of volunteers", anyhow? |
I am not sure keeping me "accountable" for time frame is appropriate in this context, obviously I do not work for you. :) Maybe that was not your intent, maybe you simply wanted to know if it is still something on my radar - and as I said before it very much is.
I am unsure what you are implying by "inner circle" here, the maintainers do not encourage such a notion. Discussions typically happen on the discord server or on open issues. You volunteer as with any open source project, start by contributing. If you want to be a maintainer, all I can suggest is to keep contributing long term, interact with the community respectfully and help triage issues. Speaking from my own experience, I contributed for over a year before I was invited to be a maintainer. That said, if you are curious about this, lets discuss this on the discord server and not pollute the discussion relevant to this change. |
Fun fact: I opened my first PR for this feature more then a year ago. 🙂 |
@peterdeme: As an open-source contributor, I have also felt discouragement when PR review takes a long time. As a maintainer, on the other hand, I often don't have enough free time to review PRs as quickly as I would like. So I have seen this from both perspectives and understand them well. Rest assured that folks are doing the best they can and will review your submission as soon as they free up sufficient time. In the interim, Also, I see you have checked the |
@justinmayer thanks for the feedback. Sure, I understand that people do this in their free time and I respect it. One years still feels too long.
|
Ah, yes… Good point. I forgot that this repository has been separated from the one containing the documentation. I imagine the PR templates should be updated to account for that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"No newline at end of file": Not sure if these were intended or not, but might want to have a look to make sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks for all your work on this useful enhancement, Peter. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥳 LGTM
This change refactors implementation and tests relating to script file specifications. Relates-to: python-poetry#40 Relates-to: python-poetry#241
This change refactors implementation and tests relating to script file specifications. Relates-to: python-poetry#40 Relates-to: python-poetry#241
This change refactors implementation and tests relating to script file specifications. Relates-to: python-poetry#40 Relates-to: python-poetry#241
This change refactors implementation and tests relating to script file specifications. Relates-to: python-poetry#40 Relates-to: python-poetry#241
Thank you! This is a big win, I'll be working on more plugins now that poetry works well for packaging my project. |
May I know how to use this feature now? I found no document about it. I'm using poetry v1.1.7. I tried to add the following section but failed to run [tool.poetry.scripts]
gen_clang_syntax_check = {source = "cmd/gen_clang_syntax_check.py", type = "file"} The error message is shown as following:
It was still failling if I added an empty extra section: [tool.poetry.extras] |
I think the PR is merged but the feature is not yet released in any of the releases. Maybe the maintainers are planning to release this in the Edit
Since it is a python file, you can directly use the scripts configuration. |
Got it, it's poetry-core v1.1.0a5 not poetry v1.1.0, so poetry v1.1.7 didn't contain this feature. My script file is running with |
@hcoona, yes the current script tag only supports a specific method (that takes no args). What I usually do is: def main(argv=None):
if argv=None:
argv = sys.argv[1:]
... # main program
...
if __name__ == "__main__":
main() with: [tool.poetry.scripts]
script-foo = "foo.__main__:main" this allows for: Hope this is helpful. <edit - adding some examples using this new option as well> script-foo = "foo.__main__:main"
sample_shscript = { reference = "script-files/sample_script.sh", type= "file" } where "sample_shscript " uses the new options to call "script-files/sample_script.sh" |
Unfortunately the 'scripts' feature of setuptools[^1] hasn't made its way into Poetry yet (it has already been merged[^2] but not yet released). For the moment we'll need to keep the scripts directory inside pylaprof (although I wanted to avoid it) and install pylaprof-merge as an entry point[^3]. [^1]: https://python-packaging.readthedocs.io/en/latest/command-line-scripts.html#the-scripts-keyword-argument [^2]: python-poetry/poetry-core#40 [^3]: https://python-packaging.readthedocs.io/en/latest/command-line-scripts.html#the-console-scripts-entry-point
@mshafer-NI (or anyone who knows), do you happen to know if there is a way of supporting exit codes from Basically, given a slight variation on your example program, where
Is there a way of having the installed script relaying
|
Did this feature get removed? In Poetry 1.4.2,
yields the error:
There is still documentation at https://python-poetry.org/docs/pyproject#scripts that says this key exists but the examples there don't cover the usage here. Update: By reading the jsonschema in the PR implementation, I found that
It still doesn't do anything (nothing ends up in the virtualenv bin directory). |
Does this actually work? I can't seem to get it to run. I've set this in my pyproject.toml
What am I doing wrong and could the Poetry documentation be updated with some examples for different script types? |
This PR doesn't give us what we want. See python-poetry/poetry#2310 (comment) for a detailed explanation. |
Resolves: python-poetry#241
Feature: ability to add script files to distribution packages
This one is a long overdue, see: python-poetry/poetry#241 (June 2018)
The implementation is based on the official specification by @abn python-poetry/poetry#2310
This is a very basic feature of setup.py See here: docs.
Note: this is not the same as
entry_point
! This setuptools feature basically just copies over the given files to the virtualenv'sbin
folder so that it'll be available on the$PATH
and you can simply invoke it.Example
Then:
Testing