Skip to content

Commit

Permalink
improve dev setup comments and hints (#28495)
Browse files Browse the repository at this point in the history
* improve dev setup comments and hints

* fix tests for new dev setup hints
  • Loading branch information
4imothy authored Jan 15, 2024
1 parent 735968b commit ff86bc3
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


# allow having multiple repository checkouts and not needing to remember to rerun
# 'pip install -e .[dev]' when switching between checkouts and running tests.
# `pip install -e '.[dev]'` when switching between checkouts and running tests.
git_repo_path = abspath(join(dirname(__file__), "src"))
sys.path.insert(1, git_repo_path)

Expand Down
2 changes: 1 addition & 1 deletion examples/flax/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


# allow having multiple repository checkouts and not needing to remember to rerun
# 'pip install -e .[dev]' when switching between checkouts and running tests.
# `pip install -e '.[dev]'` when switching between checkouts and running tests.
git_repo_path = abspath(join(dirname(dirname(dirname(__file__))), "src"))
sys.path.insert(1, git_repo_path)

Expand Down
2 changes: 1 addition & 1 deletion examples/pytorch/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


# allow having multiple repository checkouts and not needing to remember to rerun
# 'pip install -e .[dev]' when switching between checkouts and running tests.
# `pip install -e '.[dev]'` when switching between checkouts and running tests.
git_repo_path = abspath(join(dirname(dirname(dirname(__file__))), "src"))
sys.path.insert(1, git_repo_path)

Expand Down
2 changes: 1 addition & 1 deletion src/transformers/utils/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,5 @@ def require_version(requirement: str, hint: Optional[str] = None) -> None:

def require_version_core(requirement):
"""require_version wrapper which emits a core-specific hint on failure"""
hint = "Try: pip install transformers -U or pip install -e '.[dev]' if you're working with git main"
hint = "Try: `pip install transformers -U` or `pip install -e '.[dev]'` if you're working with git main"
return require_version(requirement, hint)
2 changes: 1 addition & 1 deletion tests/utils/test_versions_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def test_core(self):
require_version_core(req)
except importlib.metadata.PackageNotFoundError as e:
self.assertIn(f"The '{req}' distribution was not found and is required by this application", str(e))
self.assertIn("Try: pip install transformers -U", str(e))
self.assertIn("Try: `pip install transformers -U`", str(e))

# bogus requirements formats:
# 1. whole thing
Expand Down
4 changes: 2 additions & 2 deletions utils/check_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,12 @@ def check_missing_backends():
missing = ", ".join(missing_backends)
if os.getenv("TRANSFORMERS_IS_CI", "").upper() in ENV_VARS_TRUE_VALUES:
raise Exception(
"Full repo consistency checks require all backends to be installed (with `pip install -e .[dev]` in the "
"Full repo consistency checks require all backends to be installed (with `pip install -e '.[dev]'` in the "
f"Transformers repo, the following are missing: {missing}."
)
else:
warnings.warn(
"Full repo consistency checks require all backends to be installed (with `pip install -e .[dev]` in the "
"Full repo consistency checks require all backends to be installed (with `pip install -e '.[dev]'` in the "
f"Transformers repo, the following are missing: {missing}. While it's probably fine as long as you "
"didn't make any change in one of those backends modeling files, you should probably execute the "
"command above to be on the safe side."
Expand Down

0 comments on commit ff86bc3

Please sign in to comment.