Skip to content

Commit

Permalink
added uv lock/venv and env file for pylance resolve sequence (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
hellt authored Jan 9, 2025
1 parent 05e9282 commit d82c224
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PYTHONPATH=".:./common"
4 changes: 3 additions & 1 deletion dev-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

## vrnetlab module and vscode pylance

since vrnetlab module is in the `common` dir the pylance extension in vscode will not be able to find the module reference in `launch.py` files. To fix this, add the following to the `settings.json` file in vscode:
We added `.env` file in the root of the repo to add `common` dir to the python path so that the pylance extension can find the module.

However, if this doesn't work for you, add the following to the `settings.json` file in vscode:

```json
{
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[project]
name = "vrnetlab"
version = "0.1.0"
description = "vrnetlab fork for Containerlab integration"
readme = "README.md"
requires-python = ">=3.11"
dependencies = []
8 changes: 4 additions & 4 deletions sros/docker/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ def getMem(vmMode: str, ram: int) -> int:
if vmMode == "integrated":
# Integrated VM can use both MEMORY and CP_MEMORY env vars
if "MEMORY" in os.environ:
return 1024 * get_digits(os.getenv("MEMORY"))
return 1024 * vrnetlab.get_digits(os.getenv("MEMORY"))
if "CP_MEMORY" in os.environ:
return 1024 * get_digits(os.getenv("CP_MEMORY"))
return 1024 * vrnetlab.get_digits(os.getenv("CP_MEMORY"))
if vmMode == "cp":
if "CP_MEMORY" in os.environ:
return 1024 * get_digits(os.getenv("CP_MEMORY"))
return 1024 * vrnetlab.get_digits(os.getenv("CP_MEMORY"))
if vmMode == "lc":
if "LC_MEMORY" in os.environ:
return 1024 * get_digits(os.getenv("LC_MEMORY"))
return 1024 * vrnetlab.get_digits(os.getenv("LC_MEMORY"))
return 1024 * int(ram)


Expand Down
7 changes: 7 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d82c224

Please sign in to comment.