Skip to content

Remove fastText support and enable numpy 2.x compatibility - #1315

Merged
wRAR merged 5 commits into
masterfrom
remove-fasttext-support-numpy2
Apr 9, 2026
Merged

wRAR merged 5 commits into
masterfrom
remove-fasttext-support-numpy2

Conversation

@serhii73

@serhii73 serhii73 commented Feb 26, 2026 •

Copy link
Copy Markdown
Collaborator

FastText library has been archived since March 2024 and is no longer maintained.

Closes #1287
Closes #1251

FastText library has been archived since March 2024 and is no longer
maintained. This dependency was blocking numpy 2.x adoption.

Changes:
- Remove fasttext extra from setup.py dependencies
- Add deprecation warnings to fasttext.py module
- Update documentation to recommend langdetect as primary option
- Update CLI to deprecate --fasttext flag
- Add comprehensive test suite for langdetect integration
- Remove fasttext from tox.ini test configurations

Users should migrate to langdetect:
  pip install dateparser[langdetect]

Closes #1287
Closes #1251
@codecov

codecov Bot commented Feb 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
βœ… Project coverage is 96.50%. Comparing base (8cdcf80) to head (926ba1f).
⚠️ Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
dateparser/custom_language_detection/fasttext.py 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1315      +/-   ##
==========================================
- Coverage   96.63%   96.50%   -0.14%     
==========================================
  Files         235      235              
  Lines        2915     2887      -28     
==========================================
- Hits         2817     2786      -31     
- Misses         98      101       +3     

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the deprecated fastText library dependency to enable numpy 2.x compatibility. The fastText library has been archived since March 2024 and is no longer maintained, creating a blocker for adopting modern versions of numpy and other libraries that require numpy 2.x.

Changes:

  • Removed fastText extra dependency from setup.py (numpy 1.x constraint removed)
  • Added deprecation warnings and error handling to fasttext.py module
  • Updated CLI to deprecate --fasttext flag and show migration guidance
  • Refactored test_language_detect.py to focus on langdetect with comprehensive test coverage
  • Cleaned up tox.ini to remove fasttext and numpy version pins from test configurations

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
setup.py Removed fasttext extra dependency including numpy 1.x constraint
tox.ini Removed fasttext from test extras and numpy 1.x version pins from min dependencies
tests/test_language_detect.py Completely refactored to test langdetect instead of fasttext, with expanded test coverage including basic functionality, integration tests, and mock tests
dateparser_cli/cli.py Deprecated --fasttext flag with helpful error messages directing users to langdetect
dateparser/custom_language_detection/fasttext.py Added deprecation warnings and ImportError when fasttext is not available
docs/custom_language_detection.rst Updated documentation to remove fasttext examples and add deprecation notice, promoting langdetect as the primary option

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +16 to +23
try:
import fasttext
except ImportError:
raise ImportError(
"fastText is no longer included as a dependency. "
"The library is archived and unmaintained. "
"Please use langdetect instead: pip install dateparser[langdetect]"
)

Copilot AI Feb 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deprecation approach has a logical issue. The module shows a DeprecationWarning at import time (lines 8-14), then tries to import fasttext (line 17). If fasttext is not installed, an ImportError is raised (lines 18-23) that tells users to migrate to langdetect. However, the rest of the module code (lines 25-59) still exists and will attempt to use fasttext if it was somehow available. This creates confusion: if a user has fasttext installed, they'll see a deprecation warning but the code will still work. If they don't have it installed, they'll get an ImportError. A clearer approach would be to always raise an error or to remove the functional code entirely, leaving only the deprecation message.

Copilot uses AI. Check for mistakes.
Comment thread tests/test_language_detect.py Resolved
Comment thread dateparser_cli/cli.py Resolved
serhii73 and others added 4 commits February 26, 2026 12:43
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
The previous approach was confusing:
- If fasttext was installed, it showed a warning but still worked
- If fasttext wasn't installed, it raised an ImportError

This creates inconsistent deprecation - users don't know if the
feature is truly deprecated or not.

Now the module:
- Always shows deprecation warning on import
- Always raises ImportError when detect_languages() is called
- Provides clear migration path to langdetect
- No functional fasttext code remains

This makes the deprecation clear and consistent.
The module-level 'detect_languages' mock was defined but never used.
The MockLangDetectTest class defines its own mock as a class attribute,
and other test classes use the actual lang_detect_detect_languages function.

This cleanup removes the unused mock to avoid confusion.
@serhii73
serhii73 requested a review from wRAR February 26, 2026 12:03
@serhii73 serhii73 changed the title [WIP] Remove fastText support and enable numpy 2.x compatibility Remove fastText support and enable numpy 2.x compatibility Feb 26, 2026
@wRAR
wRAR merged commit b72ed09 into master Apr 9, 2026
16 of 18 checks passed
@wRAR
wRAR deleted the remove-fasttext-support-numpy2 branch April 9, 2026 07:22
serhii73 added a commit to EpicWink/dateparser that referenced this pull request Jun 1, 2026
- Resolve conflicts: keep slimmed setup.py (long_description only)
- Drop fasttext extra (removed upstream in scrapinghub#1315)
- Define version statically as project.version (1.4.0), keep dateparser.__version__ for runtime
- Remove dynamic version attr; configure bump-my-version to update pyproject.toml and dateparser/__init__.py
@serhii73 serhii73 mentioned this pull request Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Please support numpy-2.x fasttext status

4 participants