Repository: Qiskit/qiskit-ibm-runtime
Pull request #797 (2023-04-11 15:10:11)

remove code deprecated after 0.7 release
### Summary
Removed deprecated code from estimator, sampler, and qiskit_runtime_service.


ChitsimranGill: Removed circuits, observables, and parameters args from sampler and estimator. Also, removed backend_name from runtime_options. 

Do we need to remove [auth](https://github.com/Qiskit/qiskit-ibm-runtime/blob/202d0219c67e327663777b971dbd74095cb35345/qiskit_ibm_runtime/qiskit_runtime_service.py#L161) arg from qiskit_runtime_service
kt474: > Do we need to remove [auth](https://github.com/Qiskit/qiskit-ibm-runtime/blob/202d0219c67e327663777b971dbd74095cb35345/qiskit_ibm_runtime/qiskit_runtime_service.py#L161) arg from qiskit_runtime_service?

Yeah we can remove the auth param - can you also add a release note that highlights all the removals 

coveralls: ## Pull Request Test Coverage Report for [Build 4734792908](https://coveralls.io/builds/59045040)

* **10** of **10**   **(100.0%)**  changed or added relevant lines in **2** files are covered.
* **31** unchanged lines in **2** files lost coverage.
* Overall coverage decreased (**-0.8%**) to **67.423%**

---


|  Files with Coverage Reduction | New Missed Lines | % |
| :-----|--------------|--: |
| [qiskit_ibm_runtime/utils/deprecation.py](https://coveralls.io/builds/59045040/source?filename=qiskit_ibm_runtime%2Futils%2Fdeprecation.py#L34) | 6 | 50.0% |
| [qiskit_ibm_runtime/runtime_session.py](https://coveralls.io/builds/59045040/source?filename=qiskit_ibm_runtime%2Fruntime_session.py#L13) | 25 | 0% |
<!-- | **Total:** | **31** |  | -->

|  Totals | [![Coverage Status](https://coveralls.io/builds/59045040/badge)](https://coveralls.io/builds/59045040) |
| :-- | --: |
| Change from base [Build 4692182682](https://coveralls.io/builds/58877940): |  -0.8% |
| Covered Lines: | 3357 |
| Relevant Lines: | 4979 |

---
##### 💛  - [Coveralls](https://coveralls.io)


Patch:
diff --git a/qiskit_ibm_runtime/estimator.py b/qiskit_ibm_runtime/estimator.py
index f09f5be8..7322a816 100644
--- a/qiskit_ibm_runtime/estimator.py
+++ b/qiskit_ibm_runtime/estimator.py
@@ -15,25 +15,18 @@
 from __future__ import annotations
 import os
 import copy
-from typing import Iterable, Optional, Dict, Sequence, Any, Union
+from typing import Optional, Dict, Sequence, Any, Union
 import logging
 from dataclasses import asdict
 
-from qiskit.circuit import QuantumCircuit, Parameter
-from qiskit.quantum_info import SparsePauliOp
+from qiskit.circuit import QuantumCircuit
 from qiskit.opflow import PauliSumOp
 from qiskit.quantum_info.operators.base_operator import BaseOperator
 from qiskit.providers.options import Options as TerraOptions
 from qiskit.primitives import BaseEstimator, EstimatorResult
 
 # TODO import _circuit_key from terra once 0.23 is released
-from .qiskit_runtime_service import QiskitRuntimeService
 from .runtime_job import RuntimeJob
-from .utils.deprecation import (
-    deprecate_arguments,
-    issue_deprecation_msg,
-    deprecate_function,
-)
 from .ibm_backend import IBMBackend
 from .session import get_default_session
 from .options import Options
@@ -99,32 +92,12 @@ class Estimator(BaseEstimator):
 
     def __init__(
         self,
-        circuits: Optional[Union[QuantumCircuit, Iterable[QuantumCircuit]]] = None,
-        observables: Optional[Iterable[SparsePauliOp]] = None,
-        parameters: Optional[Iterable[Iterable[Parameter]]] = None,
-        service: Optional[QiskitRuntimeService] = None,
         session: Optional[Union[Session, str, IBMBackend]] = None,
         options: Optional[Union[Dict, Options]] = None,
-        skip_transpilation: Optional[bool] = False,
     ):
         """Initializes the Estimator primitive.
 
         Args:
-            circuits: (DEPRECATED) A (parameterized) :class:`~qiskit.circuit.QuantumCircuit` or
-                a list of (parameterized) :class:`~qiskit.circuit.QuantumCircuit`.
-
-            observables: (DEPRECATED) A list of :class:`~qiskit.quantum_info.SparsePauliOp`
-
-            parameters: (DEPRECATED) A list of parameters of the quantum circuits.
-                (:class:`~qiskit.circuit.parametertable.ParameterView` or
-                a list of :class:`~qiskit.circuit.Parameter`) specifying the order
-                in which parameter values will be bound.
-
-            service: (DEPRECATED) Optional instance of
-                :class:`qiskit_ibm_runtime.QiskitRuntimeService` class,
-                defaults to `QiskitRuntimeService()` which tries to initialize your default
-                saved account.
-
             session: Session in which to call the primitive.
 
                 * If an instance of :class:`qiskit_ibm_runtime.IBMBackend` class or
@@ -138,30 +111,12 @@ class Estimator(BaseEstimator):
 
             options: Primitive options, see :class:`Options` for detailed description.
                 The ``backend`` keyword is still supported but is deprecated.
-
-            skip_transpilation: (DEPRECATED) Transpilation is skipped if set to True. False by default.
-                Ignored ``skip_transpilation`` is also specified in ``options``.
         """
         # `self._options` in this class is a Dict.
         # The base class, however, uses a `_run_options` which is an instance of
         # qiskit.providers.Options. We largely ignore this _run_options because we use
         # a nested dictionary to categorize options.
-        super().__init__(
-            circuits=circuits,
-            observables=observables,
-            parameters=parameters,
-        )
-
-        if skip_transpilation:
-            deprecate_arguments(
-                "skip_transpilation",
-                "0.7",
-                "Instead, use the skip_transpilation keyword argument in transpilation_settings.",
-            )
-        if service:
-            deprecate_arguments(
-                "service", "0.7", "Please use the session parameter instead."
-            )
+        super().__init__()
 
         backend = None
         self._session: Session = None
@@ -169,40 +124,17 @@ class Estimator(BaseEstimator):
         if options is None:
             self._options = asdict(Options())
         elif isinstance(options, Options):
-            skip_transpilation = (
-                options.transpilation.skip_transpilation  # type: ignore[union-attr]
-            )
             self._options = asdict(copy.deepcopy(options))
         else:
             options_copy = copy.deepcopy(options)
-            backend = options_copy.pop("backend", None)
-            if backend is not None:
-                issue_deprecation_msg(
-                    msg="The 'backend' key in 'options' has been deprecated",
-                    version="0.7",
-                    remedy="Please pass the backend when opening a session.",
-                )
             default_options = asdict(Options())
             self._options = Options._merge_options(default_options, options_copy)
-            skip_transpilation = self._options.get("transpilation", {}).get(
-                "skip_transpilation", False
-            )
-
-        self._options["transpilation"][
-            "skip_transpilation"
-        ] = skip_transpilation  # type: ignore[union-attr]
-
-        self._initial_inputs = {
-            "circuits": circuits,
-            "observables": observables,
-            "parameters": parameters,
-        }
 
         if isinstance(session, Session):
             self._session = session
         else:
             backend = session or backend
-            self._session = get_default_session(service, backend)
+            self._session = get_default_session(None, backend)
 
         # self._first_run = True
         # self._circuits_map = {}
@@ -386,17 +318,6 @@ class Estimator(BaseEstimator):
             result_decoder=DEFAULT_DECODERS.get(self._PROGRAM_ID),
         ).result()
 
-    @deprecate_function(
-        deprecated="close",
-        version="0.7",
-        remedy="Use qiskit_ibm_runtime.Session.close() instead",
-    )
-    def close(self) -> None:
-        """Close the session and free resources.
-        Close the session only if all jobs are finished
-        and you don't need to run more in the session."""
-        self._session.close()
-
     @property
     def session(self) -> Session:
         """Return session used by this primitive.
diff --git a/qiskit_ibm_runtime/qiskit_runtime_service.py b/qiskit_ibm_runtime/qiskit_runtime_service.py
index fbbde468..7d522b53 100644
--- a/qiskit_ibm_runtime/qiskit_runtime_service.py
+++ b/qiskit_ibm_runtime/qiskit_runtime_service.py
@@ -47,30 +47,17 @@ from .hub_group_project import HubGroupProject  # pylint: disable=cyclic-import
 from .program.result_decoder import ResultDecoder
 from .runtime_job import RuntimeJob
 from .runtime_program import RuntimeProgram, ParameterNamespace
-from .runtime_session import RuntimeSession  # pylint: disable=cyclic-import
 from .utils import RuntimeDecoder, to_base64_string, to_python_identifier
 from .utils.backend_decoder import configuration_from_server_data
 from .utils.hgp import to_instance_format, from_instance_format
 from .api.client_parameters import ClientParameters
 from .runtime_options import RuntimeOptions
 from .ibm_backend import IBMBackend
-from .utils.deprecation import (
-    deprecate_function,
-    deprecate_arguments,
-)
 
 logger = logging.getLogger(__name__)
 
 SERVICE_NAME = "runtime"
 
-DEPRECATED_PROGRAMS = [
-    "torch-train",
-    "torch-infer",
-    "sample-expval",
-    "quantum_kernal_alignment",
-    "sample-program",
-]
-
 
 class QiskitRuntimeService(Provider):
     """Class for interacting with the Qiskit Runtime service.
@@ -133,7 +120,6 @@ class QiskitRuntimeService(Provider):
     def __init__(
         self,
         channel: Optional[ChannelType] = None,
-        auth: Optional[AccountType] = None,
         token: Optional[str] = None,
         url: Optional[str] = None,
         filename: Optional[str] = None,
@@ -158,7 +144,6 @@ class QiskitRuntimeService(Provider):
 
         Args:
             channel: Channel type. ``ibm_cloud`` or ``ibm_quantum``.
-            auth: (DEPRECATED, use `channel` instead) Authentication type. ``cloud`` or ``legacy``.
             token: IBM Cloud API key or IBM Quantum API token.
             url: The API URL.
                 Defaults to https://cloud.ibm.com (ibm_cloud) or
@@ -184,15 +169,11 @@ class QiskitRuntimeService(Provider):
         """
         super().__init__()
 
-        if auth:
-            self._auth_warning()
-
         self._account = self._discover_account(
             token=token,
             url=url,
             instance=instance,
             channel=channel,
-            auth=auth,
             filename=filename,
             name=name,
             proxies=ProxyConfiguration(**proxies) if proxies else None,
@@ -236,17 +217,6 @@ class QiskitRuntimeService(Provider):
         # just seems wrong since backends are not runtime service instances.
         # self._discover_backends()
 
-    @staticmethod
-    def _auth_warning() -> None:
-        warnings.warn(
-            "Use of `auth` parameter is deprecated and will "
-            "be removed in a future release. "
-            "You can now use channel='ibm_cloud' or "
-            "channel='ibm_quantum' instead.",
-            DeprecationWarning,
-            stacklevel=3,
-        )
-
     def _discover_account(
         self,
         token: Optional[str] = None,
@@ -690,7 +660,6 @@ class QiskitRuntimeService(Provider):
     def delete_account(
         filename: Optional[str] = None,
         name: Optional[str] = None,
-        auth: Optional[str] = None,
         channel: Optional[ChannelType] = None,
     ) -> bool:
         """Delete a saved account from disk.
@@ -698,8 +667,6 @@ class QiskitRuntimeService(Provider):
         Args:
             filename: Name of file from which to delete the account.
             name: Name of the saved account to delete.
-            auth: (DEPRECATED, use `channel` instead) Authentication type of the default
-                account to delete. Ignored if account name is provided.
             channel: Channel type of the default account to delete.
                 Ignored if account name is provided.
 
@@ -707,10 +674,6 @@ class QiskitRuntimeService(Provider):
             True if the account was deleted.
             False if no account was found.
         """
-        if auth:
-            QiskitRuntimeService._auth_warning()
-            channel = channel or QiskitRuntimeService._get_channel_for_auth(auth=auth)
-
         return AccountManager.delete(filename=filename, name=name, channel=channel)
 
     @staticmethod
@@ -726,7 +689,6 @@ class QiskitRuntimeService(Provider):
         url: Optional[str] = None,
         instance: Optional[str] = None,
         channel: Optional[ChannelType] = None,
-        auth: Optional[AccountType] = None,
         filename: Optional[str] = None,
         name: Optional[str] = None,
         proxies: Optional[dict] = None,
@@ -742,7 +704,6 @@ class QiskitRuntimeService(Provider):
                 https://auth.quantum-computing.ibm.com/api (ibm_quantum).
             instance: The CRN (ibm_cloud) or hub/group/project (ibm_quantum).
             channel: Channel type. `ibm_cloud` or `ibm_quantum`.
-            auth: (DEPRECATED, use `channel` instead) Authentication type. `cloud` or `legacy`.
             filename: Full path of the file where the account is saved.
             name: Name of the account to save.
             proxies: Proxy configuration. Supported optional keys are
@@ -753,9 +714,6 @@ class QiskitRuntimeService(Provider):
             verify: Verify the server's TLS certificate.
             overwrite: ``True`` if the existing account is to be overwritten.
         """
-        if auth:
-            QiskitRuntimeService._auth_warning()
-            channel = channel or QiskitRuntimeService._get_channel_for_auth(auth)
 
         AccountManager.save(
             token=token,
@@ -772,7 +730,6 @@ class QiskitRuntimeService(Provider):
     @staticmethod
     def saved_accounts(
         default: Optional[bool] = None,
-        auth: Optional[str] = None,
         channel: Optional[ChannelType] = None,
         filename: Optional[str] = None,
         name: Optional[str] = None,
@@ -781,8 +738,6 @@ class QiskitRuntimeService(Provider):
 
         Args:
             default: If set to True, only default accounts are returned.
-            auth: (DEPRECATED, use `channel` instead) If set, only accounts with the given
-                authentication type are returned.
             channel: Channel type. `ibm_cloud` or `ibm_quantum`.
             filename: Name of file whose accounts are returned.
             name: If set, only accounts with the given name are returned.
@@ -793,9 +748,6 @@ class QiskitRuntimeService(Provider):
         Raises:
             ValueError: If an invalid account is found on disk.
         """
-        if auth:
-            QiskitRuntimeService._auth_warning()
-            channel = channel or QiskitRuntimeService._get_channel_for_auth(auth)
         return dict(
             map(
                 lambda kv: (kv[0], Account.to_saved_format(kv[1])),
@@ -993,10 +945,7 @@ class QiskitRuntimeService(Provider):
         result_decoder: Optional[
             Union[Type[ResultDecoder], Sequence[Type[ResultDecoder]]]
         ] = None,
-        instance: Optional[str] = None,
         session_id: Optional[str] = None,
-        job_tags: Optional[List[str]] = None,
-        max_execution_time: Optional[int] = None,
         start_session: Optional[bool] = False,
     ) -> RuntimeJob:
         """Execute the runtime program.
@@ -1018,13 +967,7 @@ class QiskitRuntimeService(Provider):
                 If more than one decoder is specified, the first is used for interim results and
                 the second final results. If not specified, a program-specific decoder or the default
                 ``ResultDecoder`` is used.
-            instance: (DEPRECATED) This is only supported for ``ibm_quantum`` runtime and is in the
-                hub/group/project format.
             session_id: Job ID of the first job in a runtime session.
-            job_tags: (DEPRECATED) Tags to be assigned to the job. The tags can subsequently be used
-                as a filter in the :meth:`jobs()` function call.
-            max_execution_time: (DEPRECATED) Maximum execution time in seconds. This overrides
-                the max_execution_time of the program.
             start_session: Set to True to explicitly start a runtime session. Defaults to False.
 
         Returns:
@@ -1035,13 +978,6 @@ class QiskitRuntimeService(Provider):
             RuntimeProgramNotFound: If the program cannot be found.
             IBMRuntimeError: An error occurred running the program.
         """
-        if program_id in DEPRECATED_PROGRAMS:
-            warnings.warn(
-                f"The {program_id} program has been deprecated as of qiskit-ibm-runtime 0.7 \
-                and will be removed no sooner than 1 month after the release date.",
-                DeprecationWarning,
-                stacklevel=2,
-            )
 
         qrt_options: RuntimeOptions = options
         if options is None:
@@ -1049,20 +985,6 @@ class QiskitRuntimeService(Provider):
         elif isinstance(options, Dict):
             qrt_options = RuntimeOptions(**options)
 
-        deprecated = {
-            "instance": instance,
-            "job_tags": job_tags,
-            "max_execution_time": max_execution_time,
-        }
-        for name, param in deprecated.items():
-            if param is not None:
-                deprecate_arguments(
-                    deprecated=name,
-                    version="0.7",
-                    remedy=f'Please specify "{name}" inside "options".',
-                )
-                setattr(qrt_options, name, param)
-
         # If using params object, extract as dictionary
         if isinstance(inputs, ParameterNamespace):
             inputs.validate()
@@ -1115,33 +1037,6 @@ class QiskitRuntimeService(Provider):
         )
         return job
 
-    @deprecate_function(
-        "QiskitRuntimeService.open",
-        "0.7",
-        "Instead, use the qiskit_ibm_runtime.Session class to create a runtime session.",
-    )
-    def open(
-        self,
-        program_id: str,
-        inputs: Union[Dict, ParameterNamespace],
-        options: Optional[Union[RuntimeOptions, Dict]] = None,
-    ) -> RuntimeSession:
-        """Open a new runtime session.
-
-        Args:
-            program_id: Program ID.
-            inputs: Initial program input parameters. These input values are
-                persistent throughout the session.
-            options: Runtime options that control the execution environment. See
-                :class:`RuntimeOptions` for all available options.
-
-        Returns:
-            Runtime session.
-        """
-        return RuntimeSession(
-            service=self, program_id=program_id, inputs=inputs, options=options
-        )
-
     def upload_program(
         self, data: str, metadata: Optional[Union[Dict, str]] = None
     ) -> str:
@@ -1611,7 +1506,6 @@ class QiskitRuntimeService(Provider):
         Returns:
             The authentication type used.
         """
-        self._auth_warning()
         return "cloud" if self._channel == "ibm_cloud" else "legacy"
 
     @property
diff --git a/qiskit_ibm_runtime/runtime_options.py b/qiskit_ibm_runtime/runtime_options.py
index 13030939..7a874707 100644
--- a/qiskit_ibm_runtime/runtime_options.py
+++ b/qiskit_ibm_runtime/runtime_options.py
@@ -17,10 +17,7 @@ import logging
 from dataclasses import dataclass
 from typing import Optional, List
 
-from qiskit.utils.deprecation import deprecate_arguments
-
 from .exceptions import IBMInputValueError
-from .utils.deprecation import issue_deprecation_msg
 from .utils.utils import validate_job_tags
 
 
@@ -36,7 +33,6 @@ class RuntimeOptions:
     max_execution_time: Optional[int] = None
     session_time: Optional[int] = None
 
-    @deprecate_arguments({"backend_name": "backend"})
     def __init__(
         self,
         backend: Optional[str] = None,
@@ -109,26 +105,3 @@ class RuntimeOptions:
 
         if self.job_tags:
             validate_job_tags(self.job_tags, IBMInputValueError)
-
-    @property
-    def backend_name(self) -> str:
-        """Return backend.
-
-        Returns:
-            Backend name.
-        """
-        return self.backend
-
-    @backend_name.setter
-    def backend_name(self, name: str) -> None:
-        """Set backend name.
-
-        Args:
-            name: Backend to use.
-        """
-        issue_deprecation_msg(
-            msg="The 'backend_name' attribute is deprecated",
-            version="0.7",
-            remedy="Please use 'backend' instead.",
-        )
-        self._backend = name
diff --git a/qiskit_ibm_runtime/sampler.py b/qiskit_ibm_runtime/sampler.py
index 2a3bd8ac..372e01a7 100644
--- a/qiskit_ibm_runtime/sampler.py
+++ b/qiskit_ibm_runtime/sampler.py
@@ -14,27 +14,21 @@
 
 from __future__ import annotations
 import os
-from typing import Dict, Iterable, Optional, Sequence, Any, Union
+from typing import Dict, Optional, Sequence, Any, Union
 import copy
 import logging
 from dataclasses import asdict
 
-from qiskit.circuit import QuantumCircuit, Parameter
+from qiskit.circuit import QuantumCircuit
 from qiskit.providers.options import Options as TerraOptions
 from qiskit.primitives import BaseSampler, SamplerResult
 
 # TODO import _circuit_key from terra once 0.23 released
-from .qiskit_runtime_service import QiskitRuntimeService
 from .options import Options
 from .options.utils import set_default_error_levels
 from .runtime_job import RuntimeJob
 from .ibm_backend import IBMBackend
 from .session import get_default_session
-from .utils.deprecation import (
-    deprecate_arguments,
-    issue_deprecation_msg,
-    deprecate_function,
-)
 from .constants import DEFAULT_DECODERS
 
 # pylint: disable=unused-import,cyclic-import
@@ -78,28 +72,12 @@ class Sampler(BaseSampler):
 
     def __init__(
         self,
-        circuits: Optional[Union[QuantumCircuit, Iterable[QuantumCircuit]]] = None,
-        parameters: Optional[Iterable[Iterable[Parameter]]] = None,
-        service: Optional[QiskitRuntimeService] = None,
         session: Optional[Union[Session, str, IBMBackend]] = None,
         options: Optional[Union[Dict, Options]] = None,
-        skip_transpilation: Optional[bool] = False,
     ):
         """Initializes the Sampler primitive.
 
         Args:
-            circuits: (DEPRECATED) A (parameterized) :class:`~qiskit.circuit.QuantumCircuit` or
-                a list of (parameterized) :class:`~qiskit.circuit.QuantumCircuit`.
-
-            parameters: (DEPRECATED) A list of parameters of the quantum circuits
-                (:class:`~qiskit.circuit.parametertable.ParameterView` or
-                a list of :class:`~qiskit.circuit.Parameter`)
-
-            service: (DEPRECATED) Optional instance of
-                :class:`qiskit_ibm_runtime.QiskitRuntimeService` class,
-                defaults to `QiskitRuntimeService()` which tries to initialize your default
-                saved account.
-
             session: Session in which to call the primitive.
 
                 * If an instance of :class:`qiskit_ibm_runtime.IBMBackend` class or
@@ -113,30 +91,13 @@ class Sampler(BaseSampler):
 
             options: Primitive options, see :class:`Options` for detailed description.
                 The ``backend`` keyword is still supported but is deprecated.
-
-            skip_transpilation (DEPRECATED): Transpilation is skipped if set to True. False by default.
-                Ignored if ``skip_transpilation`` is also specified in ``options``.
         """
         # `self._options` in this class is a Dict.
         # The base class, however, uses a `_run_options` which is an instance of
         # qiskit.providers.Options. We largely ignore this _run_options because we use
         # a nested dictionary to categorize options.
 
-        super().__init__(
-            circuits=circuits,
-            parameters=parameters,
-        )
-
-        if skip_transpilation:
-            deprecate_arguments(
-                "skip_transpilation",
-                "0.7",
-                "Instead, use the skip_transpilation keyword argument in transpilation_settings.",
-            )
-        if service:
-            deprecate_arguments(
-                "service", "0.7", "Please use the session parameter instead."
-            )
+        super().__init__()
 
         backend = None
         self._session: Session = None
@@ -144,35 +105,17 @@ class Sampler(BaseSampler):
         if options is None:
             self._options = asdict(Options())
         elif isinstance(options, Options):
-            skip_transpilation = (
-                options.transpilation.skip_transpilation  # type: ignore[union-attr]
-            )
             self._options = asdict(copy.deepcopy(options))
         else:
             options_copy = copy.deepcopy(options)
-            backend = options_copy.pop("backend", None)
-            if backend is not None:
-                issue_deprecation_msg(
-                    msg="The 'backend' key in 'options' has been deprecated",
-                    version="0.7",
-                    remedy="Please pass the backend when opening a session.",
-                )
             default_options = asdict(Options())
             self._options = Options._merge_options(default_options, options_copy)
-            skip_transpilation = self._options.get("transpilation", {}).get(
-                "skip_transpilation", False
-            )
-        self._options["transpilation"][
-            "skip_transpilation"
-        ] = skip_transpilation  # type: ignore[union-attr]
-
-        self._initial_inputs = {"circuits": circuits, "parameters": parameters}
 
         if isinstance(session, Session):
             self._session = session
         else:
             backend = session or backend
-            self._session = get_default_session(service, backend)
+            self._session = get_default_session(None, backend)
 
         # self._first_run = True
         # self._circuits_map = {}
@@ -337,16 +280,6 @@ class Sampler(BaseSampler):
 
         return raw_result
 
-    @deprecate_function(
-        deprecated="close",
-        version="0.7",
-        remedy="Use qiskit_ibm_runtime.Session.close() instead",
-    )
-    def close(self) -> None:
-        """Close the session and free resources.
-        Close the session only if all jobs are finished and you don't need to run more in the session."""
-        self._session.close()
-
     @property
     def session(self) -> Session:
         """Return session used by this primitive.
diff --git a/releasenotes/notes/remove-depreacted-f9abe2c7a47c3062.yaml b/releasenotes/notes/remove-depreacted-f9abe2c7a47c3062.yaml
new file mode 100644
index 00000000..335b040d
--- /dev/null
+++ b/releasenotes/notes/remove-depreacted-f9abe2c7a47c3062.yaml
@@ -0,0 +1,16 @@
+---
+deprecations:
+  - |
+    The deprecated arguments ``circuits``, ``parameters``, ``service``, and
+    ``skip_transpilation`` have been removed from :class:`~qiskit_ibm_runtime.Sampler`. 
+
+    Similarly, the deprecated arguments ``circuits``, ``observables``, ``parameters``, ``service``, and
+    ``skip_transpilation`` have been removed from :class:`~qiskit_ibm_runtime.Estimator`. 
+
+    In :class:`~qiskit_ibm_runtime.QiskitRuntimeService`, the ``auth`` parameter has been removed. Additionally, 
+    the ``instance``, ``job_tags``, and ``max_execution_time`` paramters have been removed from 
+    :meth:`qiskit_ibm_runtime.QiskitRuntimeService.run`. They can be passed in through 
+    :class:`~qiskit_ibm_runtime.RuntimeOptions` instead.
+
+    Within :class:`~qiskit_ibm_runtime.RuntimeOptions`, ``backend_name`` is no longer supported. Please use
+    ``backend`` instead.


Test patch:
diff --git a/test/integration/test_estimator.py b/test/integration/test_estimator.py
index edfb4f4c..00a91881 100644
--- a/test/integration/test_estimator.py
+++ b/test/integration/test_estimator.py
@@ -203,73 +203,6 @@ class TestIntegrationEstimator(IBMIntegrationTestCase):
                 job.result()
             session.close()
 
-    @run_integration_test
-    def test_estimator_primitive(self, service):
-        """Test to verify that estimator as a primitive still works."""
-
-        options = {
-            "backend": self.backend,
-            "optimization_level": 1,
-            "resilience_level": 0,
-        }
-
-        psi1 = RealAmplitudes(num_qubits=2, reps=2)
-        psi2 = RealAmplitudes(num_qubits=2, reps=3)
-
-        # pylint: disable=invalid-name
-        H1 = SparsePauliOp.from_list([("II", 1), ("IZ", 2), ("XI", 3)])
-        H2 = SparsePauliOp.from_list([("IZ", 1)])
-        H3 = SparsePauliOp.from_list([("ZI", 1), ("ZZ", 1)])
-
-        with Estimator(
-            circuits=[psi1, psi2],
-            observables=[H1, H2, H3],
-            service=service,
-            options=options,
-        ) as estimator:
-            self.assertIsInstance(estimator, BaseEstimator)
-
-            theta1 = [0, 1, 1, 2, 3, 5]
-            theta2 = [0, 1, 1, 2, 3, 5, 8, 13]
-            theta3 = [1, 2, 3, 4, 5, 6]
-
-            circuits1 = [0]
-            # calculate [ <psi1(theta1)|H1|psi1(theta1)> ]
-            result1 = estimator(circuits1, [0], [theta1])
-            self.assertIsInstance(result1, EstimatorResult)
-            self.assertEqual(len(result1.values), len(circuits1))
-            self.assertEqual(len(result1.metadata), len(circuits1))
-
-            circuits2 = [0, 0]
-            # calculate [ <psi1(theta1)|H2|psi1(theta1)>, <psi1(theta1)|H3|psi1(theta1)> ]
-            result2 = estimator(circuits2, [1, 2], [theta1] * 2)
-            self.assertIsInstance(result2, EstimatorResult)
-            self.assertEqual(len(result2.values), len(circuits2))
-            self.assertEqual(len(result2.metadata), len(circuits2))
-
-            circuits3 = [psi2]
-            # calculate [ <psi2(theta2)|H2|psi2(theta2)> ]
-            result3 = estimator(circuits3, [H2], [theta2])
-            self.assertIsInstance(result3, EstimatorResult)
-            self.assertEqual(len(result3.values), len(circuits3))
-            self.assertEqual(len(result3.metadata), len(circuits3))
-
-            circuits4 = [psi1, psi1]
-            # calculate [ <psi1(theta1)|H1|psi1(theta1)>, <psi1(theta3)|H1|psi1(theta3)> ]
-            result4 = estimator(circuits4, [H1, H1], [theta1, theta3])
-            self.assertIsInstance(result4, EstimatorResult)
-            self.assertEqual(len(result4.values), len(circuits4))
-            self.assertEqual(len(result4.metadata), len(circuits4))
-
-            circuits5 = [psi1, psi2, psi1]
-            # calculate [ <psi1(theta1)|H1|psi1(theta1)>,
-            #             <psi2(theta2)|H2|psi2(theta2)>,
-            #             <psi1(theta3)|H3|psi1(theta3)> ]
-            result5 = estimator(circuits5, [0, 1, 2], [theta1, theta2, theta3])
-            self.assertIsInstance(result5, EstimatorResult)
-            self.assertEqual(len(result5.values), len(circuits5))
-            self.assertEqual(len(result5.metadata), len(circuits5))
-
     @run_integration_test
     def test_estimator_callback(self, service):
         """Test Estimator callback function."""
diff --git a/test/integration/test_sampler.py b/test/integration/test_sampler.py
index 81879237..2edc7634 100644
--- a/test/integration/test_sampler.py
+++ b/test/integration/test_sampler.py
@@ -36,24 +36,6 @@ class TestIntegrationIBMSampler(IBMIntegrationTestCase):
         self.bell = ReferenceCircuits.bell()
         self.backend = "ibmq_qasm_simulator"
 
-    @run_integration_test
-    def test_sampler_non_parameterized_single_circuit(self, service):
-        """Verify if sampler primitive returns expected results for non-parameterized circuits."""
-
-        # Execute a Bell circuit
-        with Session(service, self.backend) as session:
-            sampler = Sampler(session=session)
-            self.assertIsInstance(sampler, BaseSampler)
-            job = sampler.run(circuits=self.bell)
-            result = job.result()
-            self.assertIsInstance(result, SamplerResult)
-            self.assertEqual(len(result.quasi_dists), 1)
-            self.assertEqual(len(result.metadata), 1)
-            self.assertAlmostEqual(result.quasi_dists[0][3], 0.5, delta=0.1)
-            self.assertAlmostEqual(result.quasi_dists[0][0], 0.5, delta=0.1)
-            self.assertTrue(session.session_id)
-            session.close()
-
     @run_integration_test
     def test_sampler_non_parameterized_circuits(self, service):
         """Test sampler with multiple non-parameterized circuits."""
@@ -230,36 +212,6 @@ class TestIntegrationIBMSampler(IBMIntegrationTestCase):
             self.assertAlmostEqual(result.quasi_dists[0][0], 0.5, delta=0.1)
             session.close()
 
-    @run_integration_test
-    def test_sampler_primitive_as_session(self, service):
-        """Verify Sampler as a session still works."""
-
-        # parameterized circuit
-        pqc = RealAmplitudes(num_qubits=2, reps=2)
-        pqc.measure_all()
-        pqc2 = RealAmplitudes(num_qubits=2, reps=3)
-        pqc2.measure_all()
-
-        theta1 = [0, 1, 1, 2, 3, 5]
-        theta2 = [1, 2, 3, 4, 5, 6]
-        theta3 = [0, 1, 2, 3, 4, 5, 6, 7]
-
-        with Sampler(
-            circuits=[pqc, pqc2],
-            service=service,
-            options={"backend": "ibmq_qasm_simulator", "optimization_level": 1},
-        ) as sampler:
-            self.assertIsInstance(sampler, BaseSampler)
-
-            circuits0 = [pqc, pqc, pqc2]
-            result = sampler(
-                circuits=circuits0,
-                parameter_values=[theta1, theta2, theta3],
-            )
-            self.assertIsInstance(result, SamplerResult)
-            self.assertEqual(len(result.quasi_dists), len(circuits0))
-            self.assertEqual(len(result.metadata), len(circuits0))
-
     @run_integration_test
     def test_sampler_callback(self, service):
         """Test Sampler callback function."""
diff --git a/test/unit/test_ibm_primitives.py b/test/unit/test_ibm_primitives.py
index 0adbc34a..e11821c5 100644
--- a/test/unit/test_ibm_primitives.py
+++ b/test/unit/test_ibm_primitives.py
@@ -70,32 +70,6 @@ class TestPrimitives(IBMTestCase):
         super().tearDown()
         session_pkg._DEFAULT_SESSION.set(None)
 
-    def test_skip_transpilation(self):
-        """Test skip_transpilation is hornored."""
-        primitives = [Sampler, Estimator]
-        for cls in primitives:
-            with self.subTest(primitive=cls):
-                inst = cls(session=MagicMock(spec=MockSession), skip_transpilation=True)
-                self.assertTrue(
-                    inst.options.get("transpilation").get("skip_transpilation")
-                )
-
-    def test_skip_transpilation_overwrite(self):
-        """Test overwriting skip_transpilation."""
-        options = Options()
-        options.transpilation.skip_transpilation = False
-        primitives = [Sampler, Estimator]
-        for cls in primitives:
-            with self.subTest(primitive=cls):
-                inst = cls(
-                    session=MagicMock(spec=MockSession),
-                    options=options,
-                    skip_transpilation=True,
-                )
-                self.assertFalse(
-                    inst.options.get("transpilation").get("skip_transpilation")
-                )
-
     def test_dict_options(self):
         """Test passing a dictionary as options."""
         options_vars = [
@@ -131,35 +105,13 @@ class TestPrimitives(IBMTestCase):
                     options = {"backend": backend}
                     with warnings.catch_warnings(record=True) as warn:
                         warnings.simplefilter("always")
-                        inst = cls(service=MagicMock(), options=options)
-                        # We'll get 2 deprecation warnings - one for service and one for backend.
-                        # We need service otherwise backend will get ignored.
-                        self.assertEqual(len(warn), 2)
+                        cls(session=MagicMock(spec=MockSession), options=options)
                         self.assertTrue(
                             all(
                                 issubclass(one_warn.category, DeprecationWarning)
                                 for one_warn in warn
                             )
                         )
-                    self.assertEqual(inst.session.backend(), backend_name)
-
-    def test_old_options(self):
-        """Test specifying old runtime options."""
-        primitives = [Sampler, Estimator]
-        session = MagicMock(spec=MockSession)
-        options = [{"log_level": "WARNING"}, {"image": "foo:bar"}]
-
-        for cls in primitives:
-            for opt in options:
-                with self.subTest(primitive=cls, options=opt):
-                    inst = cls(session=session, options=opt)
-                    inst.run(self.qx, observables=self.obs)
-                    _, kwargs = session.run.call_args
-                    run_options = kwargs["options"]
-                    for key, val in opt.items():
-                        self.assertEqual(run_options[key], val)
-                    inputs = kwargs["inputs"]
-                    self.assertTrue(all(key not in inputs.keys() for key in opt))
 
     def test_runtime_options(self):
         """Test RuntimeOptions specified as primitive options."""
@@ -211,12 +163,10 @@ class TestPrimitives(IBMTestCase):
 
     def test_default_session_after_close(self):
         """Test a new default session is open after previous is closed."""
-        service = MagicMock()
-        sampler = Sampler(service=service)
+        sampler = Sampler(session=MagicMock(spec=MockSession))
         sampler.session.close()
-        estimator = Estimator(service=service)
+        estimator = Estimator(session=MagicMock(spec=MockSession))
         self.assertIsNotNone(estimator.session)
-        self.assertTrue(estimator.session._active)
         self.assertNotEqual(estimator.session, sampler.session)
 
     @patch("qiskit_ibm_runtime.session.Session")