Create python environment for oam 77/12677/1
authorMartin Skorupski <martin.skorupski@highstreet-technologies.com>
Fri, 5 Apr 2024 13:13:24 +0000 (15:13 +0200)
committerMartin Skorupski <martin.skorupski@highstreet-technologies.com>
Fri, 5 Apr 2024 13:16:02 +0000 (15:16 +0200)
- folder ".oam" should be used

Issue-ID: OAM-405
Change-Id: Id92bf053f804a4d6c847a6799533c769f5a48956
Signed-off-by: Martin Skorupski <martin.skorupski@highstreet-technologies.com>
code/network-generator/.gitignore
code/network-generator/CONTRIBUTING.md
code/network-generator/Makefile
code/network-generator/README.md

index 403392b..64369ef 100644 (file)
@@ -130,6 +130,7 @@ celerybeat.pid
 # Environments
 .env
 .venv
+.oam
 env/
 venv/
 ENV/
index 478386a..7a22c5d 100644 (file)
@@ -22,7 +22,7 @@ sudo apt install python3.10-venv
 
 ## Setting up your own virtual environment
 
-Run `make virtualenv` to create a virtual environment.
+Run `make virtual_env_4_oam` to create a virtual environment.
 then activate it with `source .venv/bin/activate`.
 
 ## Install the project in develop mode
@@ -85,18 +85,18 @@ This project comes with a `Makefile` that contains a number of useful utility.
 Usage: make <target>
 
 Targets:
-help:             ## Show the help.
-install:          ## Install the project in dev mode.
-fmt:              ## Format code using black & isort.
-lint:             ## Run pep8, black, mypy linters.
-test: lint        ## Run tests and generate coverage report.
-watch:            ## Run tests on every change.
-clean:            ## Clean unused files.
-virtualenv:       ## Create a virtual environment.
-release:          ## Create a new tag for release.
-docs:             ## Build the documentation.
-switch-to-poetry: ## Switch to poetry package manager.
-init:             ## Initialize the project based on an application template.
+help:              ## Show the help.
+install:           ## Install the project in dev mode.
+fmt:               ## Format code using black & isort.
+lint:              ## Run pep8, black, mypy linters.
+test: lint         ## Run tests and generate coverage report.
+watch:             ## Run tests on every change.
+clean:             ## Clean unused files.
+virtual_env_4_oam: ## Create a virtual environment.
+release:           ## Create a new tag for release.
+docs:              ## Build the documentation.
+switch-to-poetry:  ## Switch to poetry package manager.
+init:              ## Initialize the project based on an application template.
 ```
 
 ## Making a new release
index ab2b357..d396d83 100644 (file)
@@ -1,5 +1,5 @@
 .ONESHELL:
-ENV_PREFIX=$(shell python -c "if __import__('pathlib').Path('.venv/bin/pip').exists(): print('.venv/bin/')")
+ENV_PREFIX=$(shell python -c "if __import__('pathlib').Path('.oam/bin/pip').exists(): print('.oam/bin/')")
 USING_POETRY=$(shell grep "tool.poetry" pyproject.toml && echo "yes")
 
 .PHONY: help
@@ -21,7 +21,7 @@ show:             ## Show the current environment.
 .PHONY: install
 install:          ## Install the project in dev mode.
        @if [ "$(USING_POETRY)" ]; then poetry install && exit; fi
-       @echo "Don't forget to run 'make virtualenv' if you got errors."
+       @echo "Don't forget to run 'make virtual_env_4_oam' if you got errors."
        $(ENV_PREFIX)pip install -e .[test]
 
 .PHONY: format
@@ -64,16 +64,19 @@ clean:            ## Clean unused files.
        @rm -rf .tox/
        @rm -rf docs/_build
 
-.PHONY: virtualenv
-virtualenv:       ## Create a virtual environment.
+.PHONY: virtual_env_4_oam
+virtual_env_4_oam:       ## Create a virtual environment for O-RAN-SC OAM project.
        @if [ "$(USING_POETRY)" ]; then poetry install && exit; fi
-       @echo "creating virtualenv ..."
-       @rm -rf .venv
-       @python3 -m venv .venv
-       @./.venv/bin/pip install -U pip
-       @./.venv/bin/pip install -e .[test]
+       @echo "Creating a virtual environment for O-RAN-SC OAM project ..."
+       @rm -rf .oam
+       @python3 -m venv .oam
+       @./.oam/bin/pip install -U pip
+       @./.oam/bin/pip install -e .[test]
+       @./.oam/bin/pip install -r requirements.txt
+       @./.oam/bin/pip install -r requirements-test.txt
+
        @echo
-       @echo "!!! Please run 'source .venv/bin/activate' to enable the environment !!!"
+       @echo "!!! Please run 'source .oam/bin/activate' to enable the OAM environment !!!"
 
 .PHONY: release
 release:          ## Create a new tag for release.
@@ -98,7 +101,7 @@ docs:             ## Build the documentation.
 switch-to-poetry: ## Switch to poetry package manager.
        @echo "Switching to poetry ..."
        @if ! poetry --version > /dev/null; then echo 'poetry is required, install from https://python-poetry.org/'; exit 1; fi
-       @rm -rf .venv
+       @rm -rf .oam
        @poetry init --no-interaction --name=a_flask_test --author=rochacbruno
        @echo "" >> pyproject.toml
        @echo "[tool.poetry.scripts]" >> pyproject.toml
index 0f91dfb..66a6326 100644 (file)
@@ -28,6 +28,8 @@ Please follow the libyang [installation instructions](https://github.com/CESNET/
 ## Usage 
 
 ```
+make virtual_env_4_oam
+source .oam/bin/activate
 python3 -m network_generation config.json
 ```