From 0936f8ee1ad92c28dbab9a60add91c4ebd868e38 Mon Sep 17 00:00:00 2001
From: Fabian <fab.hof@gmx.de>
Date: Mon, 24 Mar 2025 09:21:48 +0100
Subject: [PATCH 1/3] remove future warned scalar get item

---
 doc/release_notes.rst |  4 ++++
 linopy/variables.py   | 19 +++----------------
 test/test_variable.py |  7 +++----
 3 files changed, 10 insertions(+), 20 deletions(-)

diff --git a/doc/release_notes.rst b/doc/release_notes.rst
index 263a5306..17547755 100644
--- a/doc/release_notes.rst
+++ b/doc/release_notes.rst
@@ -4,6 +4,10 @@ Release Notes
 Upcoming Version
 ----------------
 
+**Breaking Changes**
+
+* The selection of a single item in `__getitem__` now returns a `Variable` instead of a `ScalarVariable`.
+
 Version 0.5.1
 --------------
 
diff --git a/linopy/variables.py b/linopy/variables.py
index d2dd3cd6..bd801b7e 100644
--- a/linopy/variables.py
+++ b/linopy/variables.py
@@ -192,22 +192,9 @@ def __init__(
     def __getitem__(
         self, selector: list[int] | int | slice | tuple[int64, str_]
     ) -> Variable | ScalarVariable:
-        keys = selector if isinstance(selector, tuple) else (selector,)
-        if all(map(pd.api.types.is_scalar, keys)):
-            warn(
-                "Accessing a single value with `Variable[...]` and return type "
-                "ScalarVariable is deprecated. In future, this will return a Variable."
-                "To get a ScalarVariable use `Variable.at[...]` instead.",
-                FutureWarning,
-            )
-            return self.at[keys]
-
-        else:
-            # return selected Variable
-            data = Dataset(
-                {k: self.data[k][selector] for k in self.data}, attrs=self.attrs
-            )
-            return self.__class__(data, self.model, self.name)
+        # return selected Variable
+        data = Dataset({k: self.data[k][selector] for k in self.data}, attrs=self.attrs)
+        return self.__class__(data, self.model, self.name)
 
     @property
     def attrs(self) -> dict[str, Hashable]:
diff --git a/test/test_variable.py b/test/test_variable.py
index 065dd1ce..c7f2f691 100644
--- a/test/test_variable.py
+++ b/test/test_variable.py
@@ -72,11 +72,10 @@ def test_wrong_variable_init(m: Model, x: linopy.Variable) -> None:
 
 
 def test_variable_getter(x: linopy.Variable, z: linopy.Variable) -> None:
-    with pytest.warns(FutureWarning):
-        assert isinstance(x[0], linopy.variables.ScalarVariable)
-        assert isinstance(z[0], linopy.variables.ScalarVariable)
+    assert isinstance(x[0], linopy.variables.Variable)
+    assert isinstance(z[0], linopy.variables.Variable)
 
-    assert isinstance(x.at[0], linopy.variables.ScalarVariable)
+    assert isinstance(x.at[0], linopy.variables.Variable)
 
 
 def test_variable_getter_slice(x: linopy.Variable) -> None:

From 74da3b3895281cab6decd44b8e34301384d68963 Mon Sep 17 00:00:00 2001
From: Fabian <fab.hof@gmx.de>
Date: Wed, 18 Jun 2025 10:18:12 +0200
Subject: [PATCH 2/3] fix: remove tests on single variable getter

---
 test/test_variable.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/test/test_variable.py b/test/test_variable.py
index bddb11bf..d1b5b4f5 100644
--- a/test/test_variable.py
+++ b/test/test_variable.py
@@ -74,9 +74,8 @@ def test_wrong_variable_init(m: Model, x: linopy.Variable) -> None:
 
 def test_variable_getter(x: linopy.Variable, z: linopy.Variable) -> None:
     assert isinstance(x[0], linopy.variables.Variable)
-    assert isinstance(z[0], linopy.variables.Variable)
 
-    assert isinstance(x.at[0], linopy.variables.Variable)
+    assert isinstance(x.at[0], linopy.variables.ScalarVariable)
 
 
 def test_variable_getter_slice(x: linopy.Variable) -> None:

From 46a73aaf8b537f200147a153d643a9a19bab1e26 Mon Sep 17 00:00:00 2001
From: Fabian <fab.hof@gmx.de>
Date: Wed, 18 Jun 2025 12:28:34 +0200
Subject: [PATCH 3/3] update release notes

---
 doc/release_notes.rst | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/doc/release_notes.rst b/doc/release_notes.rst
index ab082943..8dcffd53 100644
--- a/doc/release_notes.rst
+++ b/doc/release_notes.rst
@@ -12,6 +12,9 @@ Release Notes
 
 * With this release, the package support for Python 3.9 was dropped and support for Python 3.10 was officially added.
 
+* The selection of a single item in `__getitem__` now returns a `Variable` instead of a `ScalarVariable`.
+
+
 Version 0.5.5
 --------------
 
@@ -55,10 +58,6 @@ Version 0.5.2
 This is mainly affecting operations where single numerical items from  pandas objects
 are selected and used for multiplication.
 
-**Breaking Changes**
-
-* The selection of a single item in `__getitem__` now returns a `Variable` instead of a `ScalarVariable`.
-
 Version 0.5.1
 --------------