Skip to content

Commit f1bf759

Browse files
committed
build: use poetry for building
1 parent d6072ee commit f1bf759

File tree

9 files changed

+828
-136
lines changed

9 files changed

+828
-136
lines changed

.github/workflows/publish.yml

+41-57
Original file line numberDiff line numberDiff line change
@@ -9,61 +9,45 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
python-version: [ 3.6, 3.7, 3.8, 3.9 ]
12+
python-version: [3.7, 3.8, 3.9]
1313
steps:
14-
- uses: actions/checkout@v2
15-
- name: Set up Python ${{ matrix.python-version }}
16-
uses: actions/setup-python@v2
17-
with:
18-
python-version: ${{ matrix.python-version }}
19-
20-
- name: Patch for Python 3.6
21-
if: matrix.python-version == 3.6
22-
run: |
23-
pip install strip-hints==0.1.9
24-
./patch-python3.6.sh
25-
26-
git config --global user.email "[email protected]"
27-
git config --global user.name "Github Actions"
28-
29-
git add --all
30-
git commit --message "Python 3.6 patch"
31-
latest_tag=$(git describe --abbrev=0 --tags)
32-
git tag --force ${latest_tag}
33-
34-
- name: Install dependencies
35-
run: |
36-
pip install -r requirements.txt
37-
38-
- name: Install dev dependencies
39-
run: |
40-
pip install -r dev_requirements.txt
41-
42-
- name: Test
43-
run: |
44-
pytest
45-
46-
- name: Test install package
47-
env:
48-
PYTHON_VERSION: ${{ matrix.python-version }}
49-
run: |
50-
python setup.py bdist_wheel --python-tag py${PYTHON_VERSION//.}
51-
52-
- name: Test install package
53-
run: |
54-
pip install virtualenv
55-
virtualenv installable
56-
source installable/bin/activate
57-
58-
pip install dist/$(ls dist)
59-
60-
mkdir test_install
61-
cd test_install
62-
python -c "import datastream"
63-
64-
- name: PyPi Publish
65-
env:
66-
TWINE_USERNAME: __token__
67-
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
68-
run:
69-
twine upload dist/*
14+
- uses: actions/checkout@v2
15+
- name: Set up Python ${{ matrix.python-version }}
16+
uses: actions/setup-python@v2
17+
with:
18+
python-version: ${{ matrix.python-version }}
19+
20+
- name: Install dependencies
21+
run: |
22+
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
23+
source $HOME/.poetry/env
24+
poetry install
25+
26+
- name: Run tests
27+
run: |
28+
source $HOME/.poetry/env
29+
poetry run pytest
30+
31+
- name: Build wheels
32+
run: |
33+
source $HOME/.poetry/env
34+
poetry version $(git tag --points-at HEAD)
35+
poetry build
36+
37+
- name: Test install package
38+
run: |
39+
source $HOME/.poetry/env
40+
mkdir test_install
41+
cd test_install
42+
poetry init
43+
poetry add ../dist/$(ls dist/*.whl)
44+
45+
poetry run python -c "import datastream"
46+
47+
- name: Upload
48+
env:
49+
USERNAME: __token__
50+
PASSWORD: ${{ secrets.PYPI_TOKEN }}
51+
run: |
52+
source $HOME/.poetry/env
53+
poetry publish --username=$USERNAME --password=$PASSWORD

.github/workflows/test.yml

+63-51
Original file line numberDiff line numberDiff line change
@@ -3,58 +3,70 @@ name: Test
33
on: [push]
44

55
jobs:
6-
build:
6+
test:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
python-version: [ 3.6, 3.7, 3.8, 3.9 ]
10+
python-version: [3.7, 3.8, 3.9]
1111
steps:
12-
- uses: actions/checkout@v2
13-
- name: Set up Python ${{ matrix.python-version }}
14-
uses: actions/setup-python@v2
15-
with:
16-
python-version: ${{ matrix.python-version }}
17-
18-
- name: Cache pip
19-
uses: actions/cache@v2
20-
with:
21-
# This path is specific to Ubuntu
22-
path: ~/.cache/pip
23-
# Look to see if there is a cache hit for the corresponding requirements file
24-
key: ${{ runner.os }}-python${{ matrix.python-version}}-pip-${{ hashFiles('requirements.txt') }}-${{ hashFiles('dev_requirements.txt') }}-${ GITHUB_REF }
25-
26-
- name: Patch for Python 3.6
27-
if: matrix.python-version == 3.6
28-
run: |
29-
pip install strip-hints==0.1.9
30-
./patch-python3.6.sh
31-
32-
- name: Install dependencies
33-
run: |
34-
pip install -r requirements.txt
35-
36-
- name: Install dev dependencies
37-
run: |
38-
pip install -r dev_requirements.txt
39-
40-
- name: Test
41-
run: |
42-
pytest
43-
44-
- name: Build package
45-
env:
46-
PYTHON_VERSION: ${{ matrix.python-version }}
47-
run: |
48-
python setup.py bdist_wheel --python-tag py${PYTHON_VERSION//.}
49-
50-
- name: Test install package
51-
run: |
52-
pip install virtualenv
53-
virtualenv installable
54-
source installable/bin/activate
55-
56-
pip install dist/$(ls dist)
57-
58-
mkdir test_install
59-
cd test_install
60-
python -c "import datastream"
12+
- uses: actions/checkout@v2
13+
- name: Set up Python ${{ matrix.python-version }}
14+
uses: actions/setup-python@v2
15+
with:
16+
python-version: ${{ matrix.python-version }}
17+
18+
- name: Cache pip
19+
uses: actions/cache@v2
20+
with:
21+
path: ~/.cache/pip
22+
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}-${ GITHUB_REF }
23+
restore-keys: |
24+
${{ runner.os }}-pip-
25+
${{ runner.os }}-
26+
27+
- name: Install dependencies
28+
run: |
29+
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
30+
source $HOME/.poetry/env
31+
poetry install
32+
33+
- name: Run tests
34+
run: |
35+
source $HOME/.poetry/env
36+
poetry run pytest
37+
38+
- name: Build wheels
39+
run: |
40+
source $HOME/.poetry/env
41+
poetry build
42+
43+
build-docs:
44+
runs-on: ubuntu-latest
45+
strategy:
46+
matrix:
47+
python-version: [3.8]
48+
49+
steps:
50+
- uses: actions/checkout@v2
51+
- name: Set up Python ${{ matrix.python-version }}
52+
uses: actions/setup-python@v2
53+
with:
54+
python-version: ${{ matrix.python-version }}
55+
56+
- name: Cache pip
57+
uses: actions/cache@v2
58+
with:
59+
path: ~/.cache/pip
60+
key: ${{ runner.os }}-pip-${{ hashFiles('docs/source/requirements.txt') }}-${ GITHUB_REF }
61+
restore-keys: |
62+
${{ runner.os }}-pip-
63+
${{ runner.os }}-
64+
65+
- name: Install dependencies
66+
run: |
67+
python -m pip install --upgrade pip
68+
pip install -r docs/source/requirements.txt
69+
70+
- name: Build html
71+
run: |
72+
(cd docs && make html)

README.rst

+6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ sampling, and finally converting to a ``torch.utils.data.DataLoader``.
3131
Install
3232
=======
3333

34+
.. code-block::
35+
36+
poetry add pytorch-datastream
37+
38+
Or, for the old-timers:
39+
3440
.. code-block::
3541
3642
pip install pytorch-datastream

dev_requirements.txt

-3
This file was deleted.

docs/source/requirements.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ mccabe==0.6.1
2525
more-itertools==8.3.0
2626
numpy==1.18.5
2727
packaging==20.4
28-
pandas==1.0.4
28+
pandas==1.1.5
2929
pkginfo==1.5.0.1
3030
pluggy==0.13.1
3131
py==1.10.0
@@ -34,14 +34,14 @@ pydantic==1.8.2
3434
Pygments==2.7.4
3535
pylint==2.5.3
3636
pyparsing==2.4.7
37-
pyspark==2.4.1
37+
pyspark==3.0.3
3838
pytest==5.4.3
3939
python-dateutil==2.8.1
4040
pytz==2020.1
4141
PyYAML==5.4
4242
readme-renderer==26.0
4343
recommonmark==0.6.0
44-
requests==2.23.0
44+
requests==2.26.0
4545
requests-toolbelt==0.9.1
4646
SecretStorage==3.1.2
4747
six==1.15.0

patch-python3.6.sh

-17
This file was deleted.

0 commit comments

Comments
 (0)