Skip to content

Commit b75865b

Browse files
authored
Merge pull request #908 from CitrineInformatics/release/v3.0
Bump to 3.0
2 parents a391ede + e580cf5 commit b75865b

File tree

107 files changed

+623
-5600
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+623
-5600
lines changed

.github/workflows/pr-checks.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: PR Checks
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- 'release/**'
8+
9+
jobs:
10+
check-version:
11+
name: Check version bumped
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Initialize the environment
16+
uses: ./.github/actions/initialize
17+
- name: Check version
18+
run: python scripts/validate_version_bump.py
19+
linting:
20+
name: Run linting with flake8
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Initialize the environment
25+
uses: ./.github/actions/initialize
26+
- name: Lint the src/ directory
27+
run: flake8 src/
28+
check-deprecated:
29+
name: Find code marked for removal in this version
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v4
33+
- name: Initialize the environment
34+
uses: ./.github/actions/initialize
35+
- name: Deprecated check
36+
run: derp src/ src/citrine/__version__.py
37+
check-docs:
38+
name: Check docs for warnings
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v4
42+
- name: Initialize the environment
43+
uses: ./.github/actions/initialize
44+
- name: Build Docs
45+
run: make -C docs/ html SPHINXOPTS='-W --keep-going'

.github/workflows/pr-tests.yml

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,15 @@ name: PR Tests
22

33
on:
44
pull_request:
5-
branches:
5+
branches:
66
- main
7+
- 'release/**'
78

89
jobs:
9-
check-version:
10-
name: Check version bumped
11-
runs-on: ubuntu-latest
12-
steps:
13-
- uses: actions/checkout@v4
14-
- name: Initialize the environment
15-
uses: ./.github/actions/initialize
16-
- name: Check version
17-
run: python scripts/validate_version_bump.py
18-
linting:
19-
name: Run linting with flake8
20-
runs-on: ubuntu-latest
21-
steps:
22-
- uses: actions/checkout@v4
23-
- name: Initialize the environment
24-
uses: ./.github/actions/initialize
25-
- name: Lint the src/ directory
26-
run: flake8 src/
27-
check-deprecated:
28-
name: Find code marked for removal in this version
29-
runs-on: ubuntu-latest
30-
steps:
31-
- uses: actions/checkout@v4
32-
- name: Initialize the environment
33-
uses: ./.github/actions/initialize
34-
- name: Deprecated check
35-
run: derp src/ src/citrine/__version__.py
3610
run-tests:
3711
name: Execute unit tests
3812
runs-on: ubuntu-latest
13+
continue-on-error: true
3914
strategy:
4015
matrix:
4116
python-version: ["3.8", "3.9", "3.10", "3.11"]

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ Clone from github:
2121
git clone [email protected]:CitrineInformatics/citrine-python
2222
```
2323

24-
Create a virtual environment using Python >= 3.7.
24+
Create a virtual environment using Python >= 3.8.
2525
One option is to use conda, but it is not required.
2626

2727
```bash
28-
conda create -n <environment_name> python=3.7
28+
conda create -n <environment_name> python=3.8
2929
conda activate <environment_name>
3030
```
3131

docs/source/FAQ/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ FAQ
66
:maxdepth: 2
77

88
prohibited_data_patterns
9-
team_management_migration
9+
team_management_migration
10+
v3_migration

docs/source/FAQ/v3_migration.rst

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
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`.

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import citrine
1414
import os
1515
import sys
16-
sys.path.insert(0, os.path.abspath('../../src'))
16+
sys.path.insert(0, os.path.abspath('../../src/citrine'))
1717

1818

1919
# -- Project information -----------------------------------------------------
@@ -44,7 +44,7 @@
4444
# build.
4545
#
4646
# See: https://github.com/sphinx-contrib/apidoc
47-
apidoc_module_dir = '../../src'
47+
apidoc_module_dir = '../../src/citrine'
4848
apidoc_output_dir = 'reference'
4949
apidoc_excluded_paths = ['tests']
5050
apidoc_separate_modules = True

docs/source/data_extraction.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A GEM Table is defined on a set of material histories, and the rows in the resul
88
Columns correspond to data about the material histories, such as the temperature measured in a kiln used at a specific manufacturing step.
99

1010
Defining rows and columns
11-
------------------------
11+
-------------------------
1212

1313
A Row object describes a mapping from a list of Datasets to rows of a table by selecting a set of Material Histories.
1414
Each Material History corresponds to exactly one row, though the Material Histories may overlap such that the same objects contribute data to multiple rows.
@@ -327,4 +327,4 @@ are compatible with each type of descriptor:
327327
- :class:`~citrine.informatics.descriptors.ChemicalFormulaDescriptor`: values of type :class:`~gemd.entity.EmpiricalFormula`,
328328
or values of type :class:`~gemd.entity.NominalComposition` when **all** quantity keys are valid atomic symbols
329329
- :class:`~citrine.informatics.descriptors.FormulationDescriptor`: all values extracted by ingredient quantity, identifier, and label variables
330-
are used to represent the formulation
330+
are used to represent the formulation

docs/source/getting_started/datasets.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Assume you have a "band gaps project" with known id, ``band_gaps_project_id``, a
7474
7575
7676
Dataset Access, Sharing, and Transfer
77-
------------------------------------
77+
-------------------------------------
7878

7979
When a Dataset is created on the Citrine Platform, only members of the project in which it was created can see it and interact with it.
8080
If a Dataset is made public, it (and its entire contents) can be retrieved by any user using any project.

docs/source/index.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Welcome to the Citrine Python client documentation!
88

99
This site documents the Python SDK for the Citrine Platform.
1010
It provides utilities to upload and manage data and design materials using Sequential Learning.
11-
See the :ref:`getting started <getting-started>` guide for a high-level introduction.
11+
See the :ref:`getting started <ai-engine-getting-started>` guide for a high-level introduction.
1212
The :ref:`workflows <workflows>` section documents how to configure and run artificial intelligence (AI) workflows for materials research and development.
1313

1414
Installation
@@ -24,7 +24,7 @@ or a specific version can be installed, for example:
2424

2525
.. code::
2626
27-
pip install citrine==1.0.0
27+
pip install citrine==3.0.0
2828
2929
3030
Table of Contents
@@ -41,6 +41,7 @@ Table of Contents
4141
formulations_example
4242
molecular_generation
4343
FAQ/index
44+
API Reference <reference/modules>
4445

4546
Indices and tables
4647
==================

docs/source/modules.rst

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)