Skip to content

Commit

Permalink
Merge pull request #21 from VowpalWabbit/release_to_pypi
Browse files Browse the repository at this point in the history
add pypi release workflow and fixes
  • Loading branch information
olgavrou committed Oct 26, 2023
2 parents 029114b + 9a71ade commit e30036f
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 8 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/pypi_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: pypi-release

on:
release:
types: [published]

jobs:
deploy:
strategy:
matrix:
os: ['ubuntu-latest']
python-version: [3.10]

runs-on: ${{ matrix.os }}
environment:
name: Release-PyPi
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Build
run: |
pip install twine
python setup.py sdist bdist_wheel
- name: Check wheels
run: twine check dist/*

- name: Upload to TestPyPi
uses: pypa/gh-action-pypi-publish@v1.6.4
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/

- name: Upload to PyPi
uses: pypa/gh-action-pypi-publish@v1.6.4
with:
password: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The beauty of `learn_to_pick` is its flexibility. Whether you're a fan of Vowpal

## Installation

`pip install .`
`pip install learn-to-pick`

## Basic Usage

Expand Down
2 changes: 1 addition & 1 deletion notebooks/news_recommendation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"outputs": [],
"source": [
"picker = learn_to_pick.PickBest.create(metrics_step=20, metrics_window_size=20, selection_scorer=CustomSelectionScorer())\n",
"random_picker = learn_to_pick.PickBest.create(metrics_step=20, metrics_window_size=20, policy=learn_to_pick.PickBestRandomPolicy, selection_scorer=CustomSelectionScorer())"
"random_picker = learn_to_pick.PickBest.create(metrics_step=20, metrics_window_size=20, policy=learn_to_pick.PickBestRandomPolicy(), selection_scorer=CustomSelectionScorer())"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebooks/prompt_variable_injection.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
" preference = learn_to_pick.BasedOn([\"Vegetarian\", \"regular dairy is ok\"]),\n",
")\n",
"\n",
"picked_meal = response[\"picked\"][0][\"meal\"]"
"picked_meal = response[\"picked\"][\"meal\"]"
]
},
{
Expand Down
13 changes: 11 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
from setuptools import setup, find_packages
import os

with open("README.md", "r", encoding="UTF-8") as fh:
long_description = fh.read()

with open("version.txt", "r", encoding="utf-8") as version_file:
version = version_file.read().strip()

setup(
name="learn_to_pick",
version="0.1",
version=version,
install_requires=[
"numpy",
"pandas",
Expand All @@ -14,7 +21,9 @@
],
extras_require={"dev": ["pytest", "black==23.10.0"]},
author="VowpalWabbit",
description="",
description="a python library for online learning RL loops, specialized for Contextual Bandit scenarios.",
long_description_content_type="text/markdown",
long_description=long_description,
packages=find_packages(where="src"),
package_dir={"": "src"},
url="https://github.com/VowpalWabbit/learn_to_pick",
Expand Down
3 changes: 0 additions & 3 deletions tests/unit_tests/pytest.ini

This file was deleted.

1 change: 1 addition & 0 deletions version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.1

0 comments on commit e30036f

Please sign in to comment.