Skip to content

Oracle Developer's Python Starter Kit for VS Code Remote - Containers extension

License

Notifications You must be signed in to change notification settings

fuzziebrain/vscode-remote-oradev-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Oracle Developer's Python Starter Kit for VS Code Remote - Containers Extension

Visual Studio Code (VS Code) provides extensions for working with remote machines. This includes the Remote - Containers that allows developers to use Docker containers as a self-contained development environment.

Using containers has many benefits. It allows developers to maintain a consistent development environment that can be easily moved or copied onto other workstations or by other developers. It creates a sandbox environment that shields your host system from unnecessary software components, that is especialy crucial when experimenting and documenting.

Using this starter kit, an Oracle Developer can quickly get started with developing in Python, within a development container (devcontainer).

Software Requirements

Getting Started

The starter kit runs a Docker container with the following components for Python development:

Place any additional Python libraries required by the project in the requirements.txt file. Do not include cx_Oracle as it is already included in the Docker build. Packages should be available on the Python Package Index.

The devcontainer installs the VS Code extension for Python and configure pylint as the linter. Add any additional extensions required in the extensions attribute in the devcontainer.json file. For example, this adds the Language PL/SQL extension:

"extensions": [ "ms-python.python", "xyz.plsql-language" ]
  1. Build a Docker image for running an Oracle Database using the instructions found here. Alternatively, for Linux and Mac users, there are scripts in the docker-apex-stack that will facilitate the process and at the same time, provision a full Oracle Application Express (APEX) stack.
  2. Run a container using the image and attach it to a Docker network.
  3. Clone the project:
    $ git clone https://github.com/fuzziebrain/vscode-remote-oradev-python.git
  4. Modify the Docker network to attach to, in the devcontainer.json. For example, the following parameter attaches the devcontainer to the axer_network typically used with the docker-apex-stack:
    "--network", "axer_network"
  5. If a port is required to be exposed, add it to the attribute appPort. For example, Flask run on port 5000 by default:
    "appPort": [ 5000 ]
  6. Open the project directory in VS Code. It should detect the devcontainer and ask whether to reload the folder from within the container.
    Reopen in Container

    or

    Run the command Remote Containers: Reopen Folder in Container
    Reopen in Container

Modifying the Devcontainer

Customise the Docker container if necessary. To rebuild the container, run the command Remote Containers: Rebuild Container. This command is only available when the folder is opened in a devcontainer.

Rebuild Container

Running Code

Debugging

A debug configuration has been created. See launch.json.

Connecting to the Oracle Database

Developers are encouraged to store database credentials safely in encrypted Oracle Wallets, as oppose to storing them in plaintext either within the Python script or as environment variables. Follow the Oracle Database Connection with Oracle Wallet guide.

Support for Oracle Cloud Infrastructure

See Support for Oracle Cloud Infrasturcture Guide.

Credits

The beauty of Open Source is that we can learn and build on top of previous knowledge shared by others. I wish to thank the following projects that have guided the creation of this starter kit:

  1. Microsoft's Try Out Development Containers: Python
  2. Oracle's Docker Images

License

Please see LICENSE.

About

Oracle Developer's Python Starter Kit for VS Code Remote - Containers extension

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published