Skip to content

Commit d640de0

Browse files
authored
chore: migrate to hatch (#26)
1 parent e14fe35 commit d640de0

22 files changed

+306
-1324
lines changed

.github/workflows/checks.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Checks
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
typing:
11+
runs-on: "ubuntu-latest"
12+
13+
name: Type checking
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- uses: actions/setup-python@v4
18+
with:
19+
python-version: "3.10"
20+
21+
- run: |
22+
pip install hatch
23+
hatch -e checks run typing
24+
25+
linting:
26+
runs-on: "ubuntu-latest"
27+
28+
name: Linting
29+
steps:
30+
- uses: actions/checkout@v2
31+
32+
- uses: actions/setup-python@v4
33+
with:
34+
python-version: "3.10"
35+
36+
- run: |
37+
pip install hatch
38+
hatch -e checks run linting

.github/workflows/release.yml

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
name: Release
2+
23
on:
34
release:
45
types: [published]
6+
57
jobs:
68
release:
79
runs-on: ubuntu-latest
810
steps:
9-
- uses: actions/checkout@v2
10-
- uses: actions/setup-python@v2
11-
with:
12-
python-version: '3.x'
13-
architecture: x64
11+
- uses: actions/checkout@v2
12+
13+
- uses: actions/setup-python@v4
14+
with:
15+
python-version: '3.10'
1416

15-
- run: |
16-
pip install poetry poetry-dynamic-versioning
17-
poetry build
18-
poetry publish --username=__token__ --password=${{ secrets.PYPI_TOKEN }}
17+
- run: |
18+
pip install hatch hatch-vcs
19+
hatch build
20+
hatch publish --user=__token__ --auth=${{ secrets.PYPI_TOKEN }}

.github/workflows/tests.yml

+102-38
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,32 @@
11
name: Tests
2-
on: push
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
concurrency:
10+
group: ${{ github.head_ref || github.run_id }}
11+
cancel-in-progress: true
12+
313
jobs:
4-
tests:
5-
runs-on: ${{ matrix.os }}
14+
tests-linux:
15+
runs-on: ubuntu-latest
616
strategy:
717
fail-fast: false
818
matrix:
9-
os: [macos-latest, ubuntu-latest, windows-latest]
10-
python-version: ["3.7", "3.8", "3.9", "3.10"]
11-
name: Tests on ${{ matrix.os }} with Python ${{ matrix.python-version }}
19+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
20+
21+
name: Tests with Python ${{ matrix.python-version }} on Linux
1222
steps:
1323
- uses: actions/checkout@v2
1424
with:
1525
path: main
1626

17-
- uses: actions/setup-python@v2
27+
- uses: actions/setup-python@v4
1828
with:
19-
python-version: ${{ matrix.python-version }}
20-
architecture: x64
29+
python-version: ${{ matrix.python-version }}-dev
2130

2231
- name: Checkout Austin development branch
2332
uses: actions/checkout@master
@@ -26,51 +35,106 @@ jobs:
2635
ref: devel
2736
path: austin
2837

29-
- name: Compile Austin on Linux
38+
- name: Compile Austin
3039
run: |
3140
cd $GITHUB_WORKSPACE/austin
3241
gcc -Wall -O3 -Os -s -pthread src/*.c -o src/austin
33-
if: startsWith(matrix.os, 'ubuntu')
3442
35-
- name: Compile Austin on Windows
43+
- name: Install dependencies
3644
run: |
37-
cd $env:GITHUB_WORKSPACE/austin
38-
gcc.exe -O3 -o src/austin.exe src/*.c -lpsapi -lntdll -Wall -Os -s
39-
if: startsWith(matrix.os, 'windows')
45+
sudo apt-get update -y
46+
sudo apt-get install -y binutils binutils-common
47+
addr2line -V
48+
49+
- name: Run tests
50+
run: |
51+
cd $GITHUB_WORKSPACE/main
52+
export PATH="$GITHUB_WORKSPACE/austin/src:$PATH"
53+
pip install hatch
54+
hatch -e "tests.py${{ matrix.python-version }}" run tests
55+
56+
- name: Publish coverage metrics
57+
run: |
58+
cd $GITHUB_WORKSPACE/main
59+
hatch -e coverage run cov
60+
hatch -e coverage run codecov
61+
if: matrix.python-version == '3.10'
62+
env:
63+
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
64+
65+
tests-macos:
66+
runs-on: macos-latest
67+
strategy:
68+
fail-fast: false
69+
matrix:
70+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
71+
72+
name: Tests with Python ${{ matrix.python-version }} on MacOS
73+
steps:
74+
- uses: actions/checkout@v2
75+
with:
76+
path: main
77+
78+
- uses: actions/setup-python@v4
79+
with:
80+
python-version: ${{ matrix.python-version }}-dev
81+
82+
- name: Checkout Austin development branch
83+
uses: actions/checkout@master
84+
with:
85+
repository: P403n1x87/austin
86+
ref: devel
87+
path: austin
4088

41-
- name: Compile Austin on macOS
89+
- name: Compile Austin
4290
run: |
4391
cd $GITHUB_WORKSPACE/austin
4492
gcc -Wall -O3 -Os src/*.c -o src/austin
45-
if: startsWith(matrix.os, 'macos')
4693
47-
- run: pip install nox poetry
94+
- name: Remove signature from the Python binary
95+
run: |
96+
codesign --remove-signature /Library/Frameworks/Python.framework/Versions/${{ matrix.python-version }}/bin/python3 || true
97+
codesign --remove-signature /Library/Frameworks/Python.framework/Versions/${{ matrix.python-version }}/Resources/Python.app/Contents/MacOS/Python || true
4898
49-
- name: Run nox on Linux
99+
- name: Run tests
50100
run: |
51101
cd $GITHUB_WORKSPACE/main
52102
export PATH="$GITHUB_WORKSPACE/austin/src:$PATH"
53-
nox
54-
if: "startsWith(matrix.os, 'ubuntu')"
103+
pip install hatch
104+
sudo hatch -e "tests.py${{ matrix.python-version }}" run tests
105+
106+
tests-win:
107+
runs-on: windows-latest
108+
strategy:
109+
fail-fast: false
110+
matrix:
111+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
112+
113+
name: Tests with Python ${{ matrix.python-version }} on Windows
114+
steps:
115+
- uses: actions/checkout@v2
116+
with:
117+
path: main
55118

56-
- name: Run nox on macOS
119+
- uses: actions/setup-python@v4
120+
with:
121+
python-version: ${{ matrix.python-version }}-dev
122+
123+
- name: Checkout Austin development branch
124+
uses: actions/checkout@master
125+
with:
126+
repository: P403n1x87/austin
127+
ref: devel
128+
path: austin
129+
130+
- name: Compile Austin on Windows
57131
run: |
58-
cd $GITHUB_WORKSPACE/main
59-
export PATH="$GITHUB_WORKSPACE/austin/src:$PATH"
60-
sudo nox
61-
if: startsWith(matrix.os, 'macos')
132+
cd $env:GITHUB_WORKSPACE/austin
133+
gcc.exe -O3 -o src/austin.exe src/*.c -lpsapi -lntdll -Wall -Os -s
62134
63-
- name: Run nox on Windows
135+
- name: Run tests on Windows
64136
run: |
65137
cd $env:GITHUB_WORKSPACE/main
66-
$env:PATH="$env:GITHUB_WORKSPACE/austin/src;$env:PATH"
67-
nox
68-
if: "startsWith(matrix.os, 'windows')"
69-
70-
# - name: Publish coverage metrics
71-
# run: |
72-
# cd $GITHUB_WORKSPACE/main
73-
# nox -rs coverage
74-
# if: startsWith(matrix.os, 'ubuntu')
75-
# env:
76-
# CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
138+
$env:PATH="$env:GITHUB_WORKSPACE\austin\src;$env:PATH"
139+
pip install hatch
140+
hatch -e "tests.py${{ matrix.python-version }}" run tests

austin_tui/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
# You should have received a copy of the GNU General Public License
2121
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2222

23-
from enum import Enum
2423
import os
2524
import sys
25+
from enum import Enum
2626
from traceback import format_exception
2727

2828

austin_tui/__main__.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
import asyncio
2424
import sys
2525
from textwrap import wrap
26-
from typing import Any, List, Optional
26+
from typing import Any
27+
from typing import List
28+
from typing import Optional
2729

2830
from austin import AustinError
2931
from austin.aio import AsyncAustin

austin_tui/adapters.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
# You should have received a copy of the GNU General Public License
2121
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2222

23-
from typing import Any, Optional, Union
23+
from typing import Any
24+
from typing import Optional
25+
from typing import Union
2426

2527
from austin.stats import ThreadStats
2628

austin_tui/model/austin.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222

2323
from copy import deepcopy
2424
from time import time
25-
from typing import Any, Dict, List, Optional, Tuple
25+
from typing import Any
26+
from typing import Dict
27+
from typing import List
28+
from typing import Optional
29+
from typing import Tuple
2630

2731
from austin.stats import AustinStats
2832
from austin.stats import AustinStatsType

austin_tui/model/system.py

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from psutil import NoSuchProcess
2626
from psutil import Process
2727

28+
2829
Seconds = float
2930
Percentage = float
3031
Bytes = int

austin_tui/view/__init__.py

+16-7
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,38 @@
2020
# You should have received a copy of the GNU General Public License
2121
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2222

23-
from abc import ABC
2423
import asyncio
25-
from asyncio.coroutines import iscoroutine
26-
from collections import defaultdict
2724
import curses
2825
import sys
29-
from typing import Any, Callable, Coroutine, Dict, List, Optional, TextIO, Type, Union
26+
from abc import ABC
27+
from asyncio.coroutines import iscoroutine
28+
from collections import defaultdict
29+
from typing import Any
30+
from typing import Callable
31+
from typing import Coroutine
32+
from typing import Dict
33+
from typing import List
34+
from typing import Optional
35+
from typing import TextIO
36+
from typing import Type
37+
from typing import Union
3038

3139
from importlib_resources import files
32-
from lxml.etree import _Comment as Comment
3340
from lxml.etree import Element
41+
from lxml.etree import QName
42+
from lxml.etree import _Comment as Comment
3443
from lxml.etree import fromstring as parse_xml_string
3544
from lxml.etree import parse as parse_xml_stream
36-
from lxml.etree import QName
3745

46+
import austin_tui.widgets.catalog as catalog
3847
from austin_tui.view.palette import Palette
3948
from austin_tui.widgets import Container
4049
from austin_tui.widgets import Rect
4150
from austin_tui.widgets import Widget
42-
import austin_tui.widgets.catalog as catalog
4351
from austin_tui.widgets.markup import AttrString
4452
from austin_tui.widgets.markup import markup
4553

54+
4655
EventHandler = Callable[[Optional[Any]], bool]
4756

4857

austin_tui/view/austin.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,17 @@
2222

2323
import asyncio
2424
from enum import Enum
25-
from typing import Any, Callable, Optional
25+
from typing import Any
26+
from typing import Callable
27+
from typing import Optional
2628

2729
from austin_tui import AustinProfileMode
2830
from austin_tui.adapters import fmt_time as _fmt_time
2931
from austin_tui.view import View
3032
from austin_tui.widgets.markup import AttrString
3133
from austin_tui.widgets.markup import AttrStringChunk
3234

35+
3336
# ---- AustinView -------------------------------------------------------------
3437

3538

austin_tui/view/palette.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222

2323

2424
import curses
25-
from typing import Dict, Tuple
25+
from typing import Dict
26+
from typing import Tuple
2627

2728

2829
class PaletteError(Exception):

austin_tui/widgets/__init__.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@
2121
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2222

2323
import curses
24-
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
24+
from typing import Any
25+
from typing import Callable
26+
from typing import Dict
27+
from typing import List
28+
from typing import Optional
29+
from typing import Tuple
30+
from typing import Union
2531

2632

2733
class Point(complex):

0 commit comments

Comments
 (0)