-
Notifications
You must be signed in to change notification settings - Fork 11
remove session object from being created on import #176
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
Conversation
this is now no longer necessary as it is done by the renderaccess decorator already
note, this depends on AllenInstitute/render-python#176
|
hi @RussTorres please take a look at this, it'd be greatly appreciated! |
|
@thopp-tudelft I really appreciate this PR and it looks great! Not sure how this historically came about but this change is definitely a better implementation. Thank you! |
RussTorres
left a comment
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.
With the change in thopp-tudelft#1
This passes its own tests and integration tests with downstream repos. As soon as that commit makes it in I will merge this PR.
Thanks!
closes #1
|
thanks! can you give me an estimate how long it'll take before the develop branch will be included in releases? |
|
@thopp-tudelft I just updated the release strategy and deployed v2.4.0 to pypi -- seems like it's ready to use. |
|
thank you for notifying me! I noticed however that your latest release does not support python 3.13 even though it was released a year ago. Is there a specific reason to restrict it from running on python 3.13? I have been using the previous version on python 3.13 so far. I've also been trying to install it but no matter the version of python I can't actually install it from pypi. when I pip install the package only the dist-info folder is created and not the actual library. there might be a mistake in your new pyproject.toml file possibly? |
|
Yes, there was a typo in the pyproject that I had already fixed on another deployment -- v2.4.1 has that change and works for me with a fresh 3.11 environment. I don't have the new automated testing action set up for this repo, but I manually tested on 3.12.12 and 3.13.11. Changed to <3.14 for now and I will release that as v2.4.2 |
|
I tested with the 2.4.1 version and it works! thank you! |
all renderaccess functions that use the requests library did so by using a "session" parameter in the function declaration, this parameter was given a default value like this:
session=requests.session()doing this executed this code on import, that is, when the library is imported and these functions declared each function will call requests.session() and store this object in the default parameter list.
this is quite annoying to deal with and causes unexpected behavior, like each function setting up its own connection persistence.
this behavior also contradicted the docstrings on for example renderapi/stack.py which says the default behavior is to start a new session, even though that was not true. (with the exception of clone_stack)
to fix this problem this pr removes all instances of
session=requests.session()in declarations and brings its handling of requests more in line with expectationsI've divided this pr in separate commits:
most important is the first commit, the others can be split off into separate prs if there is a concern that these changes would impact existing use of the library.