Skip to content

Commit

Permalink
[BUGFIX] rename optional deps v1 (#5164)
Browse files Browse the repository at this point in the history
# Description
<!-- Please include a summary of the changes and the related issue.
Please also include relevant motivation and context. List any
dependencies that are required for this change. -->

Apparently naming python optional dependencies with `v1` is not allowed
and the installation process fails
```bash
...
    self._link_candidate_cache[link] = LinkCandidate(
  File "/Users/frascuchon/.pyenv/versions/3.9.18/envs/2.0.0/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 303, in __init__
    super().__init__(
  File "/Users/frascuchon/.pyenv/versions/3.9.18/envs/2.0.0/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 158, in __init__
    self.dist = self._prepare()
  File "/Users/frascuchon/.pyenv/versions/3.9.18/envs/2.0.0/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 247, in _prepare
    self._check_metadata_consistency(dist)
  File "/Users/frascuchon/.pyenv/versions/3.9.18/envs/2.0.0/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 229, in _check_metadata_consistency
    list(dist.iter_dependencies(list(dist.iter_provided_extras())))
  File "/Users/frascuchon/.pyenv/versions/3.9.18/envs/2.0.0/lib/python3.9/site-packages/pip/_internal/metadata/pkg_resources.py", line 250, in iter_provided_extras
    return self._extra_mapping.keys()
  File "/Users/frascuchon/.pyenv/versions/3.9.18/envs/2.0.0/lib/python3.9/site-packages/pip/_internal/metadata/pkg_resources.py", line 94, in _extra_mapping
    canonicalize_name(extra): extra for extra in self._dist.extras
  File "/Users/frascuchon/.pyenv/versions/3.9.18/envs/2.0.0/lib/python3.9/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3026, in extras
    return [dep for dep in self._dep_map if dep]
  File "/Users/frascuchon/.pyenv/versions/3.9.18/envs/2.0.0/lib/python3.9/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3072, in _dep_map
    self.__dep_map = self._compute_dependencies()
  File "/Users/frascuchon/.pyenv/versions/3.9.18/envs/2.0.0/lib/python3.9/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3089, in _compute_dependencies
    common = types.MappingProxyType(dict.fromkeys(reqs_for_extra(None)))
  File "/Users/frascuchon/.pyenv/versions/3.9.18/envs/2.0.0/lib/python3.9/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3086, in reqs_for_extra
    if not req.marker or req.marker.evaluate({'extra': extra}):
  File "/Users/frascuchon/.pyenv/versions/3.9.18/envs/2.0.0/lib/python3.9/site-packages/pip/_vendor/packaging/markers.py", line 325, in evaluate
    return _evaluate_markers(self._markers, current_environment)
  File "/Users/frascuchon/.pyenv/versions/3.9.18/envs/2.0.0/lib/python3.9/site-packages/pip/_vendor/packaging/markers.py", line 225, in _evaluate_markers
    groups[-1].append(_eval_op(lhs_value, op, rhs_value))
  File "/Users/frascuchon/.pyenv/versions/3.9.18/envs/2.0.0/lib/python3.9/site-packages/pip/_vendor/packaging/markers.py", line 183, in _eval_op
    return spec.contains(lhs, prereleases=True)
  File "/Users/frascuchon/.pyenv/versions/3.9.18/envs/2.0.0/lib/python3.9/site-packages/pip/_vendor/packaging/specifiers.py", line 552, in contains
    normalized_item = _coerce_version(item)
  File "/Users/frascuchon/.pyenv/versions/3.9.18/envs/2.0.0/lib/python3.9/site-packages/pip/_vendor/packaging/specifiers.py", line 28, in _coerce_version
    version = Version(version)
  File "/Users/frascuchon/.pyenv/versions/3.9.18/envs/2.0.0/lib/python3.9/site-packages/pip/_vendor/packaging/version.py", line 202, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
pip._vendor.packaging.version.InvalidVersion: Invalid version: ''
```

We need to change the `v1` to another valid name: `sdk-v1`

**Type of change**
<!-- Please delete options that are not relevant. Remember to title the
PR according to the type of change -->

- Bug fix (non-breaking change which fixes an issue)
- Documentation update

**How Has This Been Tested**
<!-- Please add some reference about how your feature has been tested.
-->

**Checklist**
<!-- Please go over the list and make sure you've taken everything into
account -->

- I added relevant documentation
- I followed the style guidelines of this project
- I did a self-review of my code
- I made corresponding changes to the documentation
- I confirm My changes generate no new warnings
- I have added tests that prove my fix is effective or that my feature
works
- I have added relevant notes to the CHANGELOG.md file (See
https://keepachangelog.com/)
  • Loading branch information
frascuchon authored Jul 4, 2024
1 parent c56ba2f commit 0e2a195
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion argilla/docs/how_to_guides/migrate_from_legacy_datasets.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The guide will take you through three steps:

Connect to the Argilla V1 server via the new `argilla` package. First, you should install an extra dependency:
```bash
pip install "argilla[v1]"
pip install "argilla[sdk-v1]"
```

Now, you can use the `v1` module to connect to the Argilla V1 server.
Expand Down
3 changes: 1 addition & 2 deletions argilla/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ dynamic = ["version"]
dependencies = [
"httpx>=0.26.0",
"pydantic>=2.6.0, <3.0.0",

"tqdm>=4.60.0",
"rich>=10.0.0",
]
Expand All @@ -23,7 +22,7 @@ io = [
"datasets>=2.0.0",
]

v1 = [
sdk-v1 = [
"argilla-v1[listeners]",
]

Expand Down
2 changes: 1 addition & 1 deletion argilla/src/argilla/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from argilla_v1 import * # noqa
except ModuleNotFoundError as ex:
raise Exception(
'The package argilla-v1 is not installed. Please install it by typing: pip install "argilla[v1]"',
'The package argilla-v1 is not installed. Please install it by typing: pip install "argilla[sdk-v1]"',
) from ex


Expand Down

0 comments on commit 0e2a195

Please sign in to comment.