Fix camel-tools dependency compatibility - #14
Open
oasissan wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates SinaTools packaging and CLI behavior to restore compatibility with the camel-tools/Transformers stack while fixing a regression in the sentence tokenizer CLI. It primarily adjusts runtime dependency metadata, removes an unused packaged dependency, and adds regression tests around the dependency declarations and --text CLI handling.
Changes:
- Add
torchas a direct runtime dependency, boundtransformersto<4.44, and removetorchvisionfrom package/environment metadata. - Fix the sentence tokenizer CLI so
--textinput is passed as a full string instead of being split character-by-character. - Add regression tests for dependency declarations and sentence tokenizer CLI output; regenerate packaged metadata/build artifacts.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
tests/test_sentence_tokenizer_cli.py |
Adds a CLI regression test for --text sentence splitting behavior. |
tests/test_dependency_metadata.py |
Adds tests that inspect dependency declarations in setup.py. |
sinatools/environment.yml |
Updates the packaged environment pins to remove torchvision and downgrade transformers/tokenizers. |
sinatools/CLI/utils/sentence_tokenizer.py |
Refactors the CLI and changes how text/file input is assembled before tokenization. |
setup.py |
Declares torch directly and constrains transformers in install requirements. |
setup.cfg |
Removes the pytest-specific collect_ignore section and keeps egg-info settings. |
build/lib/sinatools/environment.yml |
Regenerated build artifact mirroring the environment dependency changes. |
build/lib/sinatools/CLI/utils/sentence_tokenizer.py |
Regenerated build artifact mirroring the CLI tokenizer changes. |
SinaTools.egg-info/requires.txt |
Regenerated requirement metadata reflecting the updated install requirements. |
SinaTools.egg-info/SOURCES.txt |
Regenerated source manifest including the new test files. |
SinaTools.egg-info/PKG-INFO |
Regenerated package metadata reflecting the updated dependency declarations and package version metadata. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return | ||
|
|
||
| text_content = args.text if args.text else read_file(args.file) | ||
| text_content = args.text if args.text else " ".join(read_file(args.file)) |
| def test_transformers_range_matches_camel_tools(self): | ||
| requirements = load_setup_requirements() | ||
|
|
||
| self.assertIn("transformers>=4.0,<4.44", requirements) |
| Metadata-Version: 2.4 | ||
| Name: SinaTools | ||
| Version: 0.1.41 | ||
| Version: 1.0.7 |
| return | ||
|
|
||
| text_content = args.text if args.text else read_file(args.file) | ||
| text_content = args.text if args.text else " ".join(read_file(args.file)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Root cause
SinaTools imports torch directly from WSD/NER modules, but the previous compatibility change removed torchvision without adding torch explicitly. Loosening Transformers all the way to an unbounded dependency also allowed Transformers 5.x, which breaks current relation import behavior. camel-tools 1.5.7 requires transformers >=4.0,<4.44, so this PR uses that bounded range.
Validation
Notes
flake8 sinatools testsstill reports existing repository-wide style issues outside this patch.python setup.py testis still blocked by the legacy pytest-runner/setuptools test command path; direct pytest is passing.