Skip to content

Use if __name__ == '__main__': in server examples docs#3788

Merged
asvetlov merged 1 commit intoaio-libs:masterfrom
samuelcolvin:update-examples
May 21, 2019
Merged

Use if __name__ == '__main__': in server examples docs#3788
asvetlov merged 1 commit intoaio-libs:masterfrom
samuelcolvin:update-examples

Conversation

@samuelcolvin
Copy link
Copy Markdown
Member

What do these changes do?

Make it slightly easier to use the default examples with aiohttp-devtools etc.

Are there changes in behavior for the user?

no

Related issue number

fix #3775

Checklist

  • Documentation reflects the changes
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt
    • The format is <Name> <Surname>.
    • Please keep alphabetical order, the file is sorted by names.
  • Add a new news fragment into the CHANGES folder
    • name it <issue_id>.<type> for example (588.bugfix)
    • if you don't have an issue_id change it to the pr id after creating the pr
    • ensure type is one of the following:
      • .feature: Signifying a new feature.
      • .bugfix: Signifying a bug fix.
      • .doc: Signifying a documentation improvement.
      • .removal: Signifying a deprecation or removal of public API.
      • .misc: A ticket has been closed, but it is not of interest to users.
    • Make sure to use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files."

@codecov-io
Copy link
Copy Markdown

codecov-io commented May 21, 2019

Codecov Report

Merging #3788 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3788   +/-   ##
=======================================
  Coverage   97.94%   97.94%           
=======================================
  Files          43       43           
  Lines        8576     8576           
  Branches     1374     1374           
=======================================
  Hits         8400     8400           
  Misses         74       74           
  Partials      102      102

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e54e7cc...c8282dd. Read the comment docs.

Comment thread docs/index.rst
@webknjaz webknjaz changed the title if __name__ == '__main__', Use if __name__ == '__main__': in server examples docs May 21, 2019
@asvetlov asvetlov merged commit 506c244 into aio-libs:master May 21, 2019
@asvetlov
Copy link
Copy Markdown
Member

asvetlov commented May 21, 2019

Side note:
@webknjaz I constantly see a problem with cherry-picker.

andrew•~/projects/aiohttp(master⚡)» cherry_picker 506c244d 3.5                                                             (aiohttp)  [19:34:41]
🐍 🍒 ⛏
Usage: cherry_picker [OPTIONS] [COMMIT_SHA1] [BRANCHES]...
Try "cherry_picker -h" for help.

Error: Run state cherry-picker.state=BACKPORT_COMPLETE in Git config is not known.
Perhaps it has been set by a newer version of cherry-picker. Try upgrading.
Valid states are: BACKPORT_PAUSED, UNSET. If this looks suspicious, raise an issue at https://github.com/python/core-workflow/issues/new.
As the last resort you can reset the runtime state stored in Git config using the following command: `git config --local --remove-section cherry-picker`

The version is brand new:

andrew•~/projects/aiohttp(master⚡)» pip show cherry_picker                                                                 (aiohttp)  [19:35:01]
Name: cherry-picker
Version: 1.3.1
Summary: Backport CPython changes from master to maintenance branches.
Home-page: https://github.com/python/core-workflow/tree/master/cherry_picker
Author: Mariatta Wijaya
Author-email: [email protected]
License: UNKNOWN
Location: /home/andrew/.virtualenvs/aiohttp/lib/python3.7/site-packages
Requires: toml, click, gidgethub, requests
Required-by: 
andrew•~/projects/aiohttp(master⚡)» cat .git/config                                                                        
...
[cherry-picker]
	state = BACKPORT_COMPLETE

asvetlov pushed a commit that referenced this pull request May 21, 2019
(cherry picked from commit 506c244)

Co-authored-by: Samuel Colvin <[email protected]>
@samuelcolvin samuelcolvin deleted the update-examples branch May 21, 2019 16:38
@samuelcolvin
Copy link
Copy Markdown
Member Author

what's wrong with squash merge in github?

@asvetlov
Copy link
Copy Markdown
Member

I mean backporting to 3.5 branch

@asvetlov
Copy link
Copy Markdown
Member

Currently I do backporting by running cherry_picker <commit_hash> 3.5.
@Mariatta promised to write github bot for it to backport automatically if the corresponding github label is set. Works like a charm for CPython itself, I love to have such bot for aiohttp

@Mariatta
Copy link
Copy Markdown
Member

Sorry about the issue with cherry-picker. It is also a problem in miss-islington, so we reverted back to using earlier cherry-picker 1.2.x.

@Mariatta promised to write github bot for it to backport automatically if the corresponding github label is set.

Yes, I will be writing this bot sometime this week or next.

@Mariatta
Copy link
Copy Markdown
Member

About cherry-picker issue, I had described it to @webknjaz. He said he will think about it after returning from PyCon 🙂

@webknjaz
Copy link
Copy Markdown
Member

@asvetlov, clean the state in Git and use the latest version of cherry-picker, if the one you use creates that state this means that you use an outdated version which has this bug.

@webknjaz
Copy link
Copy Markdown
Member

Yes, I'll take a look at addressing this issue.

@asvetlov
Copy link
Copy Markdown
Member

I use cherry_picker 1.3.1 but it keeps a record in git config after cherry-picking finishing

asvetlov added a commit that referenced this pull request May 22, 2019
(cherry picked from commit 506c244)

Co-authored-by: Samuel Colvin <[email protected]>
@webknjaz
Copy link
Copy Markdown
Member

@asvetlov did you clean up the local git config before using 1.3.1? Can you confirm that it appears in .git/config under the cherry-picker section? We've removed that state identifier from the source code of cherry-picker and I cannot imagine it being recorded into the state storage as it no longer exists in the source code.

@asvetlov
Copy link
Copy Markdown
Member

asvetlov commented May 22, 2019

I understand your astonishment but yes.
Now I run git config --local --remove-section cherry-picker before every cherry_picker run.
After the run state = BACKPORT_COMPLETE is saved in git config.
The version is 1.3.1

Try yourself

@webknjaz
Copy link
Copy Markdown
Member

Wow. I have to check what's actually published on PyPI then.

@webknjaz
Copy link
Copy Markdown
Member

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

if __name__ == '__main__' for main examples.

5 participants