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

gh-105983: Add private mode support to webbrowser #105984

Closed
wants to merge 40 commits into from
Closed

gh-105983: Add private mode support to webbrowser #105984

wants to merge 40 commits into from

Conversation

kr-g
Copy link

@kr-g kr-g commented Jun 22, 2023

Support incognito / private browsing.

support for incognito / private browsing
@bedevere-bot
Copy link

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

@AlexWaygood AlexWaygood changed the title webbrowser incognito mode gh-105983: webbrowser incognito mode Jun 22, 2023
@arhadthedev
Copy link
Member

@sobolevn @zooba (as recent committers into Lib/webbrowser.py)

removed %incognito since using %action for the implementation
@kr-g
Copy link
Author

kr-g commented Jun 22, 2023

tested on linux with

  • chromium
  • firefox
  • epiphany

opera opens automatically with a private tab.
konqueror seams not offer such a feature.

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the feature suggestion.

I will take another look when you will remove unrelated changes :)

Lib/webbrowser.py Outdated Show resolved Hide resolved
Lib/webbrowser.py Outdated Show resolved Hide resolved
Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Please, also add tests for browsers that support it. And a doc note about this new feature.

Thank you for the quick response! 👍

@@ -604,6 +657,14 @@ def main():
for o, a in opts:
if o == '-n': new_win = 1
elif o == '-t': new_win = 2
elif o == "-i":
new_win = 3
elif o == "-b":
Copy link
Member

Choose a reason for hiding this comment

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

Why do we have -b and -l added? I am not opposed to this, but again: this feature is not related.

If you feel like adding this feature is a good idea (it looks like it might be), please open a new issue: explain the use-case and the "why".

But, let's keep this PR simple: only incognito mode.

Copy link
Author

Choose a reason for hiding this comment

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

it is related to the cmdline interface when webbroser main() func is called.
they belong also to the newly added incognito method.
therefore it is not a new feature from my perspective.

Copy link
Member

Choose a reason for hiding this comment

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

This is not resolved at all. These are separate new additions.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed

Copy link
Member

Choose a reason for hiding this comment

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

We do appreciate your contribution here!
As the PR author, you are in the best place to address the review by removing the code added to support --browser.
That can be discussed in a separate issue. But if you don’t have the time, then someone else could complete the PR.

Copy link
Author

Choose a reason for hiding this comment

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

for me this is a migration topic. the experts do know better what to do here. myself i dont see here in the working loop since i dont have this detailed knowledge of what being best on master code baseline

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I don’t understand «migration». There are clear requests to remove some code that was added, to keep this PR focused on one thing. If you don’t want to pursue it, then someone else will have to volunteer.

@kr-g
Copy link
Author

kr-g commented Jun 22, 2023

i would suggest that someone else will do auto formatting with black (PEP08)

Lib/webbrowser.py Outdated Show resolved Hide resolved
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
@kr-g
Copy link
Author

kr-g commented Jun 22, 2023

i followed the approach of the given tests under Lib/test/test_webbrowser.py and added some more for parameter checking (as far i understood that is how it works).

but since even the original tests i can not run here on my local machine (3 are failing) i created now a gist rather than releasing it.

https://gist.github.com/kr-g/95a06df8f0fcf77ad10474724350e921

@kr-g kr-g requested a review from sobolevn June 22, 2023 12:50
Copy link
Member

@terryjreedy terryjreedy left a comment

Choose a reason for hiding this comment

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

Remove stuff unrelated to the issue.

@@ -604,6 +657,14 @@ def main():
for o, a in opts:
if o == '-n': new_win = 1
elif o == '-t': new_win = 2
elif o == "-i":
new_win = 3
elif o == "-b":
Copy link
Member

Choose a reason for hiding this comment

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

This is not resolved at all. These are separate new additions.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@terryjreedy terryjreedy requested review from hugovk and zooba June 22, 2023 20:02
@terryjreedy terryjreedy changed the title gh-105983: webbrowser incognito mode gh-105983: Support webbrowser incognito mode Jun 22, 2023
@merwok merwok changed the title gh-105983: Support webbrowser private mode gh-105983: Add private mode support to webbrowser Jun 26, 2023
@AmirNakhaeii
Copy link

AmirNakhaeii commented Jun 28, 2023

it is possible to fetch the PR to a local repo.

in case you dont know how:

please follow up here https://github.com/progit/progit2/releases -> search for "Pull Request Refs" (in release 2.1.404 it is from page 196 onwards).

the next section "Pull Requests on Pull Requests" describes how depending changes/ extensions can be made.

so ... for any other browser not covered so far (like e.g. MacOSXOSAScript mentioned by @ronaldoussoren) ... it would be great if the "finder" of that gap could provide also some code here.

Thanks

I fetched the this PR and I made some changes, but now how can I make the PR on this PR ?

@hugovk
Copy link
Member

hugovk commented Jun 30, 2023

Thanks for the update! Some things still to do (I unresolved the relevant threads):

  • Don't fallback to open_new, raise an exception instead
  • Remove -b and -l options
  • "Incognito" is more of a Google Chrome name, let's primarily name as "private", but can also mention "incognito" to help when searching (I can't seem to find where I earlier commented this...)

@hugovk
Copy link
Member

hugovk commented Sep 19, 2023

@kr-g There's not much point updating this branch from main unless the unresolved items are addressed.

@hugovk
Copy link
Member

hugovk commented Oct 18, 2023

@kr-g As mentioned, there's no point updating this PR from main unless the other issues are going to be resolved. Otherwise we let's close this, and we can re-open it when those issues have been addressed.

@kr-g
Copy link
Author

kr-g commented Oct 19, 2023

@kr-g As mentioned, there's no point updating this PR from main unless the other issues are going to be resolved. Otherwise we let's close this, and we can re-open it when those issues have been addressed.

i use the branch - therefore i merge from time to time.
i m aware that you dont.
there is no reason to tell that in addition.
just unsubscribe. thanks.

@kr-g
Copy link
Author

kr-g commented Oct 19, 2023

@kr-g As mentioned, there's no point updating this PR from main unless the other issues are going to be resolved. Otherwise we let's close this, and we can re-open it when those issues have been addressed.

but anyway good to know the intention to kick me out of my own code.

@AlexWaygood
Copy link
Member

Hi @kr-g, we have no intention of kicking you out of your own code :) However, by keeping a PR open against the CPython repo, you are indicating that this patch is something you are actively seeking to be merged into the main branch, and would like CPython maintainers to engage with. If you are not interested in addressing the comments of the reviewers here, that is your right, but you cannot expect for this PR to be kept open indefinitely.

If the PR is closed, the branch will not be deleted, and you will be able to continue using it locally. You will not be kicked out of your own code in any way. However, the PR will no longer show up as an active, open PR against the CPython repo that maintainers should engage with and attempt to review.

It sounds as though you are currently uninterested in addressing the comments of the reviewers here, so I'm going to close this. If I'm incorrect, and you are still interested in having this patch merged into the CPython main branch, please let us know, and we can reopen the PR :)

@kr-g
Copy link
Author

kr-g commented Oct 19, 2023

i already said it some months ago that i see the "experts" here in charge to take over those topics because from my point of view thats an integration (or migration) issue to split the PR or rename a feature. i m not an expert and dont know what fits best on cpython baseline. but somehow this turns out to be ... well anyone can read and have an own idea about it.
there is no need to discuss further. also these lines are already too much.

@AlexWaygood
Copy link
Member

CPython is an open-source project maintained by volunteers, who have limited time to help PRs make it over the finish line. I'm afraid it's the responsibility of the author of the PR to ensure that it's of a quality suitable to be merged, not the responsibility of the CPython core developers. We've given you advice on the changes that would be required to get this into a state where it could be merged; in this instance, that's as much as we can do.

@kr-g
Copy link
Author

kr-g commented Oct 19, 2023

since i have doubled the webbrowser code already in my own project that all is not of importance to me. in case it comes somewhere in time i dont bother.
but as of today i m pissed off by the time used for this all.
i unsubscribe now from this thread and delete the repo on my side.
if someone whats to pick up the last word, or write sort of poetry. thats also fine with me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.