diff --git a/README.md b/README.md index bb5b8b9..7855f3b 100644 --- a/README.md +++ b/README.md @@ -1,80 +1,49 @@ -Custom Python Application -============= +# Custom Python Component +This component lets you run your own Python code directly within Keboola, with support for custom dependencies configured via the UI. -**Table of contents:** +## Configuration -[TOC] +- `code`: JSON encoded Python code to run. +- `packages`: List of extra packages to be installed. -Functionality Notes -=================== +If you're not sure whether you need to install certain package or not, you can run the command `uv pip list` via subprocess (see the example below). -Prerequisites -============= +```json +{ + "parameters": { + "code": "import datetime\nimport subprocess\n\nprint(\"Hello world!\")\nprint(\"Current date and time:\", datetime.datetime.now())\nprint(\"See the full list of preinstalled packages:\")\n\nsubprocess.check_call([\"uv\", \"pip\", \"list\"])\n", + "packages": [] + } +} +``` -- Obtain the API token -- Register the application -- Any other necessary setup steps - -Features -======== - -| **Feature** | **Note** | -|-------------------------|-----------------------------------------------| -| Generic UI form | Provides a dynamic UI form. | -| Row-based configuration | Enables structured configuration using rows. | -| OAuth | OAuth authentication is enabled. | -| Incremental loading | Supporst fetching data in increments. | -| Backfill mode | Allows seamless backfill setup. | -| Date range filter | Enables filtering data by a specifid date range. | - -Supported Endpoints -=================== - -If you need additional endpoints, please submit a request to -[ideas.keboola.com](https://ideas.keboola.com/). - -Configuration -============= - -Param 1 -------- - -Param 2 -------- - -Output -====== - -- List of tables -- Foreign keys -- Schema Development ----------- If needed, update the local data folder path by replacing the `CUSTOM_FOLDER` placeholder in the `docker-compose.yml` file: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +``` volumes: - ./:/code - ./CUSTOM_FOLDER:/data -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +``` Clone the repository, initialize the workspace, and run the component using the following commands: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -git clone git@bitbucket.org:kds_consulting_team/kds-team.app-custom-python.git kds-team.app-custom-python -cd kds-team.app-custom-python -docker-compose build -docker-compose run --rm dev -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +``` +git clone git@github.com:keboola/component-custom-python.git +cd component-custom-python +docker compose build +docker compose up dev +``` To run the test suite and perform a lint check, use: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -docker-compose run --rm test -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +``` +docker compose up test +``` Integration =========== diff --git a/src/component.py b/src/component.py index 5c3f2cd..c764818 100644 --- a/src/component.py +++ b/src/component.py @@ -42,7 +42,6 @@ def run(self): parameters = self.configuration.parameters self._set_init_logging_handler() - logging.info(sys.executable) script_path = os.path.join(self.data_folder_path, "script.py") self.prepare_script_file(script_path)