Skip to content

Commit e50b927

Browse files
Merge pull request #27 from llvm-ml/lp/pypi-patch
Complete the GitHub Actions & Publish Package
2 parents c32e3aa + a5147d9 commit e50b927

File tree

6 files changed

+2309
-34
lines changed

6 files changed

+2309
-34
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Upload Package to PyPi
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
package-and-deploy:
12+
name: ${{ matrix.python_version }}
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
python_version: ["3.9", "3.10"]
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: Set up Python
21+
uses: actions/setup-python@v3
22+
with:
23+
python-version: "{{ matrix.python_version }}"
24+
- name: Install Poetry
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install poetry
28+
poetry config virtualenvs.in-project false
29+
poetry config virtualenvs.path ~/.virtualenvs
30+
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
31+
- name: Build & publish package
32+
poetry publish --build

.github/workflows/poetry_build.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Test Build of Package
2+
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
package-and-deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: Set up Python
14+
uses: actions/setup-python@v3
15+
with:
16+
python-version: 3.9
17+
- name: Install Poetry
18+
run: |
19+
python -m pip install --upgrade pip
20+
pip install poetry
21+
poetry config virtualenvs.in-project false
22+
poetry config virtualenvs.path ~/.virtualenvs
23+
- name: Build package
24+
run: |
25+
poetry install

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ multiple sources.
55

66
## Getting Started
77

8-
To get started with the dataset construction utilities, we'd suggest to use the packaged [pipenv](https://pipenv.pypa.io) to isolate the Python from your system isolation or other environments. To install, you then have to
8+
To get started with the dataset construction utilities, we'd suggest to use the
9+
packaged [pipenv](https://pipenv.pypa.io), or the packaged [poetry](https://python-poetry.org/)
10+
to isolate the Python from your system isolation or other environments.
11+
12+
### Pipenv
13+
14+
To get started with pipenv, you then have to
915

1016
```bash
1117
pipenv install
@@ -29,6 +35,27 @@ In case you want to develop the package, this becomes
2935
pipenv shell && pip install -e .
3036
```
3137

38+
### Poetry
39+
40+
To get started with poetry, you then have to
41+
42+
```bash
43+
poetry install
44+
```
45+
46+
which will draw the exact software version from the packaged lockfile, and install the editable version of the
47+
dataset construction utilities into the environment. To only install the dependencies, you can run
48+
49+
```bash
50+
poetry install --no-root
51+
```
52+
53+
To then develop inside of poetry's virtual environment, we can launch a shell with
54+
55+
```bash
56+
poetry shell
57+
```
58+
3259
## Creating First Data
3360

3461
To create your first small batch of IR data you then have to run from the root directory of the package

llvm_ir_dataset_utils/tools/upload_dataset_hf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ def main(_):
5353
for language_folder in os.listdir(FLAGS.dataset_dir):
5454
for file_name in os.listdir(
5555
os.path.join(FLAGS.dataset_dir, language_folder)):
56-
if FLAGS.start_after and file_to_upload <= FLAGS.start_after:
57-
logging.info(f'Skipping uploading {file_to_upload}')
56+
if FLAGS.start_after and file_name <= FLAGS.start_after:
57+
logging.info(f'Skipping uploading {file_name}')
5858
continue
5959

6060
full_file_path = os.path.join(FLAGS.dataset_dir, language_folder,

0 commit comments

Comments
 (0)