Skip to content

Commit b84f6ba

Browse files
committed
meta: cleanup, bump dependencies
1 parent 364ac01 commit b84f6ba

File tree

9 files changed

+134
-72
lines changed

9 files changed

+134
-72
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,19 @@ jobs:
1111
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
1212

1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
1515
- name: Set up Python ${{ matrix.python-version }}
16-
uses: actions/setup-python@v2
16+
uses: actions/setup-python@v4
1717
with:
1818
python-version: ${{ matrix.python-version }}
1919
- name: Install dependencies
2020
run: |
2121
python -m pip install --upgrade pip
2222
pip install -e .[dev]
23-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
24-
- name: Lint with flake8
23+
- name: Lint with ruff
2524
run: |
26-
# stop the build if there are Python syntax errors or undefined names
27-
flake8 xbox --count --select=E9,F63,F7,F82 --show-source --statistics
28-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
29-
flake8 xbox --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
25+
ruff check xbox
26+
ruff check tests
3027
- name: Test with pytest
3128
run: |
3229
pytest
@@ -35,20 +32,20 @@ jobs:
3532
runs-on: ubuntu-latest
3633
needs: build
3734
steps:
38-
- uses: actions/checkout@v2
35+
- uses: actions/checkout@v4
3936
- name: Set up Python
40-
uses: actions/setup-python@v2
37+
uses: actions/setup-python@v4
4138
with:
4239
python-version: '3.12'
4340
- name: Install dependencies
4441
run: |
4542
python -m pip install --upgrade pip
46-
pip install setuptools wheel twine
43+
pip install setuptools wheel twine build
4744
- name: Build and publish
4845
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
4946
env:
5047
TWINE_USERNAME: __token__
5148
TWINE_PASSWORD: ${{ secrets.PYPI_API_KEY }}
5249
run: |
53-
python setup.py sdist bdist_wheel
50+
python -m build
5451
twine upload dist/*

.pre-commit-config.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,38 @@ repos:
55
hooks:
66
# Run the linter.
77
- id: ruff
8+
args: [ --fix ]
89
# Run the formatter.
910
- id: ruff-format
11+
- repo: https://github.com/asottile/pyupgrade
12+
rev: v3.15.0
13+
hooks:
14+
- id: pyupgrade
15+
args: [--py38-plus]
16+
- repo: https://github.com/psf/black
17+
rev: 23.11.0
18+
hooks:
19+
- id: black
20+
args:
21+
- --safe
22+
- --quiet
23+
files: ^((xbox|tests)/.+)?[^/]+\.py$
24+
- repo: https://github.com/PyCQA/bandit
25+
rev: 1.7.5
26+
hooks:
27+
- id: bandit
28+
args:
29+
- --configfile=pyproject.toml
30+
- --quiet
31+
- --format=custom
32+
files: ^(xbox|tests)/.+\.py$
33+
- repo: https://github.com/PyCQA/isort
34+
rev: 5.12.0
35+
hooks:
36+
- id: isort
37+
- repo: https://github.com/pre-commit/pre-commit-hooks
38+
rev: v4.5.0
39+
hooks:
40+
- id: check-executables-have-shebangs
41+
stages: [manual]
42+
- id: check-json

.readthedocs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ sphinx:
99

1010
build:
1111
# readdocs master now includes a rust toolchain
12-
os: "ubuntu-20.04"
12+
os: "ubuntu-22.04"
1313
tools:
14-
python: "3.9"
14+
python: "3.12"
1515

1616
python:
1717
install:

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#########################################
44
# Image WITH C compiler, building wheels for next stage
5-
FROM python:3.10-alpine as bigimage
5+
FROM python:3.12-alpine as bigimage
66

77
ENV LANG C.UTF-8
88

@@ -17,7 +17,7 @@ RUN pip wheel --wheel-dir=/root/wheels /src/xbox-webapi
1717

1818
#########################################
1919
# Image WITHOUT C compiler, installing the component from wheel
20-
FROM python:3.10-alpine as smallimage
20+
FROM python:3.12-alpine as smallimage
2121

2222
RUN apk add --no-cache openssl
2323

Makefile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,16 @@ clean-pyc: ## remove Python file artifacts
4545
find . -name '__pycache__' -exec rm -fr {} +
4646

4747
clean-test: ## remove test and coverage artifacts
48-
rm -fr .tox/
4948
rm -f .coverage
5049
rm -fr htmlcov/
5150

5251
lint: ## check style with flake8
53-
flake8 xbox tests
52+
ruff check --fix xbox
53+
ruff check --fix tests
5454

5555
test: ## run tests quickly with the default Python
5656
py.test
5757

58-
test-all: ## run tests on every Python version with tox
59-
tox
60-
6158
coverage: ## check code coverage quickly with the default Python
6259
coverage run --source xbox -m pytest
6360
coverage report -m
@@ -84,6 +81,5 @@ dist: clean ## builds source and wheel package
8481
ls -l dist
8582

8683
install: clean ## install the package to the active Python's site-packages
87-
pip install -r requirements.txt
8884
pre-commit install
8985
pip install -e .

bandit.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

pyproject.toml

Lines changed: 86 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dependencies = [
1010
"ecdsa",
1111
"httpx",
1212
"ms_cv",
13-
"pydantic",
13+
"pydantic==2.*",
1414
]
1515
requires-python = ">=3.8"
1616
readme = "README.md"
@@ -21,12 +21,11 @@ classifiers = [
2121
"Intended Audience :: Developers",
2222
"License :: OSI Approved :: MIT License",
2323
"Programming Language :: Python :: 3",
24+
"Programming Language :: Python :: 3.8",
25+
"Programming Language :: Python :: 3.9",
2426
"Programming Language :: Python :: 3.10",
2527
"Programming Language :: Python :: 3.11",
2628
"Programming Language :: Python :: 3.12",
27-
"Programming Language :: Python :: 3.7",
28-
"Programming Language :: Python :: 3.8",
29-
"Programming Language :: Python :: 3.9",
3029
"Topic :: Software Development :: Libraries :: Python Modules",
3130
]
3231

@@ -35,19 +34,28 @@ Homepage = "https://github.com/OpenXbox/xbox-webapi-python"
3534

3635
[project.optional-dependencies]
3736
dev = [
37+
# Tagging releases
3838
"bump2version",
39+
# Testing
3940
"coverage",
40-
"flake8",
41-
"pip",
4241
"pytest",
4342
"pytest-asyncio",
4443
"pytest-cov",
4544
"pytest-runner",
4645
"respx",
47-
"tox",
46+
# Packaging
4847
"twine",
4948
"watchdog",
5049
"wheel",
50+
# Pre-commit / Linting
51+
"ruff==0.1.6",
52+
"pre-commit==3.5.0",
53+
"pyupgrade==3.15.0",
54+
"black==23.11.0",
55+
# "flake8-docstrings==1.5.0",
56+
"pydocstyle==6.1.1",
57+
"bandit==1.7.5",
58+
"isort==5.12.0",
5159
]
5260
docs = [
5361
"Sphinx",
@@ -62,13 +70,83 @@ xbox-friends = "xbox.webapi.scripts.friends:main"
6270
xbox-searchlive = "xbox.webapi.scripts.search:main"
6371
xbox-xal = "xbox.webapi.scripts.xal:main"
6472

73+
[tool.ruff]
74+
# Exclude a variety of commonly ignored directories.
75+
exclude = [
76+
".bzr",
77+
".direnv",
78+
".eggs",
79+
".git",
80+
".git-rewrite",
81+
".hg",
82+
".mypy_cache",
83+
".nox",
84+
".pants.d",
85+
".pytype",
86+
".ruff_cache",
87+
".svn",
88+
".tox",
89+
".venv",
90+
"__pypackages__",
91+
"_build",
92+
"buck-out",
93+
"build",
94+
"dist",
95+
"node_modules",
96+
"venv",
97+
]
98+
99+
# Same as Black.
100+
line-length = 88
101+
indent-width = 4
102+
103+
# Assume Python 3.8
104+
target-version = "py38"
105+
106+
[tool.ruff.lint]
107+
select = ["E4", "E7", "E9", "F"]
108+
ignore = []
109+
110+
fixable = ["ALL"]
111+
unfixable = []
112+
# Allow unused variables when underscore-prefixed.
113+
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
114+
115+
[tool.ruff.format]
116+
# Like Black, use double quotes for strings.
117+
quote-style = "double"
118+
# Like Black, indent with spaces, rather than tabs.
119+
indent-style = "space"
120+
# Like Black, respect magic trailing commas.
121+
skip-magic-trailing-comma = false
122+
# Like Black, automatically detect the appropriate line ending.
123+
line-ending = "auto"
124+
125+
[tool.bandit]
126+
exclude_dirs = ["tests"]
127+
tests = [
128+
"B108",
129+
"B306",
130+
"B307",
131+
"B313",
132+
"B314",
133+
"B315",
134+
"B316",
135+
"B317",
136+
"B318",
137+
"B319",
138+
"B320",
139+
"B602",
140+
"B604"
141+
]
142+
65143
[tool.black]
66144
target-version = ["py37", "py38", "py39", "py310", "py311"]
67145
exclude = 'generated'
68146

69147
[tool.setuptools.packages.find]
70148
where = ["."]
71-
include = ["xbox.webapi"]
149+
include = ["xbox.webapi.*"]
72150

73151
[build-system]
74152
requires = ["setuptools>=61", "wheel"]

requirements.txt

Lines changed: 0 additions & 23 deletions
This file was deleted.

tests/test_xal.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import uuid
2-
31
from httpx import AsyncClient, Response
42
import pytest
53

0 commit comments

Comments
 (0)