Skip to content

Commit

Permalink
Merge pull request #30 from mhvis/modernize
Browse files Browse the repository at this point in the history
Update project structure
  • Loading branch information
mhvis authored Jan 9, 2025
2 parents 68b1c70 + dfa56d6 commit f0793b8
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 38 deletions.
28 changes: 21 additions & 7 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,35 @@ on:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
python-version: [ 3.5, 3.6, 3.7, 3.8 ]
os:
- 'ubuntu-24.04'
- 'windows-2022'
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.13'
exclude:
- os: 'windows-2022'
python-version: '3.8'
- os: 'windows-2022'
python-version: '3.9'

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r dev-requirements.txt
- name: Lint with flake8
run: |
Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,17 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
python-version: '3.13'
- name: Install build dependencies
run: pip install build twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
python -m build
twine upload dist/*
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,15 +328,12 @@ Options:

## Development info

Development installation (usually in a virtual environment):
```commandline
pip install -e .
pip install -r dev-requirements.txt
```
Lint code: `flake8`

Run testcases: `python -m unittest`
These commands are usually run in a virtual environment.

* Development installation: `pip install --editable .`
* Development requirements: `pip install -r dev-requirements.txt`
* Lint code: `flake8`
* Run testcases: `python -m unittest`

## License

Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[build-system]
# XXX: If your project needs other packages to build properly, add them to this list.
requires = ["setuptools >= 64"]
build-backend = "setuptools.build_meta"
3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

4 changes: 2 additions & 2 deletions samil/inverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from collections import OrderedDict
from threading import Event, Thread
from time import sleep
from typing import Tuple, Dict, BinaryIO, Any, Optional
from typing import Tuple, Dict, BinaryIO, Any

from samil.statustypes import status_types

Expand Down Expand Up @@ -183,7 +183,7 @@ class InverterFinder:
You need to call open() and close() or use the class in a with statement.
"""

listen_sock = None # type: Optional[socket.socket]
listen_sock = None

def __init__(self, interface_ip=''):
"""Create instance.
Expand Down
14 changes: 5 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name="samil",
version="2.2.3",
version="2.3",
author="Maarten Visscher",
author_email="[email protected]",
description="Samil Power inverter tool",
Expand All @@ -19,19 +19,15 @@
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
# * 3.4 is required for paho-mqtt:tls_set()
# * 3.5 is required for socket.socketpair() in Windows, only used for test cases
# * 3.5 is required for socket.listen() optional backlog parameter
# * CI only tests >=3.5
python_requires='>=3.5',
python_requires='>=3.8',
entry_points={
"console_scripts": [
"samil = samil.cli:cli"
]
},
install_requires=[
"paho-mqtt>=1.5.0",
"click>=7.1.2",
"influxdb-client>=1.32.0",
"paho-mqtt>=1.5.0,<2",
"click>=7.1.2,<9",
"influxdb-client>=1.32.0,<2",
]
)

0 comments on commit f0793b8

Please sign in to comment.