Skip to content

Commit

Permalink
chore: update Python versions and CI (#486)
Browse files Browse the repository at this point in the history
* fix: update corpora module names

Updates corpora module names to fix a missing corpora error when
running:

python -m textblob.download_corpora

This should fix CI errors and #482 and #474

* chore: update Python versions and CI

Updates supported Python versions to be 3.9-3.13 and updates CI to use
the built-in textblob.download_corpora command

* fix: corpora download in CI

* fix: bring back lowest env in Tox/CI

Adds back the "lowest" env in Tox/CI to ensure support in the lowest supported Python + NLTK versions

* chore: add johnfraney to Authors.rst

* Update changelog

* Update changelog

---------

Co-authored-by: Steven Loria <[email protected]>
  • Loading branch information
johnfraney and sloria authored Jan 13, 2025
1 parent 775461f commit 8df5642
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 15 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ jobs:
fail-fast: false
matrix:
include:
- { name: "3.8", python: "3.8", tox: py38 }
- { name: "3.12", python: "3.12", tox: py312 }
- { name: "lowest", python: "3.8", tox: py38-lowest }
- { name: "3.9", python: "3.9", tox: py39 }
- { name: "3.13", python: "3.13", tox: py313 }
- { name: "lowest", python: "3.9", tox: py39-lowest }
steps:
- uses: actions/[email protected]
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Download nltk data
run: wget https://s3.amazonaws.com/textblob/nltk_data-0.11.0.tar.gz
- name: Extract nltk data
run: tar -xzvf nltk_data-0.11.0.tar.gz -C ~
run: |
pip install .
python -m textblob.download_corpora
- run: python -m pip install tox
- run: python -m tox -e${{ matrix.tox }}
build:
Expand Down
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ Contributors (chronological)
- Romain Casati `@casatir <https://github.com/casatir>`_
- Evgeny Kemerov `@sudoguy <https://github.com/sudoguy>`_
- Karthikeyan Singaravelan `@tirkarthi <https://github.com/tirkarthi>`_
- John Franey `@johnfraney <https://github.com/johnfraney>`_
9 changes: 8 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ Changelog
0.19.0 (unreleased)
___________________

Other changes:
Bug fixes:

- Fix ``textblob.download_corpora`` script (:issue:`474`).
Thanks :user:`cagan-elden` for reporting.

Changes:

- Remove vendorized ``unicodecsv`` module, as it's no longer used.
- Support Python 3.9-3.13 and nltk>=3.9 (:pr:`486`)
Thanks :user:`johnfraney` for the PR.

0.18.0 (2024-02-15)
-------------------
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Text Processing :: Linguistic",
]
keywords = ["textblob", "nlp", 'linguistics', 'nltk', 'pattern']
requires-python = ">=3.8"
dependencies = ["nltk>=3.8"]
requires-python = ">=3.9"
dependencies = ["nltk>=3.9"]

[project.urls]
Changelog = "https://textblob.readthedocs.io/en/latest/changelog.html"
Expand Down
4 changes: 2 additions & 2 deletions src/textblob/download_corpora.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

MIN_CORPORA = [
"brown", # Required for FastNPExtractor
"punkt", # Required for WordTokenizer
"punkt_tab", # Required for WordTokenizer
"wordnet", # Required for lemmatization
"averaged_perceptron_tagger", # Required for NLTKTagger
"averaged_perceptron_tagger_eng", # Required for NLTKTagger
]

ADDITIONAL_CORPORA = [
Expand Down
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[tox]
envlist =
lint
py{38,39,310,311,312}
py38-lowest
py{39,310,311,312,313}
py39-lowest

[testenv]
extras = tests
deps =
lowest: nltk==3.8
lowest: nltk==3.9
commands = pytest {posargs}


Expand Down

0 comments on commit 8df5642

Please sign in to comment.