Skip to content

Commit 372dcd7

Browse files
committed
build: fix poetry
1 parent de63e9b commit 372dcd7

File tree

4 files changed

+72
-82
lines changed

4 files changed

+72
-82
lines changed

.github/workflows/publish.yml

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,28 @@ jobs:
88
publish:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v2
12-
- name: Set up Python
13-
uses: actions/setup-python@v2
14-
with:
15-
python-version: '3.8'
16-
- name: Install dependencies
17-
run: |
18-
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
19-
source $HOME/.poetry/env
20-
poetry install
11+
- uses: actions/checkout@v2
12+
- name: Set up Python
13+
uses: actions/setup-python@v2
14+
with:
15+
python-version: "3.8"
16+
- name: Install dependencies
17+
run: |
18+
curl -sSL https://install.python-poetry.org | python - --version 1.2.1
19+
$HOME/.local/bin/poetry install
2120
22-
- name: Run tests
23-
run: |
24-
source $HOME/.poetry/env
25-
poetry run pytest
21+
- name: Run tests
22+
run: |
23+
$HOME/.local/bin/poetry run pytest
2624
27-
- name: Build wheels
28-
run: |
29-
source $HOME/.poetry/env
30-
poetry version $(git tag --points-at HEAD)
31-
poetry build
25+
- name: Build wheels
26+
run: |
27+
$HOME/.local/bin/poetry version $(git tag --points-at HEAD)
28+
$HOME/.local/bin/poetry build
3229
33-
- name: Upload
34-
env:
35-
USERNAME: __token__
36-
PASSWORD: ${{ secrets.PYPI_TOKEN }}
37-
run: |
38-
source $HOME/.poetry/env
39-
poetry publish --username=$USERNAME --password=$PASSWORD
30+
- name: Upload
31+
env:
32+
USERNAME: __token__
33+
PASSWORD: ${{ secrets.PYPI_TOKEN }}
34+
run: |
35+
$HOME/.local/bin/poetry publish --username=$USERNAME --password=$PASSWORD

.github/workflows/test.yml

Lines changed: 46 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -4,77 +4,71 @@ on: [push]
44

55
jobs:
66
test:
7-
87
runs-on: ubuntu-latest
98
strategy:
109
matrix:
1110
python-version: [3.7, 3.8]
1211

1312
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 }}
13+
- uses: actions/checkout@v2
14+
- name: Set up Python ${{ matrix.python-version }}
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: ${{ matrix.python-version }}
1918

20-
- name: Cache pip
21-
uses: actions/cache@v2
22-
with:
23-
path: ~/.cache/pip
24-
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}-${ GITHUB_REF }
25-
restore-keys: |
26-
${{ runner.os }}-pip-
27-
${{ runner.os }}-
19+
- name: Cache pip
20+
uses: actions/cache@v2
21+
with:
22+
path: ~/.cache/pip
23+
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}-${ GITHUB_REF }
24+
restore-keys: |
25+
${{ runner.os }}-pip-
26+
${{ runner.os }}-
2827
29-
- name: Install dependencies
30-
run: |
31-
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
32-
source $HOME/.poetry/env
33-
poetry install
28+
- name: Install dependencies
29+
run: |
30+
curl -sSL https://install.python-poetry.org | python - --version 1.2.1
31+
$HOME/.local/bin/poetry install --no-root
3432
35-
- name: Lint
36-
run: |
37-
source $HOME/.poetry/env
38-
poetry run black --check lantern
33+
- name: Lint
34+
run: |
35+
$HOME/.local/bin/poetry run black --check lantern
3936
40-
- name: Run tests
41-
run: |
42-
source $HOME/.poetry/env
43-
poetry run pytest
37+
- name: Run tests
38+
run: |
39+
$HOME/.local/bin/poetry run pytest
4440
45-
- name: Build wheels
46-
run: |
47-
source $HOME/.poetry/env
48-
poetry build
41+
- name: Build wheels
42+
run: |
43+
$HOME/.local/bin/poetry build
4944
5045
build-docs:
51-
5246
runs-on: ubuntu-latest
5347
strategy:
5448
matrix:
5549
python-version: [3.8]
5650

5751
steps:
58-
- uses: actions/checkout@v2
59-
- name: Set up Python ${{ matrix.python-version }}
60-
uses: actions/setup-python@v2
61-
with:
62-
python-version: ${{ matrix.python-version }}
52+
- uses: actions/checkout@v2
53+
- name: Set up Python ${{ matrix.python-version }}
54+
uses: actions/setup-python@v2
55+
with:
56+
python-version: ${{ matrix.python-version }}
6357

64-
- name: Cache pip
65-
uses: actions/cache@v2
66-
with:
67-
path: ~/.cache/pip
68-
key: ${{ runner.os }}-pip-${{ hashFiles('docs/source/requirements.txt') }}-${ GITHUB_REF }
69-
restore-keys: |
70-
${{ runner.os }}-pip-
71-
${{ runner.os }}-
58+
- name: Cache pip
59+
uses: actions/cache@v2
60+
with:
61+
path: ~/.cache/pip
62+
key: ${{ runner.os }}-pip-${{ hashFiles('docs/source/requirements.txt') }}-${ GITHUB_REF }
63+
restore-keys: |
64+
${{ runner.os }}-pip-
65+
${{ runner.os }}-
7266
73-
- name: Install dependencies
74-
run: |
75-
python -m pip install --upgrade pip
76-
pip install -r docs/source/requirements.txt
67+
- name: Install dependencies
68+
run: |
69+
python -m pip install --upgrade pip
70+
pip install -r docs/source/requirements.txt
7771
78-
- name: Build html
79-
run: |
80-
(cd docs && make html)
72+
- name: Build html
73+
run: |
74+
(cd docs && make html)

lantern/metric.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def test_map_after_aggregate():
206206
assert (
207207
Metric([2, 3, 4])
208208
.aggregate(lambda xs: np.mean(xs))
209-
.map(lambda x: x ** 2)
209+
.map(lambda x: x**2)
210210
.compute()
211211
== 9
212212
)
@@ -216,9 +216,9 @@ def test_update_last():
216216
assert (
217217
Metric()
218218
.aggregate(lambda xs: np.mean(xs))
219-
.map(lambda x: x ** 2)
219+
.map(lambda x: x**2)
220220
.update(2)
221221
.update(3)
222222
.compute()
223-
== 2.5 ** 2
223+
== 2.5**2
224224
)

lantern/worker_init_fn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
def worker_init_fn(seed):
55
def worker_init(worker_id):
6-
set_seeds(seed * 2 ** 16 + worker_id * 2 ** 24)
6+
set_seeds(seed * 2**16 + worker_id * 2**24)
77

88
return worker_init

0 commit comments

Comments
 (0)