Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
name: Keboola Component Build & Deploy Pipeline
on:
push:
branches:
- feature/*
- bug/*
- fix/*
branches-ignore:
- main
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! let’s add this also to the cookiecutter template, please 🙏

Copy link
Contributor Author

@soustruh soustruh Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, planned to do that 🙂 I was just tired of having to examine push.yml to pick a branch name every time, so I figured out this… It's also possible to use:

branches:
  - "!main"

but then you have to enter at least one other non-excluding rule. "*" would probably be enough, but I consider my solution more readable. 👍

tags:
- "*" # Skip the workflow on the main branch without tags
- "*" # Skip the workflow on the main branch without tags

concurrency: ci-${{ github.ref }} # to avoid tag collisions in the ECR
env:
Expand Down
2 changes: 2 additions & 0 deletions src/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ def run(self):
os.environ["VIRTUAL_ENV"] = str(venv_path)

if self.parameters.source == SourceEnum.CODE:
if "keboola.component" not in self.parameters.packages:
self.parameters.packages.insert(0, "keboola.component")
PackageInstaller.install_packages(self.parameters.packages)
else:
PackageInstaller.install_packages_for_repository(base_path)
Expand Down
11 changes: 3 additions & 8 deletions src/package_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,10 @@

class PackageInstaller:
@staticmethod
def install_packages(packages: list[str], use_pip=False):
if use_pip:
uv_args = ["pip", "install"]
else:
uv_args = ["add"]

def install_packages(packages: list[str]):
for package in packages:
logging.info("Installing package: %s...", package)
args = ["uv", *uv_args, package]
args = ["uv", "pip", "install", package]
SubprocessRunner.run(args, MSG_OK, MSG_ERR)

@staticmethod
Expand All @@ -36,7 +31,7 @@ def install_packages_for_repository(repository_path: Path):
requirements_file = repository_path / "requirements.txt"

# Explicitly install keboola.component in case user didn't include in their dependencies file
PackageInstaller.install_packages(["keboola.component"], use_pip=True)
PackageInstaller.install_packages(["keboola.component"])

args = None
if pyproject_file.exists() and uv_lock_file.exists():
Expand Down
16 changes: 0 additions & 16 deletions tests/config-7_code-base-httpx-only.json

This file was deleted.

14 changes: 14 additions & 0 deletions tests/config-7_code-base-no-packages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"parameters": {
"source": "code",
"packages": [],
"user_properties": {
"debug": true,
"rectangle_a": 3.0,
"rectangle_b": 4.0,
"endpoint": "https://www.example.com"
},
"venv": "base",
"code": "import sys\n\nprint(sys.executable, sys.version)\n\nfrom keboola.component import CommonInterface\n\n\nci = CommonInterface()\nprint(ci.configuration.parameters)\n"
}
}
16 changes: 0 additions & 16 deletions tests/config-8_code-3.13-httpx-only.json

This file was deleted.

14 changes: 14 additions & 0 deletions tests/config-8_code-3.13-no-packages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"parameters": {
"source": "code",
"packages": [],
"user_properties": {
"debug": true,
"rectangle_a": 3.0,
"rectangle_b": 4.0,
"endpoint": "https://www.example.com"
},
"venv": "3.13",
"code": "import sys\n\nprint(sys.executable, sys.version)\n\nfrom keboola.component import CommonInterface\n\n\nci = CommonInterface()\nprint(ci.configuration.parameters)\n"
}
}
134 changes: 69 additions & 65 deletions uv.lock

Large diffs are not rendered by default.