{"id":53764,"date":"2025-09-01T14:57:59","date_gmt":"2025-09-01T04:57:59","guid":{"rendered":"https:\/\/www.cloudproinc.com.au\/?p=53764"},"modified":"2025-09-01T15:03:59","modified_gmt":"2025-09-01T05:03:59","slug":"auto-start-python-virtual-environment-in-github-codespaces","status":"publish","type":"post","link":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/01\/auto-start-python-virtual-environment-in-github-codespaces\/","title":{"rendered":"Auto Start Python Virtual Environment in GitHub Codespaces"},"content":{"rendered":"\n<p>In this blog post, &#8220;Auto Start Python Virtual Environment in GitHub Codespaces&#8221; we\u2019ll cover two main approaches: configuring your shell startup file (recommended) and setting up auto-activation project-wide with <strong>devcontainer.json<\/strong>.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>When working in <strong>GitHub <a href=\"https:\/\/www.cloudproinc.com.au\/index.php\/2025\/08\/25\/run-neo4j-with-docker-inside-github-codespaces\/\">Codespaces<\/a><\/strong>, it\u2019s common to use Python virtual environments to keep your dependencies clean and project-specific. However, if you\u2019ve ever spun up a new Codespace and noticed that your virtual environment isn\u2019t automatically active, you know how annoying it can be to type <code>source .venv\/bin\/activate<\/code> every time you open a terminal. Fortunately, there are simple ways to make your virtual environment auto-activate each time you open a new terminal session. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-what-is-github-codespaces\">What is GitHub Codespaces?<\/h2>\n\n\n\n<p>GitHub Codespaces is a cloud-based development environment that lets you spin up a ready-to-code dev setup directly from a GitHub repository. It provides a fully managed VS Code environment running in the cloud, with all the dependencies, tools, and extensions preinstalled. This means you can start coding almost instantly without needing to configure your local machine, making it perfect for collaboration, onboarding, and working from any device.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-why-auto-activate-a-virtual-environment\">Why Auto-Activate a Virtual Environment?<\/h2>\n\n\n\n<p>A Python virtual environment isolates your project dependencies so they don\u2019t conflict with global Python packages or other projects. By auto-activating the environment, you save time by not having to manually run <code>source<\/code> on each new terminal, reduce mistakes by avoiding global installs, and maintain consistency so every developer works in the same environment.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-option-1-update-bashrc-or-zshrc-recommended\">Option 1: Update <code>.bashrc<\/code> or <code>.zshrc<\/code> (Recommended)<\/h2>\n\n\n\n<p>The most straightforward way to auto-activate a Python virtual environment is to edit your shell\u2019s startup file so the environment is activated each time a terminal session starts. This is the recommended method for most developers.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-step-1-locate-your-virtual-environment\">Step 1: Locate your virtual environment<\/h3>\n\n\n\n<p>If you created it with <code>python -m venv .venv<\/code>, the activation script will be here:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-90d745d6d73e6f4749a6e6820908e622\"><code>\/workspaces\/your-repo\/.venv\/bin\/activate<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-step-2-update-your-shell-startup-file\">Step 2: Update your shell startup file<\/h3>\n\n\n\n<p>Codespaces typically uses <strong>bash<\/strong> by default, but some setups use <strong>zsh<\/strong>. Depending on your shell, open the correct file:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-1c3857669a81839119e0e8a11b67beb8\"><code>nano ~\/.bashrc<\/code><\/pre>\n\n\n\n<p>or<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-bd193ff16199db896afabe035860af4f\"><code>nano ~\/.zshrc<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-step-3-add-the-activation-command\">Step 3: Add the activation command<\/h3>\n\n\n\n<p>Append this line to the bottom of the file:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-38c8c31d6f78d6cc64f7ad32b403f512\"><code>source \/workspaces\/your-repo\/.venv\/bin\/activate<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-step-4-reload-or-restart-the-terminal\">Step 4: Reload or restart the terminal<\/h3>\n\n\n\n<p>Either restart the terminal or reload the file:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-ba2a4e69ad9708425f853d7191805498\"><code>source ~\/.bashrc<\/code><\/pre>\n\n\n\n<p>From now on, every new terminal session will start with your Python virtual environment active. If you use both <code>.bashrc<\/code> and <code>.bash_profile<\/code>, you can add the line to both files to ensure activation works across all shell types. This method is simple, lightweight, and tied to your personal Codespace environment, which is why it is the recommended approach.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-option-2-use-devcontainer-devcontainer-json-for-project-wide-setup\">Option 2: Use <code>.devcontainer\/devcontainer.json<\/code> for Project-Wide Setup<\/h2>\n\n\n\n<p>If you want everyone who opens a Codespace for your repository to have the virtual environment auto-activated, you can configure this in the <code>devcontainer.json<\/code> file. This file defines how your Codespace is built and provisioned.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-step-1-open-devcontainer-json\">Step 1: Open <code>devcontainer.json<\/code><\/h3>\n\n\n\n<p>Locate <code>.devcontainer\/devcontainer.json<\/code> in your repository. If it doesn\u2019t exist, create it.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-step-2-add-a-postcreatecommand\">Step 2: Add a <code>postCreateCommand<\/code><\/h3>\n\n\n\n<p>This command runs after the Codespace is created, allowing you to append the activation line into <code>.bashrc<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-fc133d5f4aedf0577560f8d0ff1ce9bf\"><code>{\n  \"postCreateCommand\": \"echo 'source \/workspaces\/your-repo\/.venv\/bin\/activate' >> ~\/.bashrc\"\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-step-3-rebuild-your-codespace\">Step 3: Rebuild your Codespace<\/h3>\n\n\n\n<p>Click <strong>Rebuild Container<\/strong> in VS Code (inside Codespaces). Now, every developer who opens a new Codespace will have the venv auto-activated. This approach is more collaborative, ensuring consistent setup across teams and making onboarding smoother, especially in larger projects.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-bonus-configure-vs-code-python-extension\">Bonus: Configure VS Code Python Extension<\/h2>\n\n\n\n<p>Another way to streamline your workflow is to set the default Python interpreter in VS Code (inside Codespaces). This ensures that debugging sessions and scripts always run with the correct virtual environment.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open the Command Palette (<code>Ctrl+Shift+P<\/code>).<\/li>\n\n\n\n<li>Search for <strong>Python: Select Interpreter<\/strong>.<\/li>\n\n\n\n<li>Choose your <code>.venv<\/code>.<\/li>\n\n\n\n<li>Save it in <code>.vscode\/settings.json<\/code>: <code>{ \"python.defaultInterpreterPath\": \"\/workspaces\/your-repo\/.venv\/bin\/python\" }<\/code><\/li>\n<\/ol>\n\n\n\n<p>This isn\u2019t strictly auto-activation, but it ensures your Python tools and extensions always point to the right environment.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-which-option-should-you-choose\">Which Option Should You Choose?<\/h2>\n\n\n\n<p>For individual use in your Codespace, use the <code>.bashrc\/.zshrc<\/code> method. It\u2019s the simplest and most direct. For team projects where multiple developers use Codespaces, use the <code>devcontainer.json<\/code> approach. For best results, combine them: configure <code>.bashrc<\/code> for yourself and add a <code>devcontainer.json<\/code> entry so your teammates benefit too.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-final-thoughts\">Final Thoughts<\/h2>\n\n\n\n<p>Auto-activating a Python virtual environment in GitHub Codespaces is a small but powerful productivity boost. It eliminates repetitive steps, reduces setup errors, and ensures you\u2019re always working inside the right environment. By following the recommended <code>.bashrc<\/code> method for personal use and optionally extending it to the <code>devcontainer.json<\/code> approach for team projects, you\u2019ll have a smooth, consistent development experience in Codespaces. Stop typing <code>source .venv\/bin\/activate<\/code> over and over \u2014 let your Codespace do it for you automatically. \ud83d\ude80<\/p>\n\n\n\n<ul class=\"wp-block-yoast-seo-related-links yoast-seo-related-links\">\n<li><a href=\"https:\/\/www.cloudproinc.com.au\/index.php\/2025\/08\/25\/run-neo4j-with-docker-inside-github-codespaces\/\">Run Neo4j with Docker inside GitHub Codespaces<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.cloudproinc.com.au\/index.php\/2025\/07\/29\/counting-tokens-using-the-openai-python-sdk\/\">Counting Tokens Using the OpenAI Python SDK<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/cloudproinc.com.au\/index.php\/2024\/09\/10\/simplifying-azure-management-with-github-copilot-for-azure\/\">Simplifying Azure Management with GitHub Copilot for Azure<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.cloudproinc.com.au\/index.php\/2024\/05\/06\/email-setup-for-managed-devices-with-intune-office-365-mail-configuration\/\">Email Setup for Managed Devices with Intune: Office 365 Mail Configuration<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.cloudproinc.com.au\/index.php\/2025\/04\/18\/getting-started-with-the-openai-responses-api-in-net\/\">Getting Started with the OpenAI Responses API in .NET<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>In this blog post, &#8220;Auto Start Python Virtual Environment in GitHub Codespaces&#8221; we\u2019ll cover two main approaches: configuring your shell startup file (recommended) and setting up auto-activation project-wide with devcontainer.json.<\/p>\n","protected":false},"author":1,"featured_media":53766,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_yoast_wpseo_focuskw":"Auto Start Python Virtual Environment in GitHub Codespaces","_yoast_wpseo_title":"","_yoast_wpseo_metadesc":"Easily configure GitHub Codespaces to auto start Python virtual environment, saving time and improving workflow.","_yoast_wpseo_opengraph-title":"","_yoast_wpseo_opengraph-description":"","_yoast_wpseo_twitter-title":"","_yoast_wpseo_twitter-description":"","_et_pb_use_builder":"off","_et_pb_old_content":"","_et_gb_content_width":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[13,79],"tags":[],"class_list":["post-53764","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","category-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Auto Start Python Virtual Environment in GitHub Codespaces - CPI Consulting<\/title>\n<meta name=\"description\" content=\"Easily configure GitHub Codespaces to auto start Python virtual environment, saving time and improving workflow.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/01\/auto-start-python-virtual-environment-in-github-codespaces\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Auto Start Python Virtual Environment in GitHub Codespaces\" \/>\n<meta property=\"og:description\" content=\"Easily configure GitHub Codespaces to auto start Python virtual environment, saving time and improving workflow.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/01\/auto-start-python-virtual-environment-in-github-codespaces\/\" \/>\n<meta property=\"og:site_name\" content=\"CPI Consulting\" \/>\n<meta property=\"article:published_time\" content=\"2025-09-01T04:57:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-09-01T05:03:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cloudproinc.com.au\/wp-content\/uploads\/2025\/09\/auto-start-python-virtual-environment-in-github-codespaces.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1536\" \/>\n\t<meta property=\"og:image:height\" content=\"1024\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"CPI Staff\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"CPI Staff\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/01\\\/auto-start-python-virtual-environment-in-github-codespaces\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/01\\\/auto-start-python-virtual-environment-in-github-codespaces\\\/\"},\"author\":{\"name\":\"CPI Staff\",\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/#\\\/schema\\\/person\\\/192eeeb0ce91062126ce3822ae88fe6e\"},\"headline\":\"Auto Start Python Virtual Environment in GitHub Codespaces\",\"datePublished\":\"2025-09-01T04:57:59+00:00\",\"dateModified\":\"2025-09-01T05:03:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/01\\\/auto-start-python-virtual-environment-in-github-codespaces\\\/\"},\"wordCount\":762,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/01\\\/auto-start-python-virtual-environment-in-github-codespaces\\\/#primaryimage\"},\"thumbnailUrl\":\"\\\/wp-content\\\/uploads\\\/2025\\\/09\\\/auto-start-python-virtual-environment-in-github-codespaces.png\",\"articleSection\":[\"Blog\",\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/01\\\/auto-start-python-virtual-environment-in-github-codespaces\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/01\\\/auto-start-python-virtual-environment-in-github-codespaces\\\/\",\"url\":\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/01\\\/auto-start-python-virtual-environment-in-github-codespaces\\\/\",\"name\":\"Auto Start Python Virtual Environment in GitHub Codespaces - CPI Consulting\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/01\\\/auto-start-python-virtual-environment-in-github-codespaces\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/01\\\/auto-start-python-virtual-environment-in-github-codespaces\\\/#primaryimage\"},\"thumbnailUrl\":\"\\\/wp-content\\\/uploads\\\/2025\\\/09\\\/auto-start-python-virtual-environment-in-github-codespaces.png\",\"datePublished\":\"2025-09-01T04:57:59+00:00\",\"dateModified\":\"2025-09-01T05:03:59+00:00\",\"description\":\"Easily configure GitHub Codespaces to auto start Python virtual environment, saving time and improving workflow.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/01\\\/auto-start-python-virtual-environment-in-github-codespaces\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/01\\\/auto-start-python-virtual-environment-in-github-codespaces\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/01\\\/auto-start-python-virtual-environment-in-github-codespaces\\\/#primaryimage\",\"url\":\"\\\/wp-content\\\/uploads\\\/2025\\\/09\\\/auto-start-python-virtual-environment-in-github-codespaces.png\",\"contentUrl\":\"\\\/wp-content\\\/uploads\\\/2025\\\/09\\\/auto-start-python-virtual-environment-in-github-codespaces.png\",\"width\":1536,\"height\":1024},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/01\\\/auto-start-python-virtual-environment-in-github-codespaces\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Auto Start Python Virtual Environment in GitHub Codespaces\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/#website\",\"url\":\"https:\\\/\\\/cloudproinc.com.au\\\/\",\"name\":\"Cloud Pro Inc - CPI Consulting Pty Ltd\",\"description\":\"Cloud, AI &amp; Cybersecurity Consulting | Melbourne\",\"publisher\":{\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/cloudproinc.com.au\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/#organization\",\"name\":\"Cloud Pro Inc - Cloud Pro Inc - CPI Consulting Pty Ltd\",\"url\":\"https:\\\/\\\/cloudproinc.com.au\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/favfinalfile.png\",\"contentUrl\":\"\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/favfinalfile.png\",\"width\":500,\"height\":500,\"caption\":\"Cloud Pro Inc - Cloud Pro Inc - CPI Consulting Pty Ltd\"},\"image\":{\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/#\\\/schema\\\/person\\\/192eeeb0ce91062126ce3822ae88fe6e\",\"name\":\"CPI Staff\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2d96eeb53b791d92c8c50dd667e3beec92c93253bb6ff21c02cfa8ca73665c70?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2d96eeb53b791d92c8c50dd667e3beec92c93253bb6ff21c02cfa8ca73665c70?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2d96eeb53b791d92c8c50dd667e3beec92c93253bb6ff21c02cfa8ca73665c70?s=96&d=mm&r=g\",\"caption\":\"CPI Staff\"},\"sameAs\":[\"http:\\\/\\\/www.cloudproinc.com.au\"],\"url\":\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/author\\\/cpiadmin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Auto Start Python Virtual Environment in GitHub Codespaces - CPI Consulting","description":"Easily configure GitHub Codespaces to auto start Python virtual environment, saving time and improving workflow.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/01\/auto-start-python-virtual-environment-in-github-codespaces\/","og_locale":"en_US","og_type":"article","og_title":"Auto Start Python Virtual Environment in GitHub Codespaces","og_description":"Easily configure GitHub Codespaces to auto start Python virtual environment, saving time and improving workflow.","og_url":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/01\/auto-start-python-virtual-environment-in-github-codespaces\/","og_site_name":"CPI Consulting","article_published_time":"2025-09-01T04:57:59+00:00","article_modified_time":"2025-09-01T05:03:59+00:00","og_image":[{"width":1536,"height":1024,"url":"https:\/\/cloudproinc.com.au\/wp-content\/uploads\/2025\/09\/auto-start-python-virtual-environment-in-github-codespaces.png","type":"image\/png"}],"author":"CPI Staff","twitter_card":"summary_large_image","twitter_misc":{"Written by":"CPI Staff","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/01\/auto-start-python-virtual-environment-in-github-codespaces\/#article","isPartOf":{"@id":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/01\/auto-start-python-virtual-environment-in-github-codespaces\/"},"author":{"name":"CPI Staff","@id":"https:\/\/cloudproinc.com.au\/#\/schema\/person\/192eeeb0ce91062126ce3822ae88fe6e"},"headline":"Auto Start Python Virtual Environment in GitHub Codespaces","datePublished":"2025-09-01T04:57:59+00:00","dateModified":"2025-09-01T05:03:59+00:00","mainEntityOfPage":{"@id":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/01\/auto-start-python-virtual-environment-in-github-codespaces\/"},"wordCount":762,"commentCount":0,"publisher":{"@id":"https:\/\/cloudproinc.com.au\/#organization"},"image":{"@id":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/01\/auto-start-python-virtual-environment-in-github-codespaces\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2025\/09\/auto-start-python-virtual-environment-in-github-codespaces.png","articleSection":["Blog","Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/01\/auto-start-python-virtual-environment-in-github-codespaces\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/01\/auto-start-python-virtual-environment-in-github-codespaces\/","url":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/01\/auto-start-python-virtual-environment-in-github-codespaces\/","name":"Auto Start Python Virtual Environment in GitHub Codespaces - CPI Consulting","isPartOf":{"@id":"https:\/\/cloudproinc.com.au\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/01\/auto-start-python-virtual-environment-in-github-codespaces\/#primaryimage"},"image":{"@id":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/01\/auto-start-python-virtual-environment-in-github-codespaces\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2025\/09\/auto-start-python-virtual-environment-in-github-codespaces.png","datePublished":"2025-09-01T04:57:59+00:00","dateModified":"2025-09-01T05:03:59+00:00","description":"Easily configure GitHub Codespaces to auto start Python virtual environment, saving time and improving workflow.","breadcrumb":{"@id":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/01\/auto-start-python-virtual-environment-in-github-codespaces\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/01\/auto-start-python-virtual-environment-in-github-codespaces\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/01\/auto-start-python-virtual-environment-in-github-codespaces\/#primaryimage","url":"\/wp-content\/uploads\/2025\/09\/auto-start-python-virtual-environment-in-github-codespaces.png","contentUrl":"\/wp-content\/uploads\/2025\/09\/auto-start-python-virtual-environment-in-github-codespaces.png","width":1536,"height":1024},{"@type":"BreadcrumbList","@id":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/01\/auto-start-python-virtual-environment-in-github-codespaces\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.cloudproinc.com.au\/"},{"@type":"ListItem","position":2,"name":"Auto Start Python Virtual Environment in GitHub Codespaces"}]},{"@type":"WebSite","@id":"https:\/\/cloudproinc.com.au\/#website","url":"https:\/\/cloudproinc.com.au\/","name":"Cloud Pro Inc - CPI Consulting Pty Ltd","description":"Cloud, AI &amp; Cybersecurity Consulting | Melbourne","publisher":{"@id":"https:\/\/cloudproinc.com.au\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cloudproinc.com.au\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/cloudproinc.com.au\/#organization","name":"Cloud Pro Inc - Cloud Pro Inc - CPI Consulting Pty Ltd","url":"https:\/\/cloudproinc.com.au\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudproinc.com.au\/#\/schema\/logo\/image\/","url":"\/wp-content\/uploads\/2022\/01\/favfinalfile.png","contentUrl":"\/wp-content\/uploads\/2022\/01\/favfinalfile.png","width":500,"height":500,"caption":"Cloud Pro Inc - Cloud Pro Inc - CPI Consulting Pty Ltd"},"image":{"@id":"https:\/\/cloudproinc.com.au\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/cloudproinc.com.au\/#\/schema\/person\/192eeeb0ce91062126ce3822ae88fe6e","name":"CPI Staff","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/2d96eeb53b791d92c8c50dd667e3beec92c93253bb6ff21c02cfa8ca73665c70?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/2d96eeb53b791d92c8c50dd667e3beec92c93253bb6ff21c02cfa8ca73665c70?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2d96eeb53b791d92c8c50dd667e3beec92c93253bb6ff21c02cfa8ca73665c70?s=96&d=mm&r=g","caption":"CPI Staff"},"sameAs":["http:\/\/www.cloudproinc.com.au"],"url":"https:\/\/cloudproinc.com.au\/index.php\/author\/cpiadmin\/"}]}},"jetpack_featured_media_url":"\/wp-content\/uploads\/2025\/09\/auto-start-python-virtual-environment-in-github-codespaces.png","jetpack-related-posts":[{"id":53710,"url":"https:\/\/cloudproinc.com.au\/index.php\/2025\/08\/25\/run-neo4j-with-docker-inside-github-codespaces\/","url_meta":{"origin":53764,"position":0},"title":"Run Neo4j with Docker inside GitHub Codespaces","author":"CPI Staff","date":"August 25, 2025","format":false,"excerpt":"Spin up Neo4j inside GitHub Codespaces using Docker and Docker Compose. Fast local graph development, zero installs on your laptop.","rel":"","context":"In &quot;AI&quot;","block_context":{"text":"AI","link":"https:\/\/cloudproinc.com.au\/index.php\/category\/ai\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2025\/08\/run-neo4j-with-docker-inside-github-codespaces.png","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2025\/08\/run-neo4j-with-docker-inside-github-codespaces.png 1x, \/wp-content\/uploads\/2025\/08\/run-neo4j-with-docker-inside-github-codespaces.png 1.5x, \/wp-content\/uploads\/2025\/08\/run-neo4j-with-docker-inside-github-codespaces.png 2x, \/wp-content\/uploads\/2025\/08\/run-neo4j-with-docker-inside-github-codespaces.png 3x, \/wp-content\/uploads\/2025\/08\/run-neo4j-with-docker-inside-github-codespaces.png 4x"},"classes":[]},{"id":53555,"url":"https:\/\/cloudproinc.com.au\/index.php\/2025\/07\/29\/counting-tokens-using-the-openai-python-sdk\/","url_meta":{"origin":53764,"position":1},"title":"Counting Tokens Using the OpenAI Python SDK","author":"CPI Staff","date":"July 29, 2025","format":false,"excerpt":"This post provides a comprehensive guide on counting tokens using the OpenAI Python SDK, covering Python virtual environments, managing your OpenAI API key securely, and the role of the requirements.txt file. In the world of Large Language Models (LLMs) and Artificial Intelligence (AI), the term \"token\" frequently arises. Tokens are\u2026","rel":"","context":"In &quot;AI&quot;","block_context":{"text":"AI","link":"https:\/\/cloudproinc.com.au\/index.php\/category\/ai\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2025\/07\/image-23.png","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2025\/07\/image-23.png 1x, \/wp-content\/uploads\/2025\/07\/image-23.png 1.5x, \/wp-content\/uploads\/2025\/07\/image-23.png 2x"},"classes":[]},{"id":53823,"url":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/15\/connecting-to-a-running-container-terminal\/","url_meta":{"origin":53764,"position":2},"title":"Connecting to a Running Container Terminal","author":"CPI Staff","date":"September 15, 2025","format":false,"excerpt":"Learn practical ways to attach a shell to running containers in Docker and Kubernetes, when to use them, and how to stay safe in production.","rel":"","context":"In &quot;Blog&quot;","block_context":{"text":"Blog","link":"https:\/\/cloudproinc.com.au\/index.php\/category\/blog\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2025\/09\/connecting-to-a-running-container-terminal-in-docker-and-kubernetes.png","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2025\/09\/connecting-to-a-running-container-terminal-in-docker-and-kubernetes.png 1x, \/wp-content\/uploads\/2025\/09\/connecting-to-a-running-container-terminal-in-docker-and-kubernetes.png 1.5x, \/wp-content\/uploads\/2025\/09\/connecting-to-a-running-container-terminal-in-docker-and-kubernetes.png 2x, \/wp-content\/uploads\/2025\/09\/connecting-to-a-running-container-terminal-in-docker-and-kubernetes.png 3x, \/wp-content\/uploads\/2025\/09\/connecting-to-a-running-container-terminal-in-docker-and-kubernetes.png 4x"},"classes":[]},{"id":53648,"url":"https:\/\/cloudproinc.com.au\/index.php\/2025\/08\/19\/simple-python-ai-app-with-llama-to-describe-images\/","url_meta":{"origin":53764,"position":3},"title":"Simple Python AI App with Llama to Describe Images","author":"CPI Staff","date":"August 19, 2025","format":false,"excerpt":"Want a quick win with multimodal AI? In this post, you\u2019ll build a tiny Python app that uses a Llama vision model to look at an image and tell you what it is. We\u2019ll use Ollama to run the model locally (no paid keys required), then call it from Python.\u2026","rel":"","context":"In &quot;AI&quot;","block_context":{"text":"AI","link":"https:\/\/cloudproinc.com.au\/index.php\/category\/ai\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2025\/08\/simple-python-ai-app-with-llama-to-describe-images-1.png","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2025\/08\/simple-python-ai-app-with-llama-to-describe-images-1.png 1x, \/wp-content\/uploads\/2025\/08\/simple-python-ai-app-with-llama-to-describe-images-1.png 1.5x, \/wp-content\/uploads\/2025\/08\/simple-python-ai-app-with-llama-to-describe-images-1.png 2x, \/wp-content\/uploads\/2025\/08\/simple-python-ai-app-with-llama-to-describe-images-1.png 3x, \/wp-content\/uploads\/2025\/08\/simple-python-ai-app-with-llama-to-describe-images-1.png 4x"},"classes":[]},{"id":56951,"url":"https:\/\/cloudproinc.com.au\/index.php\/2026\/02\/04\/how-python-info-stealers-are-targeting-macos-endpoints\/","url_meta":{"origin":53764,"position":4},"title":"How Python Info-Stealers Are Targeting macOS Endpoints","author":"CPI Staff","date":"February 4, 2026","format":false,"excerpt":"Python-based info-stealers are increasingly hitting macOS via fake installers, copy-paste \u201cfixes,\u201d and stealthy packaging. Learn how they work, what they steal, and how to harden Macs in business environments.","rel":"","context":"In &quot;Blog&quot;","block_context":{"text":"Blog","link":"https:\/\/cloudproinc.com.au\/index.php\/category\/blog\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2026\/02\/post-6.png","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2026\/02\/post-6.png 1x, \/wp-content\/uploads\/2026\/02\/post-6.png 1.5x, \/wp-content\/uploads\/2026\/02\/post-6.png 2x, \/wp-content\/uploads\/2026\/02\/post-6.png 3x, \/wp-content\/uploads\/2026\/02\/post-6.png 4x"},"classes":[]},{"id":53841,"url":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/15\/create-a-blank-neo4j-instance\/","url_meta":{"origin":53764,"position":5},"title":"Create a Blank Neo4j Instance","author":"CPI Staff","date":"September 15, 2025","format":false,"excerpt":"Spin up a clean Neo4j graph quickly and securely. We cover Docker, a Linux VM, and Kubernetes, plus practical security, persistence, and backup tips.","rel":"","context":"In &quot;Blog&quot;","block_context":{"text":"Blog","link":"https:\/\/cloudproinc.com.au\/index.php\/category\/blog\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2025\/09\/create-a-blank-neo4j-instance-safely-on-docker-vm-or-kubernetes.png","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2025\/09\/create-a-blank-neo4j-instance-safely-on-docker-vm-or-kubernetes.png 1x, \/wp-content\/uploads\/2025\/09\/create-a-blank-neo4j-instance-safely-on-docker-vm-or-kubernetes.png 1.5x, \/wp-content\/uploads\/2025\/09\/create-a-blank-neo4j-instance-safely-on-docker-vm-or-kubernetes.png 2x, \/wp-content\/uploads\/2025\/09\/create-a-blank-neo4j-instance-safely-on-docker-vm-or-kubernetes.png 3x, \/wp-content\/uploads\/2025\/09\/create-a-blank-neo4j-instance-safely-on-docker-vm-or-kubernetes.png 4x"},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/posts\/53764","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/comments?post=53764"}],"version-history":[{"count":1,"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/posts\/53764\/revisions"}],"predecessor-version":[{"id":53765,"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/posts\/53764\/revisions\/53765"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/media\/53766"}],"wp:attachment":[{"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/media?parent=53764"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/categories?post=53764"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/tags?post=53764"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}