Skip to content

Commit

Permalink
chore: migrate to hatch (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
P403n1x87 committed Dec 3, 2022
1 parent e14fe35 commit d640de0
Show file tree
Hide file tree
Showing 22 changed files with 306 additions and 1,324 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Checks

on:
push:
branches:
- main
pull_request:

jobs:
typing:
runs-on: "ubuntu-latest"

name: Type checking
steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v4
with:
python-version: "3.10"

- run: |
pip install hatch
hatch -e checks run typing
linting:
runs-on: "ubuntu-latest"

name: Linting
steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v4
with:
python-version: "3.10"

- run: |
pip install hatch
hatch -e checks run linting
20 changes: 11 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
name: Release

on:
release:
types: [published]

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'
architecture: x64
- uses: actions/checkout@v2

- uses: actions/setup-python@v4
with:
python-version: '3.10'

- run: |
pip install poetry poetry-dynamic-versioning
poetry build
poetry publish --username=__token__ --password=${{ secrets.PYPI_TOKEN }}
- run: |
pip install hatch hatch-vcs
hatch build
hatch publish --user=__token__ --auth=${{ secrets.PYPI_TOKEN }}
140 changes: 102 additions & 38 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
name: Tests
on: push

on:
push:
branches:
- main
pull_request:

concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
tests:
runs-on: ${{ matrix.os }}
tests-linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10"]
name: Tests on ${{ matrix.os }} with Python ${{ matrix.python-version }}
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]

name: Tests with Python ${{ matrix.python-version }} on Linux
steps:
- uses: actions/checkout@v2
with:
path: main

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
python-version: ${{ matrix.python-version }}-dev

- name: Checkout Austin development branch
uses: actions/checkout@master
Expand All @@ -26,51 +35,106 @@ jobs:
ref: devel
path: austin

- name: Compile Austin on Linux
- name: Compile Austin
run: |
cd $GITHUB_WORKSPACE/austin
gcc -Wall -O3 -Os -s -pthread src/*.c -o src/austin
if: startsWith(matrix.os, 'ubuntu')
- name: Compile Austin on Windows
- name: Install dependencies
run: |
cd $env:GITHUB_WORKSPACE/austin
gcc.exe -O3 -o src/austin.exe src/*.c -lpsapi -lntdll -Wall -Os -s
if: startsWith(matrix.os, 'windows')
sudo apt-get update -y
sudo apt-get install -y binutils binutils-common
addr2line -V
- name: Run tests
run: |
cd $GITHUB_WORKSPACE/main
export PATH="$GITHUB_WORKSPACE/austin/src:$PATH"
pip install hatch
hatch -e "tests.py${{ matrix.python-version }}" run tests
- name: Publish coverage metrics
run: |
cd $GITHUB_WORKSPACE/main
hatch -e coverage run cov
hatch -e coverage run codecov
if: matrix.python-version == '3.10'
env:
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}

tests-macos:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]

name: Tests with Python ${{ matrix.python-version }} on MacOS
steps:
- uses: actions/checkout@v2
with:
path: main

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}-dev

- name: Checkout Austin development branch
uses: actions/checkout@master
with:
repository: P403n1x87/austin
ref: devel
path: austin

- name: Compile Austin on macOS
- name: Compile Austin
run: |
cd $GITHUB_WORKSPACE/austin
gcc -Wall -O3 -Os src/*.c -o src/austin
if: startsWith(matrix.os, 'macos')
- run: pip install nox poetry
- name: Remove signature from the Python binary
run: |
codesign --remove-signature /Library/Frameworks/Python.framework/Versions/${{ matrix.python-version }}/bin/python3 || true
codesign --remove-signature /Library/Frameworks/Python.framework/Versions/${{ matrix.python-version }}/Resources/Python.app/Contents/MacOS/Python || true
- name: Run nox on Linux
- name: Run tests
run: |
cd $GITHUB_WORKSPACE/main
export PATH="$GITHUB_WORKSPACE/austin/src:$PATH"
nox
if: "startsWith(matrix.os, 'ubuntu')"
pip install hatch
sudo hatch -e "tests.py${{ matrix.python-version }}" run tests
tests-win:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]

name: Tests with Python ${{ matrix.python-version }} on Windows
steps:
- uses: actions/checkout@v2
with:
path: main

- name: Run nox on macOS
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}-dev

- name: Checkout Austin development branch
uses: actions/checkout@master
with:
repository: P403n1x87/austin
ref: devel
path: austin

- name: Compile Austin on Windows
run: |
cd $GITHUB_WORKSPACE/main
export PATH="$GITHUB_WORKSPACE/austin/src:$PATH"
sudo nox
if: startsWith(matrix.os, 'macos')
cd $env:GITHUB_WORKSPACE/austin
gcc.exe -O3 -o src/austin.exe src/*.c -lpsapi -lntdll -Wall -Os -s
- name: Run nox on Windows
- name: Run tests on Windows
run: |
cd $env:GITHUB_WORKSPACE/main
$env:PATH="$env:GITHUB_WORKSPACE/austin/src;$env:PATH"
nox
if: "startsWith(matrix.os, 'windows')"

# - name: Publish coverage metrics
# run: |
# cd $GITHUB_WORKSPACE/main
# nox -rs coverage
# if: startsWith(matrix.os, 'ubuntu')
# env:
# CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
$env:PATH="$env:GITHUB_WORKSPACE\austin\src;$env:PATH"
pip install hatch
hatch -e "tests.py${{ matrix.python-version }}" run tests
2 changes: 1 addition & 1 deletion austin_tui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from enum import Enum
import os
import sys
from enum import Enum
from traceback import format_exception


Expand Down
4 changes: 3 additions & 1 deletion austin_tui/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
import asyncio
import sys
from textwrap import wrap
from typing import Any, List, Optional
from typing import Any
from typing import List
from typing import Optional

from austin import AustinError
from austin.aio import AsyncAustin
Expand Down
4 changes: 3 additions & 1 deletion austin_tui/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from typing import Any, Optional, Union
from typing import Any
from typing import Optional
from typing import Union

from austin.stats import ThreadStats

Expand Down
6 changes: 5 additions & 1 deletion austin_tui/model/austin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@

from copy import deepcopy
from time import time
from typing import Any, Dict, List, Optional, Tuple
from typing import Any
from typing import Dict
from typing import List
from typing import Optional
from typing import Tuple

from austin.stats import AustinStats
from austin.stats import AustinStatsType
Expand Down
1 change: 1 addition & 0 deletions austin_tui/model/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from psutil import NoSuchProcess
from psutil import Process


Seconds = float
Percentage = float
Bytes = int
Expand Down
23 changes: 16 additions & 7 deletions austin_tui/view/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,38 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from abc import ABC
import asyncio
from asyncio.coroutines import iscoroutine
from collections import defaultdict
import curses
import sys
from typing import Any, Callable, Coroutine, Dict, List, Optional, TextIO, Type, Union
from abc import ABC
from asyncio.coroutines import iscoroutine
from collections import defaultdict
from typing import Any
from typing import Callable
from typing import Coroutine
from typing import Dict
from typing import List
from typing import Optional
from typing import TextIO
from typing import Type
from typing import Union

from importlib_resources import files
from lxml.etree import _Comment as Comment
from lxml.etree import Element
from lxml.etree import QName
from lxml.etree import _Comment as Comment
from lxml.etree import fromstring as parse_xml_string
from lxml.etree import parse as parse_xml_stream
from lxml.etree import QName

import austin_tui.widgets.catalog as catalog
from austin_tui.view.palette import Palette
from austin_tui.widgets import Container
from austin_tui.widgets import Rect
from austin_tui.widgets import Widget
import austin_tui.widgets.catalog as catalog
from austin_tui.widgets.markup import AttrString
from austin_tui.widgets.markup import markup


EventHandler = Callable[[Optional[Any]], bool]


Expand Down
5 changes: 4 additions & 1 deletion austin_tui/view/austin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@

import asyncio
from enum import Enum
from typing import Any, Callable, Optional
from typing import Any
from typing import Callable
from typing import Optional

from austin_tui import AustinProfileMode
from austin_tui.adapters import fmt_time as _fmt_time
from austin_tui.view import View
from austin_tui.widgets.markup import AttrString
from austin_tui.widgets.markup import AttrStringChunk


# ---- AustinView -------------------------------------------------------------


Expand Down
3 changes: 2 additions & 1 deletion austin_tui/view/palette.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@


import curses
from typing import Dict, Tuple
from typing import Dict
from typing import Tuple


class PaletteError(Exception):
Expand Down
8 changes: 7 additions & 1 deletion austin_tui/widgets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import curses
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from typing import Any
from typing import Callable
from typing import Dict
from typing import List
from typing import Optional
from typing import Tuple
from typing import Union


class Point(complex):
Expand Down
Loading

0 comments on commit d640de0

Please sign in to comment.