Create, package, deploy, and test Python OCI Functions from VS Code without building container images.
Disclaimer: This extension is not officially supported or endorsed by Oracle Corporation. Use at your own risk.
Main features
| Command |
What it does |
| Create Python Function |
Create a default function or a Vault-backed Basic authorizer. |
| Generate ZIP |
Package your source and Python dependencies into a deployment ZIP. |
| Deploy |
Select an application by name, upload to Object Storage, and create or update a function. |
| Test |
Generate sample JSON from your handler, edit it, and invoke the deployed function. |
Use the Command Palette prefix OCI Code-only Functions, or the Explorer right-click menu.
Quick start
- Open a trusted workspace and run Create Python Function.
- Choose Default template or Basic authorizer template and a parent folder.
- Edit
main.py and add dependencies to requirements.txt if needed.
- Run Generate ZIP or Deploy. Deploy creates or reuses the
ocifunctions bucket automatically.
- Run Test, review the generated JSON, and check the OCI Code-only Functions Output panel.
The Basic authorizer creates basic-auth-template/ with setup instructions and a sample request.
Packaging uses the extension's bundled scripts; no local generatezip.sh is needed.
New functions default to python312.ol9, 256 MiB, and main.handler.
Deploy reports submission; check OCI for readiness before testing. Test invokes deployed code, so deploy local changes first.
Uploaded archives remain in Object Storage. The extension does not create applications, secrets, or IAM policies.
Requirements
- VS Code 1.85+ on macOS, Linux, or Windows through WSL.
- Bash and Python 3.10+; pip for installing dependencies.
- An authenticated OCI CLI with code-only archive support for Deploy and Test.
- An existing Functions application and the IAM permissions below, plus permissions for your CLI identity to deploy and upload.
Configure your OCI profile and region through ociFunctions.profile and ociFunctions.region.
Packaging defaults to Python 3.12 and Linux x86_64. Match ociFunctions.pythonVersion and ociFunctions.pipPlatform to your OCI runtime and architecture.
For SSH or WSL workspaces, tools and credentials must be available on the remote host.
Python dependencies
Place requirements.txt beside main.py. Dependencies go into python/ in the ZIP; source goes into function/.
If requirements are missing, dependency installation is skipped.
To generate requirements manually, install pipreqs and run:
pipreqs . --ignore .venv,venv
If build/ already exists, use --ignore .venv,venv,build. Review generated packages before building.
The extension does not generate or overwrite requirements.
The Python FDK is included in the managed Python runtime for code-only functions. You do not have to package the FDK in the archive.
Basic authorizer configuration
In the deployed function's Configuration, add and save:
| Key |
Value |
BASIC_AUTH_SECRET_OCID |
Your OCI secret OCID, for example ocid1.vaultsecret.oc1.iad.<unique-id>. |
Use the secret OCID, not the vault OCID. The secret must contain JSON with username and password fields.
Configure this entry on each authorizer function and grant its dynamic group secret-read access.
IAM Policies
Replace test-comp and the OCID placeholders with your resource compartments.
These policies supplement the permissions used by your local OCI CLI identity.
1. FunctionStorageAccessPolicy
Allows the Functions application to read deployment ZIPs. test-comp is the bucket compartment; FUNCTION_COMPARTMENT_OCID identifies the Functions application compartment.
Allow any-user to read objects in compartment test-comp where all {request.principal.type = 'fnapp', request.principal.compartment.id = 'FUNCTION_COMPARTMENT_OCID', target.bucket.name = 'ocifunctions'}
2. FunctionSecretAccessPolicy
Required only for the Basic authorizer template. Here, test-comp contains the secret.
Allow dynamic-group basic-auth-functions to read secret-bundles in compartment test-comp
For custom identity domains, use the domain-qualified group instead:
Allow dynamic-group 'MinimalDomain'/'basic-auth-functions' to read secret-bundles in compartment test-comp
Replace MinimalDomain with your identity domain name.
3. ApigatewayFunctionAccessPolicy
Required for API Gateway to invoke the function. test-comp contains the function; API_GATEWAY_COMPARTMENT_OCID identifies the API Gateway compartment.
Allow any-user to use functions-family in compartment test-comp where ALL {request.principal.type = 'ApiGateway', request.resource.compartment.id = 'API_GATEWAY_COMPARTMENT_OCID'}
Dynamic Groups
Required only for the Basic authorizer template. Create basic-auth-functions in your identity domain:
ALL {resource.type = 'fnfunc', resource.compartment.id = 'FUNCTION_COMPARTMENT_OCID'}
Use the deployed function's compartment OCID. The secret-access policy above grants this group permission to read secrets.
Settings
| Setting |
Purpose |
ociFunctions.cliPath |
OCI CLI executable; default oci. |
ociFunctions.profile / ociFunctions.region |
Override OCI CLI defaults. |
ociFunctions.compartmentId |
Skip the compartment picker. |
ociFunctions.bucketCompartmentId |
Use another compartment for the deployment bucket. |
ociFunctions.pythonPath |
Python executable; default python3. |
ociFunctions.pythonVersion |
Target Python version; default 3.12. |
ociFunctions.pipPlatform |
Target wheel platform; default manylinux2014_x86_64. |