-
Notifications
You must be signed in to change notification settings - Fork 31.8k
[core] implement support for run-time dependency version checking #8645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
339a12f
implement support for run-time dependency version checking
stas00 5b120a5
try not escaping !
stas00 232e20c
use findall that works on py36
stas00 1037fb6
small tweaks
stas00 67fb1f7
autoformatter worship
stas00 43736c7
simplify
stas00 2bd7f80
shorter names
stas00 0275b32
add support for non-versioned checks
stas00 1a1307c
add deps
stas00 99d9b04
revert
stas00 72a2aeb
tokenizers not required, check version only if installed
stas00 8cc9ef6
make a proper distutils cmd and add make target
stas00 300450f
tqdm must be checked before tokenizers
stas00 c29d484
workaround the DistributionNotFound peculiar setup
stas00 04bd942
handle the rest of packages in setup.py
stas00 d1ec727
fully sync setup.py's install_requires - to check them all
stas00 8d18a13
nit
stas00 56f9ee2
make install_requires more readable
stas00 bce3314
typo
stas00 557f49c
Update setup.py
stas00 0a3dabe
restyle
stas00 570760e
add types
stas00 d2237d7
simplify
stas00 6cbd99e
simplify2
stas00 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import sys | ||
|
|
||
| from .dependency_versions_table import deps | ||
| from .utils.versions import require_version_core | ||
|
|
||
|
|
||
| # define which module versions we always want to check at run time | ||
| # (usually the ones defined in `install_requires` in setup.py) | ||
| # | ||
| # order specific notes: | ||
| # - tqdm must be checked before tokenizers | ||
|
|
||
| pkgs_to_check_at_runtime = "python tqdm regex sacremoses requests packaging filelock numpy tokenizers".split() | ||
| if sys.version_info < (3, 7): | ||
| pkgs_to_check_at_runtime.append("dataclasses") | ||
|
|
||
| for pkg in pkgs_to_check_at_runtime: | ||
| if pkg in deps: | ||
| if pkg == "tokenizers": | ||
| # must be loaded here, or else tqdm check may fail | ||
| from .file_utils import is_tokenizers_available | ||
|
|
||
| if not is_tokenizers_available(): | ||
| continue # not required, check version only if installed | ||
|
|
||
| require_version_core(deps[pkg]) | ||
| else: | ||
| raise ValueError(f"can't find {pkg} in {deps.keys()}, check dependency_versions_table.py") |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.