Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Define port for htmllive to avoid collisions #1327

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

Merged
merged 4 commits into from
May 27, 2024

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented May 27, 2024

It's not unusual that I might run make htmllive for a pair of CPython docs, devguide and PEPs at the same time.

To avoid clashes, use a randomly-chosen "ephemeral port" between 49152–65535 for the local server for each of devguide and PEPs.

python -c "import random; print(random.randint(49152, 65535))"

Also use the more descriptive Sphinx long options (added in 7.3.0) for the Makefiles.

See also python/peps#3792.


📚 Documentation preview 📚: https://cpython-devguide--1327.org.readthedocs.build/

Makefile Outdated
@@ -170,7 +170,7 @@ htmlview: html

.PHONY: htmllive
htmllive: SPHINXBUILD = $(VENVDIR)/bin/sphinx-autobuild
htmllive: SPHINXOPTS = --re-ignore="/\.idea/|/venv/" --open-browser --delay 0
htmllive: SPHINXOPTS = --re-ignore="/\.idea/|/venv/" --open-browser --delay 0 --port 55311
Copy link
Member

Choose a reason for hiding this comment

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

I would add a comment to specify that you picked it randomly.

Are you going to pick random ones for the other repos too?
Would it be better to just pick a range and have e.g. 55300 for cpython, 55301 for the devguide, and so on?

Copy link
Member Author

Choose a reason for hiding this comment

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

I would add a comment to specify that you picked it randomly.

Will do.

Are you going to pick random ones for the other repos too?

Yes, I added a random one for PEPs here: python/peps#3792

I made sure it started with a 5 here, and a 6 there.

I wasn't going to add one for CPython, at least not yet. I figured that it should be fine with the default. Although it could clash with other default servers (e.g. python -m http.server), if it comes up with any regularity, we could use one beginning with 4.

Would it be better to just pick a range and have e.g. 55300 for cpython, 55301 for the devguide, and so on?

I don't know, can change if you'd prefer.

Copy link
Member

Choose a reason for hiding this comment

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

The reason why I'm asking these questions, is that seeing an arbitrary number like 55311 makes me wonder if it's some specific port that was picked for some specific reason.

Seeing other random ports in other projects will make this even more puzzling. Adding comments will solve this concern, but also having a range of consecutive numbers will help clarify implicitly that the numbers themselves are not special.

I would also change the last digit rather than first, for two reasons:

  1. after you used 4, 5, and 6, you will have to start reusing one of those;
  2. having consecutive values helps indicate that it's just an incrementing sequence of arbitrary ports;

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds reasonable to me 👍

Updated, how's this look?

Co-authored-by: Ezio Melotti <[email protected]>
@hugovk hugovk merged commit e880e36 into python:main May 27, 2024
4 checks passed
@hugovk hugovk deleted the infra-htmllive-port branch May 27, 2024 14:55
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.

3 participants