You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python 3 support is here! This release is also compatible with Python 2.6 and 2.7, as it was before. This release includes a large number of changes to accommodate the newer versions of Python, but functionally it should remain the same.
Copy file name to clipboardExpand all lines: HISTORY.rst
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,10 @@ Shotgun Python API Changelog
4
4
5
5
Here you can see the full list of changes between each Python API release.
6
6
7
+
v3.1.0 (2019 July 29)
8
+
=====================
9
+
- Adds support for Python 3.7
10
+
7
11
v3.0.41 (2019 June 28)
8
12
=====================
9
13
- Adds an optional sleep between retries specified via the `SHOTGUN_API_RETRY_INTERVAL` environment variable, or by setting `sg.config.rpc_attempt_interval`.
Tutorials and detailed documentation about the Python API are available at http://developer.shotgunsoftware.com/python-api).
21
+
Tutorials and detailed documentation about the Python API are available at http://developer.shotgunsoftware.com/python-api).
26
22
27
23
Some useful direct links:
28
24
@@ -39,12 +35,70 @@ You can see the [full history of the Python API on the documentation site](http:
39
35
## Updating HTTPLib2
40
36
41
37
1. Download the latest version of HTTPLib2 at https://pypi.org/project/httplib2.
42
-
2. Extract the python2/httplib2 into shotgun_api3/lib/http2lib without the test folder.
43
-
3. Scan the files for any references to importing httplib2 and make sure they import "from ." instead of "from httplib2" because the library isn't in the Python path.
38
+
2. Extract the python2/httplib2 into shotgun_api3/lib/http2lib/python2 without the test folder.
39
+
3. Extract the python3/httplib2 into shotgun_api3/lib/http2lib/python3 without the test folder.
40
+
4. Scan the files for any references to importing httplib2 and make sure they import "from ." instead of "from httplib2" because the library isn't in the Python path.
41
+
42
+
## Maintaining Python 2 and 3 compatibility
43
+
44
+
python-api should remain compatible with both Python 2, and 3. To make this easier, we use [six](https://six.readthedocs.io/). When adding code that works with types that have changed between Python 2 and 3, notably strings and files, it's advisable to use the `six` types for casting and comparisons. Be sure to follow Python 2 and 3 compatible conventions in code, especially when raising or capturing exceptions and printing. While we don't use `future`, [this page](https://python-future.org/compatible_idioms.html) contains a fairly comprehensive list of Python 2/3 compatibility sticking points to look out for.
45
+
46
+
Additionally, the [python-modernize](https://python-modernize.readthedocs.io/en/latest/) tool can be helpful when updating Python 2 code for Python 3 compatibility.
47
+
48
+
### Examples:
49
+
50
+
#### Comparisons against changed types:
51
+
52
+
Python 2:
53
+
54
+
```
55
+
if isinstance(my_variable, str):
56
+
```
57
+
58
+
Python 2/3:
59
+
60
+
```
61
+
if isinstance(my_variable, six.string_types):
62
+
```
63
+
64
+
#### Catching exceptions
65
+
66
+
Python 2:
67
+
68
+
```
69
+
except SomeExceptionType, e:
70
+
print "I like to swallow exceptions!"
71
+
```
72
+
73
+
Python 2/3:
74
+
75
+
```
76
+
from __future__ import print_function
77
+
except SomeExceptionType as e:
78
+
print("I like to swallow exceptions!")
79
+
```
80
+
81
+
#### Print statements
82
+
83
+
Python 2:
84
+
85
+
```
86
+
print "My spoon is too big!"
87
+
```
88
+
89
+
Python 2/3:
90
+
91
+
```
92
+
from __future__ import print_function
93
+
print("My spoon is too big!")
94
+
```
95
+
96
+
97
+
Additionally, when testing locally, tests should be run for both python 2 and python 3 to ensure changes won't break cross-compatibility.
44
98
45
-
## Tests
99
+
## Tests
46
100
47
-
Integration and unit tests are provided.
101
+
Integration and unit tests are provided.
48
102
49
103
- All tests require the [nose unit testing tools](http://nose.readthedocs.org), and a `tests/config` file (you can copy an example from `tests/example_config`).
50
104
- Tests can be run individually like this: `nosetest tests/test_client.py`
@@ -58,11 +112,11 @@ Integration and unit tests are provided.
58
112
59
113
1) Update the Changelog in the `HISTORY.rst` file
60
114
- Add bullet points for any changes that have happened since the previous release. This may include changes you did not make so look at the commit history and make sure we don't miss anything. If you notice something was done that wasn't added to the changelog, hunt down that engineer and make them feel guilty for not doing so. This is a required step in making changes to the API.
61
-
- Try and match the language of previous change log messages. We want to keep a consistent voice.
115
+
- Try and match the language of previous change log messages. We want to keep a consistent voice.
62
116
- Make sure the date of the release matches today. We try and keep this TBD until we're ready to do a release so it's easy to catch that it needs to be updated.
63
117
- Make sure the version number is filled out and correct. We follow semantic versioning. Or more correctly, we should be following it.
64
118
2) Ensure any changes or additions to public methods are documented
65
-
- Update the Github wiki, and usually you'll need to update the Method Reference page with concise and exact documentation of the changes that are in this release.
119
+
- Update the Github wiki, and usually you'll need to update the Method Reference page with concise and exact documentation of the changes that are in this release.
66
120
- Ensure that doc strings are updated in the code itself to work with Sphinx and are correctly formatted.
67
121
- Examples are always good especially if this a new feature or method.
68
122
- Think about a new user to the API trying to figure out how to use the features you're documenting.
@@ -76,7 +130,7 @@ Integration and unit tests are provided.
76
130
- Add more detailed information regarding the changes in this release. This is a great place to add examples, and reasons for the change!
77
131
78
132
### Letting the world know
79
-
We usually send an email to the `shotgun-dev` list with an announcement of the release and highlight the changes.
133
+
We usually send an email to the `shotgun-dev` list with an announcement of the release and highlight the changes.
80
134
81
135
### Prepare for the Next Dev Cycle
82
136
1) Update the `__version__` value in `shotgun_api3/shotgun.py` to the next version number with `.dev` appended to it. For example, `v3.0.24.dev`
0 commit comments