Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,26 @@ name: PyPI Publish
on:
release:
types: [created]
workflow_dispatch:
inputs:
test_release:
description: If true, publish to test.pypi.org
required: true
default: true
type: boolean

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Install uv & Python
uses: astral-sh/setup-uv@v6
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- run: poetry publish --build
enable-cache: true
cache-dependency-glob: "uv.lock"
- run: uv build
- run: uv publish
env:
POETRY_PYPI_TOKEN_PYPI: ${{secrets.POETRY_PYPI_TOKEN_PYPI}}
UV_PUBLISH_TOKEN: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.test_release && secrets.TEST_PYPI_API_TOKEN || secrets.POETRY_PYPI_TOKEN_PYPI }}
UV_PUBLISH_URL: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.test_release && 'https://test.pypi.org/legacy/' || 'https://upload.pypi.org/legacy/' }}
26 changes: 8 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Check

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Install uv & Python
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Ruff format
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Black source code formating check
uv run ruff format --diff --exit-non-zero-on-format
- name: Ruff check
run: |
poetry run black --check .
uv run ruff check
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
coverage.xml
__pycache__
.idea
venv
.venv/
htmlcov/
dist/
4 changes: 2 additions & 2 deletions onekey_client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .client import Client
from .models import Tenant, FirmwareMetadata
from .client import Client as Client
from .models import Tenant as Tenant, FirmwareMetadata as FirmwareMetadata
6 changes: 3 additions & 3 deletions onekey_client/cli/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,9 @@ def create_new_cve_testcase(self, cve):
message="New CVE",
output=f"""New CVE detected
URL: {url}
CVE ID: {cve['id']}
Severity: {cve['severity']}
Description: {cve['description']}
CVE ID: {cve["id"]}
Severity: {cve["severity"]}
Description: {cve["description"]}
""",
)
return test_case
Expand Down
2 changes: 1 addition & 1 deletion onekey_client/queries/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .utils import load_query
from .utils import load_query as load_query
614 changes: 0 additions & 614 deletions poetry.lock

This file was deleted.

55 changes: 28 additions & 27 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
[tool.poetry]
[project]
name = "onekey_client"
version = "2.3.0"
description = "ONEKEY API client"
homepage = "https://www.onekey.com/"
authors = ["ONEKEY <support@onekey.com>"]
license = "MIT"
authors = [{ name = "ONEKEY", email = "support@onekey.com" }]
requires-python = ">=3.9"
readme = "README.md"
license = "MIT"
keywords = ["iot", "security", "firmware", "analysis"]
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Security"]
"Development Status :: 4 - Beta",
"Environment :: Console",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Security",
]
dependencies = [
"httpx==0.28.1",
"pydantic==2.10.6",
"Authlib>=1.4.1,<2.0.0",
"importlib-resources>=6.0.0,<7",
"click>=8.1.3,<9",
"junit-xml>=1.9,<2",
]

[tool.poetry.urls]
"GitHub" = "https://github.com/onekey-sec/python-client"
[project.urls]
Homepage = "https://www.onekey.com/"
GitHub = "https://github.com/onekey-sec/python-client"
"Bug Tracker" = "https://github.com/onekey-sec/python-client/issues"

[tool.poetry.dependencies]
python = "^3.9.0"
httpx = "0.28.1"
pydantic = "2.10.6"
Authlib = ">=1.4.1,<2.0.0"
importlib-resources = "^6.0.0"
click = "^8.1.3"
junit-xml = "^1.9"
[project.scripts]
onekey = "onekey_client.cli.cli:main"

[tool.poetry.dev-dependencies]
black = "^25.0.0"
[dependency-groups]
dev = ["ruff==0.14.9"]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
onekey = "onekey_client.cli.cli:main"
requires = ["hatchling"]
build-backend = "hatchling.build"
18 changes: 18 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:recommended", "schedule:earlyMondays"],
"labels": ["dependencies"],
"packageRules": [
{
"matchUpdateTypes": ["minor", "patch"],
"autoApprove": true,
"automerge": true
}
],
"lockFileMaintenance": {
"enabled": true,
"branchTopic": "lock-file-maintenance-{{packageFile}}",
"commitMessageExtra": "({{packageFile}})",
"extends": ["schedule:monthly"]
}
}
Loading