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
4 changes: 0 additions & 4 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,3 @@ jobs:
run: ./gradlew :dagger-core:minimalAndShadowPublish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish Zip Package of dagger-py-functions
run: ./gradlew publishPyZipPublicationToGitHubPackagesRepository
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/python_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Python Package
on:
release:
types: [created]

jobs:
publishPythonZip:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Zip Python Udf
run: |
zip -r python_udfs.zip dagger-py-functions/udfs -x "*/__init__.py"
zip -r dagger-py-functions.zip python_functions/requirements.txt python_functions/data python_udfs.zip
- name: Upload Release
uses: ncipollo/release-action@v1
with:
artifacts: dagger-py-functions.zip
allowUpdates: true
omitNameDuringUpdate: true
omitBodyDuringUpdate: true
omitPrereleaseDuringUpdate: true
token: ${{ secrets.GITHUB_TOKEN }}
27 changes: 27 additions & 0 deletions .github/workflows/python_validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Python Validation

on: push

jobs:
pythonValidation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v3
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install apache-flink==1.14.3
cd dagger-py-functions
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Test with pytest
run: |
cd dagger-py-functions
pytest --disable-warnings
49 changes: 2 additions & 47 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,25 +1,7 @@
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}

}

plugins {
id 'maven-publish'
}

ext {
flinkVersion = System.getenv('flinkVersion') ?: '1.14.3'
}

def pyZipVersion = rootProject.file('version.txt').text.trim()
group 'io.odpf'

subprojects {
repositories {
mavenLocal()
Expand All @@ -33,37 +15,10 @@ subprojects {
apply plugin: 'idea'
apply plugin: 'checkstyle'

group 'io.odpf'

checkstyle {
toolVersion '7.6.1'
configFile rootProject.file("config/checkstyle/checkstyle.xml")
}
}

task makePyZip(type: Zip) {
from fileTree(dir: 'dagger-py-functions')
include '**/*'
archiveName "dagger-py-functions.zip"
destinationDir file("$rootDir/")
}

publishing {
publications {
pyZip(MavenPublication) {
artifact source: makePyZip, extension: 'zip'
groupId group
artifactId 'dagger-py-functions'
version pyZipVersion
}
}

repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/odpf/dagger"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
1 change: 1 addition & 0 deletions dagger-py-functions/data/sample_data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sample_text
2 changes: 2 additions & 0 deletions dagger-py-functions/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pytest==7.1.2
flake8==4.0.1
File renamed without changes.
Empty file.
6 changes: 6 additions & 0 deletions dagger-py-functions/test/scalar/sample_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from udfs.scalar.sample import sample


def testSample():
f = sample._func
assert f("input_text_") == "input_text_sample_text"
9 changes: 9 additions & 0 deletions dagger-py-functions/udfs/scalar/sample.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from pyflink.table import DataTypes
from pyflink.table.udf import udf


@udf(result_type=DataTypes.STRING())
def sample(text):
f = open("data/sample_data.txt", "r")
data = f.read()
return text + data
9 changes: 0 additions & 9 deletions dagger-py-functions/udfs/scalar/sample_udf.py

This file was deleted.