Skip to content

Commit

Permalink
Publish python module to PyPI
Browse files Browse the repository at this point in the history
  • Loading branch information
juhoautio committed Apr 19, 2021
1 parent 5bcb838 commit 8a5d78e
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
18 changes: 17 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ on:
push:
branches:
- main
# poetry-dynamic-versioning gets the version from release tag.
# that's why the same steps work for pushes to main & releases.
release:
# without this a new release tag triggers 3 builds instead of 1
# https://github.community/t/action-run-being-trigger-multiple-times/16144
types: [published]

jobs:
test-and-deploy:
Expand All @@ -15,6 +21,9 @@ jobs:
- name: Set Environment variables
run: echo "SPARK_LOCAL_IP=localhost" >> $GITHUB_ENV
- uses: actions/checkout@v2
with:
# poetry-dynamic-versioning needs the full history. latest commit is not enough.
fetch-depth: '0'

- name: Set up JDK 8
uses: actions/setup-java@v2
Expand All @@ -29,7 +38,7 @@ jobs:
with:
python-version: '3.7'
- name: Install Poetry
run: pip install poetry==1.1.4
run: pip install poetry==1.1.4 poetry-dynamic-versioning==0.12.1
- name: Install libkrb5-dev
run: sudo apt-get install libkrb5-dev # This is needed for installing pykerberos
- name: Install python dependencies
Expand All @@ -39,6 +48,13 @@ jobs:
run: poetry run pytest
working-directory: ./python

- name: Build python package
run: poetry build
working-directory: ./python
- name: Publish to PyPI
run: poetry publish -u '__token__' -p '${{ secrets.PYPI_TOKEN }}'
working-directory: ./python

- name: Set up Apache Maven Central
uses: actions/setup-java@v2
with: # running setup-java again overwrites the settings.xml
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ satisfies the requirements of `DruidSource`

### PySpark

Install the latest pre-release version:
```
pip install 'rovio-ingest>0.0.0' --pre
```

First, set the following spark conf:

```python
Expand Down
21 changes: 20 additions & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@

[tool.poetry]
name = "rovio-ingest"
version = "1.0.0"
# NOTE: This version is ignored.
# - Versions are managed by poetry-dynamic-versioning
# - Git tags are used to create new releases
version = "0.0.1"
description = ""
authors = ["Vivek Balakrishnan <[email protected]>", "Juho Autio <[email protected]>"]

Expand All @@ -33,6 +36,22 @@ sparkmagic = "^0.15.0"
boto3 = "*"
safety = "^1.10.3"

[tool.poetry-dynamic-versioning]
enable = true
metadata = true
dirty = true
vcs = "git"
style = "pep440"
format-jinja = """
{%- if distance == 0 -%}
{{ serialize_pep440(base, stage, revision) }}
{%- elif revision is not none -%}
{{ serialize_pep440(base, stage, revision + 1, dev=distance) }}
{%- else -%}
{{ serialize_pep440(bump_version(base), stage, revision, dev=distance) }}
{%- endif -%}
"""

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

0 comments on commit 8a5d78e

Please sign in to comment.