Devcontainer + vscode + uv + robotcode

Some time ago I created a repo where I tried the same thing :wink:

The trick to setup a robot framework library with uv is the following:

Create your working folder and in that folder create a normal python library with uv, like this:

mkdir robotframework-dosomething
cd robotframework-dosomething
uv init --name DoSomething --lib   # notice here without robotframework-

then open the pyproject.toml and prepend robotframework- to the name setting, like this:

name = "robotframework-dosomething"

Now the “complicated” part, that depends on you build-system that your pyproject.toml uses, but if you use uv’s default hatchling you should add a new section to your pyproject toml file, like this:

[tool.hatch.build.targets.wheel]
packages = ["src/DoSomething"]   # attention this is case sensitive!!!

this tells hatchling where it can find the sources for the project when it builds a wheel package, thats what happens if you install the project in editable mode.

You can now add robotframework as a dependency with

uv add robotframework

and maybe add other dev dependencies like this:

uv add --dev robotframework-tidy

and now remove the old .venv and create a new one with

uv sync

now you can select the python environment in vscode and everything should run and also robot. There is no need to setup what ever python paths or so, because the project is installed per default in editable mode.

1 Like