Skip to content

Commit

Permalink
make file improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
yairsimantov20 committed Jun 29, 2023
1 parent 8b507e3 commit e8a0bf9
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 14 deletions.
16 changes: 15 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,26 @@ define install_poetry
fi
endef

define deactivate_virtualenv
if [ -n "$$VIRTUAL_ENV" ]; then \
unset VIRTUAL_ENV; \
unset PYTHONHOME; \
unset -f pydoc >/dev/null 2>&1; \
OLD_PATH="$$PATH"; \
PATH=$$(echo -n "$$PATH" | awk -v RS=: -v ORS=: '/\/virtualenv\/bin$$/ {next} {print}'); \
export PATH; \
hash -r; \
echo "Deactivated the virtual environment."; \
fi
endef

.SILENT: install install/all lint lint/integrations lint/all build run new test clean


# Install dependencies
install:
$(call install_poetry)
$(call deactivate_virtualenv) && \
$(call install_poetry) && \
poetry install --with dev --all-extras


Expand Down
7 changes: 3 additions & 4 deletions port_ocean/cli/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@

import click
from cookiecutter.main import cookiecutter # type: ignore
from rich import print
from rich.console import Console

from port_ocean.cli.download_git_folder import download_folder
from port_ocean.cli.list_integrations import list_git_folders
from rich import print
from rich.console import Console


def print_logo() -> None:
Expand Down Expand Up @@ -67,7 +66,7 @@ def new(path: str) -> None:
console.print("Here are your next steps: \n", style="bold")
console.print(
"⚓️ Install necessary packages: Run [bold][blue]make install[/blue][/bold] to install all required packages for your project.\n"
f"▶️ [bold][blue]cd {path}/{name} && make install && . venv/bin/activate[/blue][/bold]\n"
f"▶️ [bold][blue]cd {path}/{name} && make install && . .venv/bin/activate[/blue][/bold]\n"
)
console.print(
"⚓️ Set sail with [blue]Ocean[/blue]: Run [bold][blue]ocean sail[/blue] <path_to_integration>[/bold] to run the project using Ocean.\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ define install_poetry
fi
endef

define deactivate_virtualenv
if [ -n "$$VIRTUAL_ENV" ]; then \
unset VIRTUAL_ENV; \
unset PYTHONHOME; \
unset -f pydoc >/dev/null 2>&1; \
OLD_PATH="$$PATH"; \
PATH=$$(echo -n "$$PATH" | awk -v RS=: -v ORS=: '/\/virtualenv\/bin$$/ {next} {print}'); \
export PATH; \
hash -r; \
echo "Deactivated the virtual environment."; \
fi
endef

.SILENT: generate_config install lint run test clean

generate_config:
Expand All @@ -32,6 +45,7 @@ generate_config:
fi

install: generate_config
$(call deactivate_virtualenv) && \
$(call install_poetry) && \
poetry install --with dev

Expand All @@ -40,7 +54,7 @@ lint:
$(call run_lint,.)

run:
$(ACTIVATE) && poetry run main.py
$(ACTIVATE) && ocean sail

test: lint
$(ACTIVATE) && poetry run pytest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = ["{{cookiecutter.full_name}} <{{cookiecutter.email}}>"]

[tool.poetry.dependencies]
python = "^3.11"
port_ocean = "^0.1.0"
port_ocean = { version = "^0.1.0.dev2", extras = ["cli"] }

[tool.poetry.group.dev.dependencies]
pytest = "^7.2"
Expand Down
9 changes: 2 additions & 7 deletions port_ocean/port_ocean.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import uvicorn
from fastapi import FastAPI, APIRouter
from loguru import logger
from starlette.types import Scope, Receive, Send

from port_ocean.clients.port.client import PortClient
from port_ocean.config.integration import IntegrationConfiguration
Expand All @@ -17,9 +16,9 @@
initialize_port_ocean_context,
)
from port_ocean.core.integrations.base import BaseIntegration
from pydantic import BaseSettings

from port_ocean.middlewares import request_handler
from pydantic import BaseSettings
from starlette.types import Scope, Receive, Send


def _get_base_integration_class_from_module(
Expand Down Expand Up @@ -47,10 +46,6 @@ def _load_module(file_path: str) -> ModuleType:
try:
spec.loader.exec_module(module)
except Exception as e:
logger.error(
f"Failed to load integration with error: {e}, "
f"please validate the integration type exists"
)
raise e

return module
Expand Down

0 comments on commit e8a0bf9

Please sign in to comment.