Skip to content

Commit 774c1c3

Browse files
authored
Migrate to uv and update python version support (#558)
* Migrate to uv and update python version support * Update pyproject metadata
1 parent cd7ad3e commit 774c1c3

File tree

9 files changed

+1358
-55
lines changed

9 files changed

+1358
-55
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
version: 2
22
updates:
3-
- package-ecosystem: pip
3+
- package-ecosystem: uv
44
directory: "/"
55
schedule:
6-
interval: daily
6+
interval: monthly
77
open-pull-requests-limit: 10
88
- package-ecosystem: "github-actions"
99
directory: "/"

.github/workflows/build-release.yml

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,36 +13,26 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
include:
16-
- { name: "3.9", python: "3.9", tox: py39 }
17-
- { name: "3.13", python: "3.13", tox: py313 }
18-
- { name: "lowest", python: "3.9", tox: py39-lowest }
16+
- { name: "3.10", python: "3.10", tox: py310 }
17+
- { name: "3.14", python: "3.14", tox: py314 }
18+
- { name: "lowest", python: "3.10", tox: py310-lowest }
1919
steps:
2020
- uses: actions/checkout@v6
21-
- uses: actions/setup-python@v6
22-
with:
23-
python-version: ${{ matrix.python }}
21+
- uses: astral-sh/setup-uv@v7
2422
- name: Download nltk data
2523
run: |
26-
pip install .
27-
python -m textblob.download_corpora
28-
- run: python -m pip install tox
29-
- run: python -m tox -e${{ matrix.tox }}
24+
uv run python -m textblob.download_corpora
25+
- run: uv run tox -e${{ matrix.tox }}
3026
build:
3127
name: Build package
3228
runs-on: ubuntu-latest
3329
steps:
3430
- uses: actions/checkout@v6
35-
- uses: actions/setup-python@v6
36-
with:
37-
python-version: "3.11"
38-
- name: Install pypa/build
39-
run: python -m pip install build
31+
- uses: astral-sh/setup-uv@v7
4032
- name: Build a binary wheel and a source tarball
41-
run: python -m build
42-
- name: Install twine
43-
run: python -m pip install twine
33+
run: uv build
4434
- name: Check build
45-
run: python -m twine check --strict dist/*
35+
run: uvx twine check --strict dist/*
4636
- name: Store the distribution packages
4737
uses: actions/upload-artifact@v7
4838
with:
@@ -55,11 +45,8 @@ jobs:
5545
runs-on: ubuntu-latest
5646
steps:
5747
- uses: actions/checkout@v6
58-
- uses: actions/setup-python@v6
59-
with:
60-
python-version: "3.11"
61-
- run: python -m pip install tox
62-
- run: python -m tox -e lint
48+
- uses: astral-sh/setup-uv@v7
49+
- run: uv run tox -e lint
6350
publish-to-pypi:
6451
name: PyPI release
6552
if: startsWith(github.ref, 'refs/tags/')

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
repos:
2+
- repo: https://github.com/astral-sh/uv-pre-commit
3+
rev: 0.11.2
4+
hooks:
5+
- id: uv-lock
26
- repo: https://github.com/astral-sh/ruff-pre-commit
37
rev: v0.15.8
48
hooks:

.readthedocs.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ sphinx:
44
formats:
55
- pdf
66
build:
7-
os: ubuntu-22.04
7+
os: ubuntu-24.04
88
tools:
9-
python: "3.11"
10-
python:
11-
install:
12-
- method: pip
13-
path: .
14-
extra_requirements:
15-
- docs
9+
python: "3.13"
10+
jobs:
11+
post_install:
12+
- asdf plugin add uv
13+
- asdf install uv latest
14+
- asdf global uv latest
15+
- uv venv $READTHEDOCS_VIRTUALENV_PATH
16+
- uv sync --frozen --group docs

CHANGELOG.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ Features:
99
- Allow custom tokenizer to be used for tokenizing words with ``.words`` (:pr:`555`).
1010
Thanks :user:`ReinerBRO` for the PR.
1111

12+
Support:
13+
14+
- Support Python 3.10-3.14.
15+
1216
0.19.0 (2025-01-13)
1317
___________________
1418

CONTRIBUTING.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ Setting Up for Local Development
3232
$ git clone https://github.com/sloria/TextBlob.git
3333
$ cd TextBlob
3434

35-
2. Install development requirements. It is highly recommended that you use a virtualenv. ::
35+
2. Install development requirements. ::
3636

37-
# After activating your virtualenv
38-
$ pip install -e '.[tests]'
37+
$ uv sync
3938

4039
.. _extension-development:
4140

@@ -109,11 +108,11 @@ Running tests
109108

110109
To run all the tests: ::
111110

112-
$ pytest
111+
$ uv run pytest
113112

114113
To skip slow tests: ::
115114

116-
$ pytest -m 'not slow'
115+
$ uv run pytest -m 'not slow'
117116

118117
Documentation
119118
+++++++++++++
@@ -122,7 +121,7 @@ Contributions to the documentation are welcome. Documentation is written in `reS
122121

123122
To build docs and run in watch mode: ::
124123

125-
$ tox -e docs-serve
124+
$ uv run tox -e docs-serve
126125

127126
.. _Sphinx: http://sphinx.pocoo.org/
128127

pyproject.toml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,41 @@ name = "textblob"
33
version = "0.19.0"
44
description = "Simple, Pythonic text processing. Sentiment analysis, part-of-speech tagging, noun phrase parsing, and more."
55
readme = "README.rst"
6-
license = { file = "LICENSE" }
7-
authors = [{ name = "Steven Loria", email = "sloria1@gmail.com" }]
6+
license = "MIT"
7+
authors = [{ name = "Steven Loria", email = "oss@stevenloria.com" }]
88
classifiers = [
99
"Intended Audience :: Developers",
10-
"License :: OSI Approved :: MIT License",
1110
"Programming Language :: Python :: 3",
12-
"Programming Language :: Python :: 3.9",
1311
"Programming Language :: Python :: 3.10",
1412
"Programming Language :: Python :: 3.11",
1513
"Programming Language :: Python :: 3.12",
1614
"Programming Language :: Python :: 3.13",
15+
"Programming Language :: Python :: 3.14",
1716
"Topic :: Text Processing :: Linguistic",
1817
]
1918
keywords = ["textblob", "nlp", 'linguistics', 'nltk', 'pattern']
20-
requires-python = ">=3.9"
19+
requires-python = ">=3.10"
2120
dependencies = ["nltk>=3.9"]
2221

2322
[project.urls]
2423
Changelog = "https://textblob.readthedocs.io/en/latest/changelog.html"
2524
Issues = "https://github.com/sloria/TextBlob/issues"
2625
Source = "https://github.com/sloria/TextBlob"
2726

28-
[project.optional-dependencies]
29-
docs = ["sphinx==9.1.0", "sphinx-issues==5.0.1", "PyYAML==6.0.3"]
27+
[dependency-groups]
28+
docs = ["sphinx", "sphinx-issues", "PyYAML"]
3029
tests = ["pytest", "numpy"]
31-
dev = ["textblob[tests]", "tox", "pre-commit>=3.5,<5.0", "pyright", "ruff"]
30+
dev = [
31+
{ include-group = "tests" },
32+
"tox",
33+
"tox-uv",
34+
"pre-commit>=3.5,<5.0",
35+
"pyright",
36+
"ruff",
37+
]
38+
39+
[tool.uv]
40+
default-groups = ["dev"]
3241

3342
[build-system]
3443
requires = ["flit_core<4"]

tox.ini

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,34 @@
11
[tox]
22
envlist =
33
lint
4-
py{39,310,311,312,313}
5-
py39-lowest
4+
py{310,311,312,313,314}
5+
py310-lowest
66

77
[testenv]
8-
extras = tests
8+
dependency_groups = tests
99
deps =
1010
lowest: nltk==3.9
1111
commands = pytest {posargs}
1212

13-
13+
1414
[testenv:lint]
1515
deps = pre-commit>=3.5,<5.0
1616
skip_install = true
1717
commands =
1818
pre-commit run --all-files
1919

2020
[testenv:docs]
21-
extras = docs
21+
dependency_groups = docs
2222
commands = sphinx-build docs/ docs/_build {posargs}
2323

2424
; Below tasks are for development only (not run in CI)
2525

2626
[testenv:docs-serve]
2727
deps = sphinx-autobuild
28-
extras = docs
28+
dependency_groups = docs
2929
commands = sphinx-autobuild --port=0 --open-browser --delay=2 docs/ docs/_build {posargs} --watch src --watch CONTRIBUTING.rst --watch README.rst
3030

3131
[testenv:readme-serve]
3232
deps = restview
3333
skip_install = true
3434
commands = restview README.rst
35-

0 commit comments

Comments
 (0)