Skip to content

Commit 7029069

Browse files
committed
Move to uv + pyproject.toml
1 parent bfc15d8 commit 7029069

10 files changed

Lines changed: 1093 additions & 963 deletions

File tree

.github/workflows/release.yaml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,16 @@ jobs:
1515
id-token: write
1616
steps:
1717
- name: "Checkout"
18-
uses: "actions/checkout@v3"
18+
uses: "actions/checkout@v5"
1919
with:
2020
fetch-depth: 10
21-
- name: "Setup Python"
22-
uses: "actions/setup-python@v4"
21+
- name: "Set up Python"
22+
uses: "actions/setup-python@v5"
23+
- name: "Install uv"
24+
uses: "astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57" # v8.0.0
2325
with:
24-
cache: "pipenv"
25-
cache-dependency-path: "sdk/Pipfile.lock"
26-
- name: "Install pipenv"
27-
run: "pip install pipenv wheel"
28-
- name: "Install dependencies"
29-
run: "rm -rf $(pipenv --venv) && pipenv install --dev"
26+
version: "0.11.2"
3027
- name: "Build dist"
31-
run: "pipenv run python setup.py sdist --format=zip"
28+
run: "uv run --frozen python setup.py sdist --format=zip"
3229
- name: Publish package distributions to PyPI
3330
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/test.yaml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,30 @@ jobs:
1111
runs-on: "ubuntu-22.04"
1212
strategy:
1313
matrix:
14-
python_version: ["3.8", "3.10"]
14+
python_version: ["3.8", "3.10", "3.12"]
1515
steps:
1616
- name: "Checkout"
17-
uses: "actions/checkout@v3"
17+
uses: "actions/checkout@v5"
1818
with:
1919
fetch-depth: 10
20-
- name: "Setup Python"
21-
uses: "actions/setup-python@v4"
20+
- name: "Set up Python"
21+
uses: "actions/setup-python@v5"
2222
with:
2323
python-version: "${{ matrix.python_version }}"
24-
cache: "pipenv"
25-
cache-dependency-path: "Pipfile.lock"
26-
- name: "Install pipenv"
27-
run: "pip install pipenv wheel"
28-
- name: "Install dependencies"
29-
run: "rm -rf $(pipenv --venv) && pipenv --python ${{ matrix.python_version }} install --dev"
24+
- name: "Install uv and set the python version"
25+
uses: "astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57" # v8.0.0
26+
with:
27+
python-version: "${{ matrix.python-version }}"
28+
version: "0.11.2"
3029
- name: "Run pyre"
3130
run: |
3231
set -o pipefail
33-
pipenv run pyre | tee >(sed 's, ,:,' | awk -F: '{sub(" ", "", $5); print "::error file=" ENVIRON["PWD"] "/" $1 ",line=" $2 ",col=" $3 ",title=" $4 "::" $5}')
32+
uv run --frozen pyre | tee >(sed 's, ,:,' | awk -F: '{sub(" ", "", $5); print "::error file=" ENVIRON["PWD"] "/" $1 ",line=" $2 ",col=" $3 ",title=" $4 "::" $5}')
3433
- name: "Run pytest"
35-
run: "PYTHONPATH=. pipenv run pytest"
34+
run: "PYTHONPATH=. uv run --frozen pytest"
3635
- name: "Run pylint"
37-
run: "PYTHONPATH=. pipenv run pylint --jobs 0 --score n --msg-template='::{category} file={abspath},line={line},col={column},title={msg_id} {symbol}::{msg}' lightspark"
36+
run: "PYTHONPATH=. uv run --frozen pylint --jobs 0 --score n --msg-template='::{category} file={abspath},line={line},col={column},title={msg_id} {symbol}::{msg}' lightspark"
3837
- name: "Run black"
3938
run: |
4039
set -o pipefail
41-
pipenv run black --check --diff . | tee >(pipenv run ../scripts/diff2annotation.py)
40+
uv run --frozen black --check --diff . | tee >(pipenv run ../scripts/diff2annotation.py)

.pyre_configuration

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@
22
"site_package_search_strategy": "pep561",
33
"source_directories": [
44
"."
5+
],
6+
"ignore_all_errors": [
7+
".venv/**"
58
]
69
}

Pipfile

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

Pipfile.lock

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

README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The Lightspark Python SDK provides a convenient way to interact with the Lightsp
66

77
To install the SDK, simply run:
88

9-
```bash
9+
```shell
1010
pip install lightspark
1111
```
1212

@@ -19,16 +19,14 @@ The documentation for this SDK (installation, usage, etc.) is available at https
1919
For your convenience, we included an example that shows you how to use the SDK.
2020
Open the file `example.py` and make sure to update the variables at the top of the page with your information, then run it using pipenv:
2121

22-
```python
23-
pipenv install
24-
pipenv run python -m examples.example
22+
```shell
23+
uv sync
24+
uv run python -m examples.example
2525
```
2626

2727
There are also a few examples of webservers for demonstrating webhooks and LNURLs. These can similarly be run through Flask:
2828

29-
```python
30-
pipenv install -d
31-
pipenv run flask --app examples.flask_lnurl_server run
29+
```shell
30+
uv sync --dev
31+
uv run flask --app examples.flask_lnurl_server run
3232
```
33-
34-
Note that Flask requires Python >= 3.8, so these examples will not work if running Python 3.7.

pyproject.toml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,55 @@
1+
[project]
2+
name = "lightspark"
3+
authors = [{ name = "Lightspark Group, Inc.", email = "info@lightspark.com" }]
4+
dynamic = ["version"]
5+
description = "Python SDK for the Lightspark API"
6+
license = { file = "LICENSE" }
7+
requires-python = ">=3.9"
8+
readme = 'README.md'
9+
dependencies = [
10+
"cryptography>=46.0.6",
11+
"lightspark-crypto-python",
12+
"pyjwt",
13+
"requests>=2.32.5",
14+
"zstandard",
15+
]
16+
17+
[project.urls]
18+
homepage = "https://lightspark.com"
19+
documentation = "https://docs.lightspark.com/lightspark-sdk/getting-started?language=Python"
20+
source = "https://github.com/lightsparkdev/python-sdk"
21+
122
[build-system]
223
requires = ["setuptools"]
324
build-backend = "setuptools.build_meta"
25+
26+
[dependency-groups]
27+
dev = [
28+
"flask",
29+
"importlib_metadata",
30+
"isort==5.11.4",
31+
"libcst",
32+
"pylint",
33+
"pyre-check",
34+
"pytest",
35+
"typed-ast",
36+
"unidiff",
37+
]
38+
39+
[tool.setuptools]
40+
dynamic = { version = { attr = "lightspark.version.__version__" } }
41+
42+
[tool.setuptools.packages.find]
43+
include = ["lightspark*"]
44+
45+
[tool.uv]
46+
package = false
47+
# Try to decrease the risk of supply-chain attacks like the LiteLLM attack by waiting at least a week before we
48+
# upgrade versions. If you need to apply an emergency update faster than this, you can run:
49+
#
50+
# uv add $PACKAGE --exclude-newer-package $PACKAGE=false
51+
exclude-newer = "1 week"
52+
53+
[[tool.uv.index]]
54+
name = "pypi"
55+
url = "https://pypi.org/simple"

setup.cfg

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

setup.py

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

0 commit comments

Comments
 (0)