Skip to content

Commit

Permalink
Merge pull request #978 from hbldh/poetry
Browse files Browse the repository at this point in the history
use poetry for build and deps
  • Loading branch information
dlech authored Sep 5, 2022
2 parents 11d2c7b + ab2b9ef commit 18b29a5
Show file tree
Hide file tree
Showing 20 changed files with 1,083 additions and 252 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,11 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip. setuptools and wheel
run: python -m pip install --upgrade pip setuptools wheel
- name: Install dependencies
run: pip install -r requirements.txt
- name: Install development dependencies
run: pip install -r requirements_dev.txt
run: pipx run poetry install --only main,test
- name: Test with pytest
run: |
pytest tests --junitxml=junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}.xml --cov=com --cov-report=xml --cov-report=html
pipx run poetry run pytest tests --junitxml=junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}.xml --cov=com --cov-report=xml --cov-report=html
- name: Upload pytest test results
uses: actions/upload-artifact@v1
with:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/build_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Upgrade pip. setuptools and wheel
run: python -m pip install --upgrade pip setuptools wheel
- name: Install dependencies
run: pip install buildozer cython
- name: Cache buildozer files
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/format_and_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,15 @@ jobs:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
- name: Upgrade pip. setuptools and wheel
run: python -m pip install --upgrade pip setuptools wheel
- name: Install development dependencies
run: pip install -r requirements_dev.txt
run: pipx run poetry install --only docs,lint
- name: Check code formatting with black
run: black . --check --diff
run: pipx run poetry run black . --check --diff
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
pipx run poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. Default line length of black is 88
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics
pipx run poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics
- name: Build docs
run: READTHEDOCS=True make -C docs html
run: READTHEDOCS=True pipx run poetry run make -C docs html
16 changes: 4 additions & 12 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
- name: Build
run: pipx run poetry build
- name: Publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
run: pipx run twine upload dist/*
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Changed
* ``BleakClient`` methods now raise ``BleakError`` if called when not connected in WinRT backend.
* Extended disconnect timeout to 120 seconds in WinRT backend. Fixes #807.
* Changed version check for BlueZ battery workaround to exclude versions >= 5.55. Merged #976.
* Use Poetry for build system and dependencies.

Fixed
-----
Expand Down
12 changes: 0 additions & 12 deletions MANIFEST.in

This file was deleted.

31 changes: 0 additions & 31 deletions Pipfile

This file was deleted.

7 changes: 6 additions & 1 deletion bleak/backends/bluezdbus/defs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# -*- coding: utf-8 -*-

import sys
from typing import Dict, List, Tuple
from typing_extensions import Literal, TypedDict

if sys.version_info[:2] < (3, 8):
from typing_extensions import Literal, TypedDict
else:
from typing import Literal, TypedDict

# DBus Interfaces
OBJECT_MANAGER_INTERFACE = "org.freedesktop.DBus.ObjectManager"
Expand Down
7 changes: 6 additions & 1 deletion bleak/backends/bluezdbus/scanner.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import logging
import sys
from typing import Callable, Coroutine, Dict, List, Optional
from warnings import warn

from dbus_next import Variant
from typing_extensions import TypedDict, Literal

if sys.version_info[:2] < (3, 8):
from typing_extensions import Literal, TypedDict
else:
from typing import Literal, TypedDict

from ...exc import BleakError
from ..device import BLEDevice
Expand Down
7 changes: 6 additions & 1 deletion bleak/backends/corebluetooth/scanner.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import logging
import sys
from typing import Any, Dict, List, Optional

import objc
from Foundation import NSArray, NSUUID, NSBundle
from CoreBluetooth import CBPeripheral
from typing_extensions import Literal

if sys.version_info[:2] < (3, 8):
from typing_extensions import Literal
else:
from typing import Literal

from bleak.backends.corebluetooth.CentralManagerDelegate import CentralManagerDelegate
from bleak.backends.corebluetooth.utils import cb_uuid_to_str
Expand Down
7 changes: 6 additions & 1 deletion bleak/backends/p4android/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

import asyncio
import logging
import sys
from typing import List, Optional
import warnings

import async_timeout
from typing_extensions import Literal

if sys.version_info[:2] < (3, 8):
from typing_extensions import Literal
else:
from typing import Literal

from bleak.backends.scanner import (
AdvertisementDataCallback,
Expand Down
7 changes: 6 additions & 1 deletion bleak/backends/winrt/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@
import inspect
import logging
import asyncio
from typing_extensions import Literal, TypedDict
import uuid
import warnings
from functools import wraps
import sys
from typing import Callable, Any, List, Optional, Sequence, Union

import async_timeout

if sys.version_info[:2] < (3, 8):
from typing_extensions import Literal, TypedDict
else:
from typing import Literal, TypedDict

from bleak_winrt.windows.devices.bluetooth import (
BluetoothError,
BluetoothLEDevice,
Expand Down
7 changes: 6 additions & 1 deletion bleak/backends/winrt/scanner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
import logging
import sys
from typing import Dict, List, NamedTuple, Optional
from uuid import UUID

Expand All @@ -9,7 +10,11 @@
BluetoothLEAdvertisementReceivedEventArgs,
BluetoothLEAdvertisementType,
)
from typing_extensions import Literal

if sys.version_info[:2] < (3, 8):
from typing_extensions import Literal
else:
from typing import Literal

from ..device import BLEDevice
from ..scanner import AdvertisementDataCallback, BaseBleakScanner, AdvertisementData
Expand Down
32 changes: 13 additions & 19 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,6 @@
# All configuration values have a default; values that are commented out
# serve to show the default.


windows_autodoc_mock_import = ["bleak_winrt"]
linux_autodoc_mock_import = ["dbus_next"]
macos_autodoc_mock_import = [
"objc",
"Foundation",
"CoreBluetooth",
"libdispatch",
]
android_autodoc_mock_import = ["android", "jnius"]
autodoc_mock_imports = list(
set(
windows_autodoc_mock_import
+ macos_autodoc_mock_import
+ linux_autodoc_mock_import
+ android_autodoc_mock_import
)
)

import sys
import os

Expand Down Expand Up @@ -124,6 +105,19 @@
# documents.
# keep_warnings = False

# -- Options for autodoc extension -------------------------------------------

autodoc_mock_imports = [
"android",
"async_timeout",
"bleak_winrt",
"CoreBluetooth",
"dbus_next",
"Foundation",
"jnius",
"libdispatch",
"objc",
]

# -- Options for HTML output -------------------------------------------

Expand Down
Loading

0 comments on commit 18b29a5

Please sign in to comment.