Skip to content
This repository was archived by the owner on Oct 16, 2025. It is now read-only.

Conversation

@BA-CalderonMorales
Copy link

@BA-CalderonMorales BA-CalderonMorales commented Oct 16, 2025

Purpose

This pull request updates the devcontainer setup to optimize installation of large machine learning packages by moving their installation to a post-create script. This change helps reduce disk usage during the container build process and keeps the requirements files cleaner.

Devcontainer configuration improvements:

  • Added a postCreateCommand in .devcontainer/devcontainer.json to run .devcontainer/scripts/postCreate.sh after the container is created, ensuring ML packages are installed only when needed.

  • Created .devcontainer/scripts/postCreate.sh to install large ML packages (torch, sentence-transformers, pymupdf4llm, and lunr) after container creation, using CPU-only torch for smaller size.

  • Removed direct installation of large ML packages from requirements-rag.txt and added a note explaining their installation is now handled by the post-create script

  • Added a missing rich dependency to requirements.txt for the video tutorial here: Python + AI: Structured outputs

Does this introduce a breaking change?

[ ] Yes
[x] No (since the devcontainer started up in recovery mode, I'm hoping this at least gets people to open up the codespace with no issues.)

Pull Request Type

What kind of change does this Pull Request introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

How to Test

  • Get the code
git clone https://github.com/BA-CalderonMorales/python-openai-demos.git
cd python-openai-demos
git checkout fix/devcontainer-disk-space-optimization
ctrl + shift + p
"Codespaces: Rebuild Container"
Full Rebuild
Container should not be in recovery mode.
  • Test the code
    For testing, I ran the suite of python scripts from the demo. Those from the Python + AI: Structured Output video worked for me.

What to Check

Here is the output from running each of the files:

Click to Collapse image

Other Information

Feel free to reach out if you have questions. I asked Claude Sonnet 4.5 to help me be surgical with the edits to make sure there are minimal changes to make this just work for others.

Hope this helps!

The 'rich' package is used by all structured_outputs_*.py example files
(10 files total) but was not listed in any requirements file, causing
ModuleNotFoundError when running these examples. This adds 'rich' to
requirements.txt to ensure all dependencies are properly documented and
installed during setup.
@BA-CalderonMorales BA-CalderonMorales changed the title fix: trying to get devcontainer to build on first open of codespace. Fix: Trying to get devcontainer to build on first open of Codespace. Oct 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant