René's URL Explorer Experiment


Title: Only print `make venv` message when needed. by ezio-melotti · Pull Request #867 · python/devguide · GitHub

Open Graph Title: Only print `make venv` message when needed. by ezio-melotti · Pull Request #867 · python/devguide

X Title: Only print `make venv` message when needed. by ezio-melotti · Pull Request #867 · python/devguide

Description: When make venv is called if the venv doesn't exist, it creates it and announce its creation if it does, it says it exists and suggests make clean-venv This was added in #856, but because of this change, all other targets that have the venv target as a dependency now print the message saying that the venv exist. If venv is removed from the . PHONY list it doesn't get reevaluated and doesn't print the message, but this also applies when it's invoked directly, making the message that suggests make clean-venv useless since it's never printed. I wrestled with Makefile for a while, and this PR is the best I came up with. It's intelligible, but has some repetition. I tried to get rid of the repetition by creating a Makefile function: define create-venv = $(PYTHON) -m venv $(VENVDIR) $(VENVDIR)/bin/python3 -m pip install --upgrade pip $(VENVDIR)/bin/python3 -m pip install -r requirements.txt endef but I couldn't find a way to call it from the other target, since they use a bash if/else that can't be used to call makefile functions. Another option is to create a target instead of the function, and call it with make target: create-venv: $(PYTHON) -m venv $(VENVDIR) $(VENVDIR)/bin/python3 -m pip install --upgrade pip $(VENVDIR)/bin/python3 -m pip install -r requirements.txt @echo "The venv has been created in the $(VENVDIR) directory" venv: @if [ -d $(VENVDIR) ] ; then \ echo "venv already exists."; \ echo "To recreate it, remove it first with \`make clean-venv'."; \ else \ make create-venv; \ fi ensure-venv: @if [ ! -d $(VENVDIR) ] ; then \ make create-venv; \ fi this works, but it launches another instance of make and prints some extra messages like make[1]: Entering/Leaving directory '/home/user/devguide' -- not very elegant. There are other solutions that I explored, including conditional functions or conditional syntax. There are also other ways of detecting dirs and acting upon their presence/absence, but the intelligibility of all these solutions goes downhill pretty quickly. So the options are: Merge the current PR, with some duplication Add the create-venv target with nested make calls Find a solution that removes the duplication without looking like bad ASCII-art Remove the if/else from the venv target, document make clean-venv, and hope people figure it out by reading the help

Open Graph Description: When make venv is called if the venv doesn't exist, it creates it and announce its creation if it does, it says it exists and suggests make clean-venv This was added in #856, but because of t...

X Description: When make venv is called if the venv doesn't exist, it creates it and announce its creation if it does, it says it exists and suggests make clean-venv This was added in #856, but because ...

Opengraph URL: https://github.com/python/devguide/pull/867

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:51e367c9-7103-b144-b239-46c4a9de7d4a
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id8244:8BCE9:71F689:9CC1F4:696A2A15
html-safe-noncef98817e63f7e12be9ea225c2f22f6c5e400c22529e444c20a067059fb011b7a2
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MjQ0OjhCQ0U5OjcxRjY4OTo5Q0MxRjQ6Njk2QTJBMTUiLCJ2aXNpdG9yX2lkIjoiMTk3MTUzMjA0NjY3NTg4MDQ2OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac5d1b45b51702caafd4829f283b16a99c1d84865fc7dc747f9e7f13bca7997c16
hovercard-subject-tagpull_request:936842592
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/devguide/pull/867/files
twitter:imagehttps://avatars.githubusercontent.com/u/25624924?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/25624924?s=400&v=4
og:image:altWhen make venv is called if the venv doesn't exist, it creates it and announce its creation if it does, it says it exists and suggests make clean-venv This was added in #856, but because of t...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneade130928b3890d20ecf9c887468a17e88d5c9a740ea2a85c2c2162e7c58e623
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/python/devguide git https://github.com/python/devguide.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id63972479
octolytics-dimension-repository_nwopython/devguide
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id63972479
octolytics-dimension-repository_network_root_nwopython/devguide
turbo-body-classeslogged-out env-production page-responsive
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasec00842167ca2e5b13e8171812965d503e925ece6
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/devguide/pull/867/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fdevguide%2Fpull%2F867%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fdevguide%2Fpull%2F867%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Fdevguide
Reloadhttps://github.com/python/devguide/pull/867/files
Reloadhttps://github.com/python/devguide/pull/867/files
Reloadhttps://github.com/python/devguide/pull/867/files
python https://github.com/python
devguidehttps://github.com/python/devguide
Please reload this pagehttps://github.com/python/devguide/pull/867/files
Notifications https://github.com/login?return_to=%2Fpython%2Fdevguide
Fork 962 https://github.com/login?return_to=%2Fpython%2Fdevguide
Star 2k https://github.com/login?return_to=%2Fpython%2Fdevguide
Code https://github.com/python/devguide
Issues 98 https://github.com/python/devguide/issues
Pull requests 18 https://github.com/python/devguide/pulls
Actions https://github.com/python/devguide/actions
Projects 1 https://github.com/python/devguide/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/python/devguide/security
Please reload this pagehttps://github.com/python/devguide/pull/867/files
Insights https://github.com/python/devguide/pulse
Code https://github.com/python/devguide
Issues https://github.com/python/devguide/issues
Pull requests https://github.com/python/devguide/pulls
Actions https://github.com/python/devguide/actions
Projects https://github.com/python/devguide/projects
Security https://github.com/python/devguide/security
Insights https://github.com/python/devguide/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fdevguide%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fdevguide%2Fissues%2Fnew%2Fchoose
ezio-melottihttps://github.com/ezio-melotti
python:mainhttps://github.com/python/devguide/tree/main
ezio-melotti:fix-make-venvhttps://github.com/ezio-melotti/devguide/tree/fix-make-venv
Conversation 8 https://github.com/python/devguide/pull/867
Commits 3 https://github.com/python/devguide/pull/867/commits
Checks 0 https://github.com/python/devguide/pull/867/checks
Files changed https://github.com/python/devguide/pull/867/files
Please reload this pagehttps://github.com/python/devguide/pull/867/files
Only print make venv message when needed. https://github.com/python/devguide/pull/867/files#top
Show all changes 3 commits https://github.com/python/devguide/pull/867/files
a2def53 Only print `make venv` message when needed. ezio-melotti May 15, 2022 https://github.com/python/devguide/pull/867/commits/a2def537851c8b5fe657976cf08d66001e30627c
66ca493 Merge branch 'main' into fix-make-venv ezio-melotti May 19, 2022 https://github.com/python/devguide/pull/867/commits/66ca49321b97b5985e5d18614272b6165b1a169f
bbab4e7 Remove duplicated code. ezio-melotti May 19, 2022 https://github.com/python/devguide/pull/867/commits/bbab4e7b418b3f69ae6d0ef062ed51f2d098d754
Clear filters https://github.com/python/devguide/pull/867/files
Please reload this pagehttps://github.com/python/devguide/pull/867/files
Please reload this pagehttps://github.com/python/devguide/pull/867/files
Makefilehttps://github.com/python/devguide/pull/867/files#diff-76ed074a9305c04054cdebb9e9aad2d818052b07091de1f20cad0bbac34ffb52
View file https://github.com/ezio-melotti/devguide/blob/bbab4e7b418b3f69ae6d0ef062ed51f2d098d754/Makefile
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/devguide/pull/867/{{ revealButtonHref }}
https://github.com/python/devguide/pull/867/files#diff-76ed074a9305c04054cdebb9e9aad2d818052b07091de1f20cad0bbac34ffb52
https://github.com/python/devguide/pull/867/files#diff-76ed074a9305c04054cdebb9e9aad2d818052b07091de1f20cad0bbac34ffb52
https://github.com/python/devguide/pull/867/files#diff-76ed074a9305c04054cdebb9e9aad2d818052b07091de1f20cad0bbac34ffb52
https://github.com/python/devguide/pull/867/files#diff-76ed074a9305c04054cdebb9e9aad2d818052b07091de1f20cad0bbac34ffb52
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.