|
| 1 | +================ |
| 2 | +Migrating to 3.0 |
| 3 | +================ |
| 4 | + |
| 5 | +Summary |
| 6 | +======= |
| 7 | + |
| 8 | +The newest major release of citrine-python cleans accumulated deprecations as we evolve the Citrine |
| 9 | +platform. The intent is to focus users as we aim to reduce confusion by providing a single way to |
| 10 | +accomplish each of your tasks. |
| 11 | + |
| 12 | +Keep in mind that you can keep using 2.x until you're ready to upgrade. But until you do, you won't |
| 13 | +get any new features or bug fixes. |
| 14 | + |
| 15 | +Goals |
| 16 | +----- |
| 17 | + |
| 18 | +The intent of this guide is not to itemize every piece of code removed. The easiest way to |
| 19 | +determine what you'll need to change is to upgrade citrine to the latest 2.x release (2.42.2), run |
| 20 | +your scripts, and take note of the deprecation warnings. Whenever possible, those warnings will |
| 21 | +direct you on how to modify your code such that it will continue to function as desired upon |
| 22 | +upgrading to citrine-python 3.x. |
| 23 | + |
| 24 | +This guide seeks to give a high-level overview of those changes, naming some of the categories of |
| 25 | +elements no longer supported and what action to take, as well as some of the more consequential |
| 26 | +individual changes. |
| 27 | + |
| 28 | +Versions / Runtimes |
| 29 | +=================== |
| 30 | + |
| 31 | +The following library versions and Python versions are no longer supported. |
| 32 | + |
| 33 | +Versions < 2.26.1 |
| 34 | +----------------- |
| 35 | + |
| 36 | +The citrine-python SDK is a client for the Citrine platform. As such, we will occasionally need to |
| 37 | +make upgrades to the platform which will break old versions of the SDK. |
| 38 | + |
| 39 | +At some point after the release of 3.0, we will be making platform upgrades which will change the |
| 40 | +way clients must interact with Search Spaces. So if you're using any version of citrine prior to |
| 41 | +2.26.1 (released on June 28, 2023), and you're interacting with Search Spaces (e.g. through |
| 42 | +:py:attr:`project.design_spaces <citrine.resources.project.Project.design_spaces>`), your code will |
| 43 | +break. Please upgrade to the latest 2.x release, or to 3.0, to avoid this issue. If this poses any |
| 44 | +problems for you, please notify your customer contact so we can work with you. |
| 45 | + |
| 46 | +Python 3.7 |
| 47 | +---------- |
| 48 | + |
| 49 | +Official upstream support for Python 3.7 by the Python Software Foundation ended in June 2023. As |
| 50 | +such, we no longer support its use, and may begin using language features which are not backwards |
| 51 | +compatable with it. Upgrade to at least Python 3.8, keeping in mind |
| 52 | +`their migration guide <https://docs.python.org/3.8/whatsnew/3.8.html>`_. |
| 53 | + |
| 54 | +Features |
| 55 | +======== |
| 56 | + |
| 57 | +The following features are no longer supported. |
| 58 | + |
| 59 | +Branch ID |
| 60 | +--------- |
| 61 | + |
| 62 | +Previously, branch references were inconsistent. Some used a unique "branch ID", and others the |
| 63 | +"root ID". This was further complicated by the web app only ever showing the "root ID". The reason |
| 64 | +has to do with the platform implementation, but resulted in a confusing user experience. |
| 65 | + |
| 66 | +Beginning in 3.0, that "branch ID" is hidden from users. Instead, the SDK will always present the |
| 67 | +branch's root ID and version, akin to |
| 68 | +:py:class:`Predictor <citrine.informatics.predictors.graph_predictor.GraphPredictor>` ID and |
| 69 | +version. To access branches, you'll just use that root ID, and optionally the version: omitting the |
| 70 | +version will grab the most recent version, which will almost always be what you want. |
| 71 | + |
| 72 | +status_info |
| 73 | +----------- |
| 74 | + |
| 75 | +We have completed moving all our assets which previously used :code:`status_info` (such as but not |
| 76 | +limited to :py:class:`~citrine.informatics.predictors.predictor.Predictor` and |
| 77 | +:py:class:`~citrine.informatics.workflows.design_workflow.DesignWorkflow`) to use |
| 78 | +:code:`status_detail`. These objects contain richer information, such as log level and (optionally) |
| 79 | +error codes, along with the message. |
| 80 | + |
| 81 | +DesignSpace.archive and DesignSpace.restore |
| 82 | +------------------------------------------- |
| 83 | + |
| 84 | +In the past, archiving a Search Space required updating it, which carried the risk of accidental |
| 85 | +modification. Since 2.26.1, we've supported a separate |
| 86 | +:py:meth:`~citrine.resources.design_space.DesignSpaceCollection.archive` and |
| 87 | +:py:meth:`~citrine.resources.design_space.DesignSpaceCollection.restore` call. So we no longer |
| 88 | +support archiving via :py:meth:`~citrine.resources.design_space.DesignSpaceCollection.update`. |
| 89 | + |
| 90 | +citrine.builders |
| 91 | +---------------- |
| 92 | + |
| 93 | +This package contained a handful of utilities which were by all accounts unused, and better suited |
| 94 | +to live outside citrine-python, anyways. |
| 95 | + |
| 96 | +formulation_descriptor parameters |
| 97 | +--------------------------------- |
| 98 | + |
| 99 | +In many cases, the Citrine platform will generate an appropriate formulation descriptor on your |
| 100 | +behalf. For example, when creating a |
| 101 | +:py:class:`~citrine.informatics.predictors.simple_mixture_predictor.SimpleMixturePredictor` or |
| 102 | +:py:class:`~citrine.informatics.data_sources.GemTableDataSource`. In such cases, you can no longer |
| 103 | +specify a formulation descriptor. |
| 104 | + |
| 105 | +:py:attr:`project.modules <citrine.resources.project.ProjectCollection.modules>` |
| 106 | +-------------------------------------------------------------------------------- |
| 107 | + |
| 108 | +This was the remnant of the old Citrine platform, before we began to specialize our assets. For |
| 109 | +over a year, it has only returned Search Spaces, for which you should be using |
| 110 | +:py:meth:`project.design_spaces <citrine.resources.project.ProjectCollection.design_spaces>`. As |
| 111 | +such, both it and :code:`citrine.resources.modules` were dropped. |
| 112 | + |
| 113 | +Dehydrated Search Spaces |
| 114 | +------------------------ |
| 115 | + |
| 116 | +This is a feature from the early days of the platform. It hasn't been supported for quite some time |
| 117 | +due to lack of use and complexity of support. But mechanisms for it were still present in |
| 118 | +citrine-python, allowing users to specify subspaces by ID. Fully dropping support completes its |
| 119 | +removal. |
| 120 | + |
| 121 | +Process File Protocol |
| 122 | +--------------------- |
| 123 | + |
| 124 | +This refers to the old method of getting data on the platform using :code:`Dataset.files.process`. |
| 125 | +It's been supplanted by :py:meth:`~citrine.resources.file_link.FileCollection.ingest`, rendering |
| 126 | +:code:`process` and the whole :code:`citrine.resources.job` module irrelevant. |
| 127 | + |
| 128 | +convert_to_graph and convert_and_update |
| 129 | +--------------------------------------- |
| 130 | + |
| 131 | +:code:`SimpleMLPredictor` was a very old type of AI Model which hasn't been supported by the |
| 132 | +platform in a long time. As such, these methods to convert them into the equivalent |
| 133 | +:py:class:`~citrine.informatics.predictors.graph_predictor.GraphPredictor` are no longer needed. If |
| 134 | +you think you still use a :code:`SimpleMLPredictor`, please reach out to your customer contact so we can |
| 135 | +work with you to convert it. |
| 136 | + |
| 137 | +:py:meth:`~citrine.seeding.find_or_create.find_or_create_project` requires a team ID |
| 138 | +------------------------------------------------------------------------------------ |
| 139 | + |
| 140 | +In mid-2022, the platform introduced teams, which are collections of projects. As such, starting |
| 141 | +with 3.0, :py:meth:`~citrine.seeding.find_or_create.find_or_create_project` can only operate on a |
| 142 | +:py:class:`~citrine.resources.project.ProjectCollection` which includes a team ID. That is, instead |
| 143 | +of passing :py:attr:`citrine.projects <citrine.citrine.Citrine.projects>`, you most likely want to |
| 144 | +pass :py:attr:`team.projects <citrine.resources.team.Team.projects>`. |
| 145 | + |
| 146 | +Ingredient Ratio Constraint bases are now sets |
| 147 | +---------------------------------------------- |
| 148 | + |
| 149 | +They were initially implemented as Python dictionaries to allow for flexibility. But as we evolved |
| 150 | +their usage on the platform, we found we only needed the list of ingredients/labels. To allow |
| 151 | +migration while preserving the old behavior, we added |
| 152 | +:py:meth:`~citrine.informatics.constraints.ingredient_ratio_constraint.IngredientRatioConstraint.basis_ingredient_names` |
| 153 | +and |
| 154 | +:py:meth:`~citrine.informatics.constraints.ingredient_ratio_constraint.IngredientRatioConstraint.basis_label_names`. |
| 155 | +Note that |
| 156 | +once you've upgraded to 3.0, you'll be prompted to move back to |
| 157 | +:py:meth:`~citrine.informatics.constraints.ingredient_ratio_constraint.IngredientRatioConstraint.basis_ingredients` and |
| 158 | +:py:meth:`~citrine.informatics.constraints.ingredient_ratio_constraint.IngredientRatioConstraint.basis_labels`. |
0 commit comments