22
33from __future__ import annotations
44
5- import warnings
65from dataclasses import replace
76from typing import TYPE_CHECKING , Any , cast
87
@@ -490,15 +489,11 @@ def create_index(
490489 vector_type : VectorType | str = "dense" ,
491490 tags : dict [str , str ] | None = None ,
492491 ) -> IndexModel :
493- """Backwards-compatibility delegate. See :meth:`Pinecone.indexes.create`.
492+ """Backwards-compatibility shim for :meth:`Pinecone.indexes.create`.
494493
495- :meta private:
494+ Preserved to ease migration from the legacy Pinecone Python SDK. New code
495+ should use ``pc.indexes.create()`` instead of ``pc.create_index()``.
496496 """
497- warnings .warn (
498- "Pinecone.create_index() is deprecated; use pc.indexes.create() instead." ,
499- DeprecationWarning ,
500- stacklevel = 2 ,
501- )
502497 resolved_dp = deletion_protection if deletion_protection is not None else "disabled"
503498 return self .indexes .create (
504499 name = name ,
@@ -523,16 +518,13 @@ def create_index_for_model(
523518 schema : dict [str , Any ] | None = None ,
524519 timeout : int | None = None ,
525520 ) -> IndexModel :
526- """Backwards-compatibility delegate for creating an integrated (model-backed) index.
521+ """Backwards-compatibility shim for creating an integrated (model-backed) index.
527522
528- :meta private:
523+ Preserved to ease migration from the legacy Pinecone Python SDK. New
524+ code should use ``pc.indexes.create()`` with an ``IntegratedSpec``
525+ (``IntegratedSpec(cloud=..., region=..., embed=EmbedConfig(...))``)
526+ instead of ``pc.create_index_for_model()``.
529527 """
530- warnings .warn (
531- "Pinecone.create_index_for_model() is deprecated;"
532- " use pc.indexes.create() with IntegratedSpec instead." ,
533- DeprecationWarning ,
534- stacklevel = 2 ,
535- )
536528 from pinecone .inference .models .index_embed import IndexEmbed as _IndexEmbed
537529 from pinecone .models .indexes .specs import EmbedConfig as _EmbedConfig
538530 from pinecone .models .indexes .specs import IntegratedSpec as _IntegratedSpec
@@ -564,39 +556,27 @@ def create_index_for_model(
564556 )
565557
566558 def describe_index (self , name : str ) -> IndexModel :
567- """Backwards-compatibility delegate. See :meth:`Pinecone.indexes.describe`.
559+ """Backwards-compatibility shim for :meth:`Pinecone.indexes.describe`.
568560
569- :meta private:
561+ Preserved to ease migration from the legacy Pinecone Python SDK. New code
562+ should use ``pc.indexes.describe()`` instead of ``pc.describe_index()``.
570563 """
571- warnings .warn (
572- "Pinecone.describe_index() is deprecated; use pc.indexes.describe() instead." ,
573- DeprecationWarning ,
574- stacklevel = 2 ,
575- )
576564 return self .indexes .describe (name )
577565
578566 def list_indexes (self ) -> IndexList :
579- """Backwards-compatibility delegate. See :meth:`Pinecone.indexes.list`.
567+ """Backwards-compatibility shim for :meth:`Pinecone.indexes.list`.
580568
581- :meta private:
569+ Preserved to ease migration from the legacy Pinecone Python SDK. New
570+ code should use ``pc.indexes.list()`` instead of ``pc.list_indexes()``.
582571 """
583- warnings .warn (
584- "Pinecone.list_indexes() is deprecated; use pc.indexes.list() instead." ,
585- DeprecationWarning ,
586- stacklevel = 2 ,
587- )
588572 return self .indexes .list ()
589573
590574 def has_index (self , name : str ) -> bool :
591- """Backwards-compatibility delegate. See :meth:`Pinecone.indexes.exists`.
575+ """Backwards-compatibility shim for :meth:`Pinecone.indexes.exists`.
592576
593- :meta private:
577+ Preserved to ease migration from the legacy Pinecone Python SDK. New code
578+ should use ``pc.indexes.exists()`` instead of ``pc.has_index()``.
594579 """
595- warnings .warn (
596- "Pinecone.has_index() is deprecated; use pc.indexes.exists() instead." ,
597- DeprecationWarning ,
598- stacklevel = 2 ,
599- )
600580 return self .indexes .exists (name )
601581
602582 def configure_index (
@@ -609,15 +589,11 @@ def configure_index(
609589 embed : dict [str , Any ] | None = None ,
610590 read_capacity : dict [str , Any ] | None = None ,
611591 ) -> None :
612- """Backwards-compatibility delegate. See :meth:`Pinecone.indexes.configure`.
592+ """Backwards-compatibility shim for :meth:`Pinecone.indexes.configure`.
613593
614- :meta private:
594+ Preserved to ease migration from the legacy Pinecone Python SDK. New code
595+ should use ``pc.indexes.configure()`` instead of ``pc.configure_index()``.
615596 """
616- warnings .warn (
617- "Pinecone.configure_index() is deprecated; use pc.indexes.configure() instead." ,
618- DeprecationWarning ,
619- stacklevel = 2 ,
620- )
621597 self .indexes .configure (
622598 name = name ,
623599 replicas = replicas ,
@@ -629,63 +605,43 @@ def configure_index(
629605 )
630606
631607 def delete_index (self , name : str , timeout : int | None = None ) -> None :
632- """Backwards-compatibility delegate. See :meth:`Pinecone.indexes.delete`.
608+ """Backwards-compatibility shim for :meth:`Pinecone.indexes.delete`.
633609
634- :meta private:
610+ Preserved to ease migration from the legacy Pinecone Python SDK. New code
611+ should use ``pc.indexes.delete()`` instead of ``pc.delete_index()``.
635612 """
636- warnings .warn (
637- "Pinecone.delete_index() is deprecated; use pc.indexes.delete() instead." ,
638- DeprecationWarning ,
639- stacklevel = 2 ,
640- )
641613 self .indexes .delete (name , timeout = timeout )
642614
643615 def create_collection (self , name : str , source : str ) -> CollectionModel :
644- """Backwards-compatibility delegate. See :meth:`Pinecone.collections.create`.
616+ """Backwards-compatibility shim for :meth:`Pinecone.collections.create`.
645617
646- :meta private:
618+ Preserved to ease migration from the legacy Pinecone Python SDK. New code
619+ should use ``pc.collections.create()`` instead of ``pc.create_collection()``.
647620 """
648- warnings .warn (
649- "Pinecone.create_collection() is deprecated; use pc.collections.create() instead." ,
650- DeprecationWarning ,
651- stacklevel = 2 ,
652- )
653621 return self .collections .create (name = name , source = source )
654622
655623 def list_collections (self ) -> CollectionList :
656- """Backwards-compatibility delegate. See :meth:`Pinecone.collections.list`.
624+ """Backwards-compatibility shim for :meth:`Pinecone.collections.list`.
657625
658- :meta private:
626+ Preserved to ease migration from the legacy Pinecone Python SDK. New code
627+ should use ``pc.collections.list()`` instead of ``pc.list_collections()``.
659628 """
660- warnings .warn (
661- "Pinecone.list_collections() is deprecated; use pc.collections.list() instead." ,
662- DeprecationWarning ,
663- stacklevel = 2 ,
664- )
665629 return self .collections .list ()
666630
667631 def describe_collection (self , name : str ) -> CollectionModel :
668- """Backwards-compatibility delegate. See :meth:`Pinecone.collections.describe`.
632+ """Backwards-compatibility shim for :meth:`Pinecone.collections.describe`.
669633
670- :meta private:
634+ Preserved to ease migration from the legacy Pinecone Python SDK. New code
635+ should use ``pc.collections.describe()`` instead of ``pc.describe_collection()``.
671636 """
672- warnings .warn (
673- "Pinecone.describe_collection() is deprecated; use pc.collections.describe() instead." ,
674- DeprecationWarning ,
675- stacklevel = 2 ,
676- )
677637 return self .collections .describe (name )
678638
679639 def delete_collection (self , name : str ) -> None :
680- """Backwards-compatibility delegate. See :meth:`Pinecone.collections.delete`.
640+ """Backwards-compatibility shim for :meth:`Pinecone.collections.delete`.
681641
682- :meta private:
642+ Preserved to ease migration from the legacy Pinecone Python SDK. New code
643+ should use ``pc.collections.delete()`` instead of ``pc.delete_collection()``.
683644 """
684- warnings .warn (
685- "Pinecone.delete_collection() is deprecated; use pc.collections.delete() instead." ,
686- DeprecationWarning ,
687- stacklevel = 2 ,
688- )
689645 self .collections .delete (name )
690646
691647 def create_backup (
@@ -695,15 +651,11 @@ def create_backup(
695651 backup_name : str | None = None ,
696652 description : str = "" ,
697653 ) -> BackupModel :
698- """Backwards-compatibility delegate. See :meth:`Pinecone.backups.create`.
654+ """Backwards-compatibility shim for :meth:`Pinecone.backups.create`.
699655
700- :meta private:
656+ Preserved to ease migration from the legacy Pinecone Python SDK. New code
657+ should use ``pc.backups.create()`` instead of ``pc.create_backup()``.
701658 """
702- warnings .warn (
703- "Pinecone.create_backup() is deprecated; use pc.backups.create() instead." ,
704- DeprecationWarning ,
705- stacklevel = 2 ,
706- )
707659 return self .backups .create (
708660 index_name = index_name ,
709661 name = backup_name ,
@@ -717,43 +669,31 @@ def list_backups(
717669 limit : int | None = 10 ,
718670 pagination_token : str | None = None ,
719671 ) -> BackupList :
720- """Backwards-compatibility delegate. See :meth:`Pinecone.backups.list`.
672+ """Backwards-compatibility shim for :meth:`Pinecone.backups.list`.
721673
722- :meta private:
674+ Preserved to ease migration from the legacy Pinecone Python SDK. New code
675+ should use ``pc.backups.list()`` instead of ``pc.list_backups()``.
723676 """
724- warnings .warn (
725- "Pinecone.list_backups() is deprecated; use pc.backups.list() instead." ,
726- DeprecationWarning ,
727- stacklevel = 2 ,
728- )
729677 return self .backups .list (
730678 index_name = index_name ,
731679 limit = limit if limit is not None else 10 ,
732680 pagination_token = pagination_token ,
733681 )
734682
735683 def describe_backup (self , * , backup_id : str ) -> BackupModel :
736- """Backwards-compatibility delegate. See :meth:`Pinecone.backups.describe`.
684+ """Backwards-compatibility shim for :meth:`Pinecone.backups.describe`.
737685
738- :meta private:
686+ Preserved to ease migration from the legacy Pinecone Python SDK. New code
687+ should use ``pc.backups.describe()`` instead of ``pc.describe_backup()``.
739688 """
740- warnings .warn (
741- "Pinecone.describe_backup() is deprecated; use pc.backups.describe() instead." ,
742- DeprecationWarning ,
743- stacklevel = 2 ,
744- )
745689 return self .backups .describe (backup_id = backup_id )
746690
747691 def delete_backup (self , * , backup_id : str ) -> None :
748- """Backwards-compatibility delegate. See :meth:`Pinecone.backups.delete`.
692+ """Backwards-compatibility shim for :meth:`Pinecone.backups.delete`.
749693
750- :meta private:
694+ Preserved to ease migration from the legacy Pinecone Python SDK. New code
695+ should use ``pc.backups.delete()`` instead of ``pc.delete_backup()``.
751696 """
752- warnings .warn (
753- "Pinecone.delete_backup() is deprecated; use pc.backups.delete() instead." ,
754- DeprecationWarning ,
755- stacklevel = 2 ,
756- )
757697 self .backups .delete (backup_id = backup_id )
758698
759699 def list_restore_jobs (
@@ -762,57 +702,42 @@ def list_restore_jobs(
762702 limit : int | None = 10 ,
763703 pagination_token : str | None = None ,
764704 ) -> RestoreJobList :
765- """Backwards-compatibility delegate. See :meth:`Pinecone.restore_jobs.list`.
705+ """Backwards-compatibility shim for :meth:`Pinecone.restore_jobs.list`.
766706
767- :meta private:
707+ Preserved to ease migration from the legacy Pinecone Python SDK. New code
708+ should use ``pc.restore_jobs.list()`` instead of ``pc.list_restore_jobs()``.
768709 """
769- warnings .warn (
770- "Pinecone.list_restore_jobs() is deprecated; use pc.restore_jobs.list() instead." ,
771- DeprecationWarning ,
772- stacklevel = 2 ,
773- )
774710 return self .restore_jobs .list (
775711 limit = limit if limit is not None else 10 ,
776712 pagination_token = pagination_token ,
777713 )
778714
779715 def describe_restore_job (self , * , job_id : str ) -> RestoreJobModel :
780- """Backwards-compatibility delegate. See :meth:`Pinecone.restore_jobs.describe`.
716+ """Backwards-compatibility shim for :meth:`Pinecone.restore_jobs.describe`.
781717
782- :meta private:
718+ Preserved to ease migration from the legacy Pinecone Python SDK. New code
719+ should use ``pc.restore_jobs.describe()`` instead of ``pc.describe_restore_job()``.
783720 """
784- warnings .warn (
785- "Pinecone.describe_restore_job() is deprecated;"
786- " use pc.restore_jobs.describe() instead." ,
787- DeprecationWarning ,
788- stacklevel = 2 ,
789- )
790721 return self .restore_jobs .describe (job_id = job_id )
791722
792723 def Index (self , name : str = "" , host : str = "" , ** kwargs : Any ) -> Index : # noqa: N802
793- """Backwards-compatibility factory. See :meth:`Pinecone.index`.
724+ """Backwards-compatibility shim for :meth:`Pinecone.index`.
794725
795- :meta private:
726+ Preserved to ease migration from the legacy Pinecone Python SDK. New code
727+ should use ``pc.index(name=..., host=...)`` instead of ``pc.Index(...)``.
796728 """
797- warnings .warn (
798- "Pinecone.Index() is deprecated; use pc.index() instead." ,
799- DeprecationWarning ,
800- stacklevel = 2 ,
801- )
802729 from pinecone .index import Index as _Index
803730
804731 return cast (_Index , self .index (name = name , host = host ))
805732
806733 def IndexAsyncio (self , host : str , ** kwargs : Any ) -> Any : # noqa: N802
807- """Backwards-compatibility async index factory. See `` AsyncIndex` `.
734+ """Backwards-compatibility shim that returns an :class:` AsyncIndex`.
808735
809- :meta private:
736+ Preserved to ease migration from the legacy Pinecone Python SDK. New
737+ code should construct an :class:`AsyncPinecone` and call ``.index(host=...)``
738+ on it (or instantiate :class:`AsyncIndex` directly) instead of
739+ ``Pinecone.IndexAsyncio(...)``.
810740 """
811- warnings .warn (
812- "Pinecone.IndexAsyncio() is deprecated; use AsyncIndex directly instead." ,
813- DeprecationWarning ,
814- stacklevel = 2 ,
815- )
816741 from pinecone .async_client .async_index import AsyncIndex as _AsyncIndex
817742
818743 return _AsyncIndex (
0 commit comments