Skip to content

feat(python): add Python module#947

Open
AttractiveToad wants to merge 3 commits into
coder:mainfrom
AttractiveToad:feat/attractivetoad-python-module
Open

feat(python): add Python module#947
AttractiveToad wants to merge 3 commits into
coder:mainfrom
AttractiveToad:feat/attractivetoad-python-module

Conversation

@AttractiveToad

@AttractiveToad AttractiveToad commented Jul 7, 2026

Copy link
Copy Markdown

Summary

  • add an attractivetoad/python module for Debian/Ubuntu workspaces
  • install Python 3, pip, and venv with apt-get
  • create a python command that points to python3 when python is missing

Tests

  • PATH="/tmp/opencode/terraform-bin:$PATH" terraform fmt -recursive -diff "registry/attractivetoad/modules/python"
  • PATH="/tmp/opencode/terraform-bin:$PATH" terraform test -no-color -verbose
  • PATH="/tmp/opencode/terraform-bin:$PATH" MODULE_CHANGED_FILES="registry/attractivetoad/modules/python/main.tf registry/attractivetoad/modules/python/main.tftest.hcl registry/attractivetoad/modules/python/scripts/install.sh.tftpl registry/attractivetoad/modules/python/README.md registry/attractivetoad/modules/python/main.test.ts" ./scripts/terraform_validate.sh
  • PATH="/tmp/opencode/terraform-bin:$PATH" bun test main.test.ts
  • bun x shellcheck --severity=warning --format=gcc /tmp/opencode/python-install-rendered.sh

Copilot AI review requested due to automatic review settings July 7, 2026 19:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new community Terraform module under registry/attractivetoad to install Python tooling on Debian/Ubuntu Coder workspaces, using coder-utils for script orchestration and standardized module log/script directories.

Changes:

  • Introduces attractivetoad/python module with an apt-based install script and coder-utils orchestration.
  • Adds Terraform (.tftest.hcl) and TypeScript (main.test.ts) tests for the new module.
  • Adds a Python icon and namespace/module documentation.

Reviewed changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
registry/attractivetoad/README.md Adds new namespace README and module listing.
registry/attractivetoad/modules/python/main.tf Implements the Python module, inputs, coder-utils wiring, and outputs.
registry/attractivetoad/modules/python/scripts/install.sh.tftpl Adds the apt-based installation script.
registry/attractivetoad/modules/python/README.md Documents module usage and examples.
registry/attractivetoad/modules/python/main.tftest.hcl Adds Terraform plan-time assertions for defaults/outputs.
registry/attractivetoad/modules/python/main.test.ts Adds TS test for required variables/init.
.icons/python.svg Adds Python SVG icon used by the module README/UI.

Comment thread registry/attractivetoad/modules/python/main.tf Outdated
Comment thread registry/attractivetoad/modules/python/scripts/install.sh.tftpl
@AttractiveToad
AttractiveToad force-pushed the feat/attractivetoad-python-module branch 3 times, most recently from c7ceacb to da0fa28 Compare July 7, 2026 20:10
@AttractiveToad
AttractiveToad force-pushed the feat/attractivetoad-python-module branch from da0fa28 to 78d4c1c Compare July 7, 2026 20:17
@35C4n0r
35C4n0r self-requested a review July 23, 2026 14:37

@35C4n0r 35C4n0r left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@AttractiveToad would you consider using pyenv instead for python installation and version management ?
If the current way suits your needs better, I'm good with that too.

Comment on lines +41 to +52
resource "coder_script" "install" {
agent_id = var.agent_id
display_name = "Python: Install Script"
icon = var.icon
run_on_start = true
start_blocks_login = true
script = templatefile("${path.module}/scripts/install.sh.tftpl", {
PYTHON_PACKAGES = join(" ", var.python_packages)
UPDATE_PACKAGES = tostring(var.update_packages)
CREATE_PYTHON_ALIAS = tostring(var.create_python_alias)
})
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Consider using coder-utils instead, it will also write the script and logs to standardized paths.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Check codex module for example:

module "coder_utils" {
source = "registry.coder.com/coder/coder-utils/coder"
version = "0.0.1"
agent_id = var.agent_id
module_directory = "$HOME/${local.module_dir_name}"
display_name_prefix = "Codex"
icon = var.icon
pre_install_script = var.pre_install_script
post_install_script = var.post_install_script
install_script = local.install_script
}
output "scripts" {
description = "Ordered list of coder exp sync names for the coder_script resources this module creates, in run order (pre_install, install, post_install). Scripts that were not configured are absent from the list."
value = module.coder_utils.scripts
}

Comment on lines +54 to +57
output "scripts" {
description = "Ordered list of script names produced by this module, in run order."
value = ["attractivetoad-python-install"]
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We are not using coder exp sync in the scripts here, if you switch to coder-utils, the script names will be exposed and you can forward it as this module's output. Check codex module for example:

module "coder_utils" {
source = "registry.coder.com/coder/coder-utils/coder"
version = "0.0.1"
agent_id = var.agent_id
module_directory = "$HOME/${local.module_dir_name}"
display_name_prefix = "Codex"
icon = var.icon
pre_install_script = var.pre_install_script
post_install_script = var.post_install_script
install_script = local.install_script
}
output "scripts" {
description = "Ordered list of coder exp sync names for the coder_script resources this module creates, in run order (pre_install, install, post_install). Scripts that were not configured are absent from the list."
value = module.coder_utils.scripts
}

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