From 1057ebbe218b96d4d66fabf61d6d9d1b4fa705ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Boismenu?= Date: Thu, 3 Jun 2021 09:02:48 -0400 Subject: [PATCH] SG-22787: Shotgun to ShotGrid (#245) Rebranded to ShotGrid. --- .travis.yml | 21 ++------------ HISTORY.rst | 22 +++++++-------- README.md | 28 +++++++++---------- appveyor.yml | 2 +- .../examples/ami_version_packager.rst | 2 +- docs/installation.rst | 2 +- shotgun_api3/lib/README.md | 10 +++---- shotgun_api3/lib/mockgun/mockgun.py | 4 +-- shotgun_api3/shotgun.py | 19 +++++-------- tests/base.py | 2 +- 10 files changed, 45 insertions(+), 67 deletions(-) diff --git a/.travis.yml b/.travis.yml index bcf110b39..55d43ee0f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,33 +10,16 @@ language: python -# We need to test on multiple distros, since python 2.6 is not supported in xenial -# and 3.7 is not supported in trusty. For now just use trusty to test 2.6, and use -# the more modern xenial for 2.7 and 3.7. - matrix: include: - # Use trusty dist for python 2.6, since the built-in xenial distro (default) - # does not support Python 2.6 - # See https://docs.travis-ci.com/user/reference/xenial/#python-support - - # Python 2.6, Server #1 - - dist: trusty - python: "2.6" - # flake8 does not support python 2.6, so only run it on 2.7+ - env: - - RUN_FLAKE=false - - # Test python 2.7 and 3.7 on Xenial. - - # Python 2.7, Server #1 + # Python 2.7 - dist: xenial python: "2.7" env: - RUN_FLAKE=true - # Python 3.7, Server #1 + # Python 3.7 - dist: xenial python: "3.7" env: diff --git a/HISTORY.rst b/HISTORY.rst index a0d869426..14b73aca4 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -37,7 +37,7 @@ v3.1.2 (2019 Sept 17) methods ``schema_entity_read()``, ``schema_field_read()``, and ``schema_read()``. v3.1.1 (2019 August 29) -===================== +======================= - Fixes a regression on Python 2.7.0-2.7.9 on Windows with the mimetypes module. v3.1.0 (2019 July 29) @@ -45,53 +45,53 @@ v3.1.0 (2019 July 29) - Adds support for Python 3.7 v3.0.41 (2019 June 28) -===================== +====================== - Adds an optional sleep between retries specified via the `SHOTGUN_API_RETRY_INTERVAL` environment variable, or by setting `sg.config.rpc_attempt_interval`. v3.0.40 (2019 March 13) -===================== +======================= - Updates encoding method to use shutil when uploading, to avoid memory and overflow errors when reading large files. (contributed by @eestrada) v3.0.39 (2019 February 20) -===================== +========================== - Ensures the certificates packaged with the API and those specified via the `SHOTGUN_API_CACERTS` environment variable are used when uploading a file. v3.0.38 (2019 February 7) -===================== +========================= - Upgrades the version of ``httplib2`` to ``0.12.0``, which fixes SNI issues. Note this version contains a more recent list of certificate authorities. If you are running Shotgun locally and have signed your https certificate with an outdated certificate authority, the Shotgun connection will be rejected. v3.0.37 (2018 July 19) -===================== +====================== - Proper support added for unicode and utf-8 string paths given to upload methods, and a sane error is raised when an unusable string encoding is used. - Adds support for querying preferences from Shotgun via the new preferences_read method. - Under-the-hood changes to add support for direct to s3 uploads to Shotgun. This change should be transparent to users. v3.0.36 (2018 April 3) -===================== +====================== - Fixes an error where ``connect=False`` during ``__init__`` would still connect to Shotgun. - Adds support for ``SHOTGUN_API_CACERTS`` when uploading and downloading files. - Properly handles failed downloads due to malware scanning. v3.0.35 (2017 December 8) -===================== +========================= - Add exception UserCredentialsNotAllowedForSSOAuthenticationFault. Triggered when attempting to initiate a connection with a username/password pair on an SSO-enabled Shotgun site. v3.0.34 (2017 September 18) -===================== +=========================== - Optimized pagination strategy for Shotgun 7.4+ - Switched from a hard-coded value of 500 for "records_per_page" to a server-defined value. We will be experimenting with higher values with the goal of increasing performance for large result sets. v3.0.33 (2017 July 18) -===================== +====================== - Raise an exception when uploading an empty file using :meth:`upload`, :meth:`upload_thumbnail` or :meth:`upload_filmstrip_thumbnail` before calling out to the server. @@ -105,7 +105,7 @@ v3.0.32 (2016 Sep 22) - Optimized import speed of the API on Python 2.7. - Integrated the latest fixes to the ``mimetypes`` module. - Added ``nav_expand()`` method as an experimental, internal method for querying SG hierarchy. -- Ported all documentation to sphinx. See http://developer.shotgunsoftware.com/python-api. +- Ported all documentation to sphinx. See http://developer.shotgridsoftware.com/python-api. - Moved Changelog to dedicated HISTORY file. v3.0.31 (2016 May 18) diff --git a/README.md b/README.md index 505657bd7..604db3705 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![VFX Platform](https://img.shields.io/badge/vfxplatform-2020-blue.svg)](http://www.vfxplatform.com/) -[![Python 2.6 2.7 3.7](https://img.shields.io/badge/python-2.6%20%7C%202.7%20%7C%203.7-blue.svg)](https://www.python.org/) -[![Reference Documentation](http://img.shields.io/badge/doc-reference-blue.svg)](http://developer.shotgunsoftware.com/python-api) +[![Python 2.7 3.7](https://img.shields.io/badge/python-2.7%20%7C%203.7-blue.svg)](https://www.python.org/) +[![Reference Documentation](http://img.shields.io/badge/doc-reference-blue.svg)](http://developer.shotgridsoftware.com/python-api) [![Build Status Linux](https://secure.travis-ci.org/shotgunsoftware/python-api.svg?branch=master)](http://travis-ci.org/shotgunsoftware/python-api) [![Build status Windows](https://ci.appveyor.com/api/projects/status/slvw7u4jatvdly98/branch/master?svg=true )](https://ci.appveyor.com/project/jfboismenu/python-api/branch/master) @@ -8,29 +8,29 @@ # Shotgun Python API -Shotgun provides a simple Python-based API for accessing Shotgun and integrating with other tools. This is the official API that is maintained by Shotgun Software (support@shotgunsoftware.com) +ShotGrid provides a simple Python-based API for accessing ShotGrid and integrating with other tools. This is the official API that is maintained by ShotGrid Software (support@shotgunsoftware.com) The latest version can always be found at http://github.com/shotgunsoftware/python-api ## Minimum Requirements -* Shotgun server v2.4.12+. -* Python v2.6 - v2.7 or v3.7 +* ShotGrid server v2.4.12+. +* Python v2.7 or v3.7 ## Documentation -Tutorials and detailed documentation about the Python API are available at http://developer.shotgunsoftware.com/python-api). +Tutorials and detailed documentation about the Python API are available at http://developer.shotgridsoftware.com/python-api). Some useful direct links: -* [Installing](http://developer.shotgunsoftware.com/python-api/installation.html) -* [Tutorials](http://developer.shotgunsoftware.com/python-api/cookbook/tutorials.html) -* [API Reference](http://developer.shotgunsoftware.com/python-api/reference.html) -* [Data Types](http://developer.shotgunsoftware.com/python-api/reference.html#data-types) -* [Filter Syntax](http://developer.shotgunsoftware.com/python-api/reference.html#filter-syntax) +* [Installing](http://developer.shotgridsoftware.com/python-api/installation.html) +* [Tutorials](http://developer.shotgridsoftware.com/python-api/cookbook/tutorials.html) +* [API Reference](http://developer.shotgridsoftware.com/python-api/reference.html) +* [Data Types](http://developer.shotgridsoftware.com/python-api/reference.html#data-types) +* [Filter Syntax](http://developer.shotgridsoftware.com/python-api/reference.html#filter-syntax) ## Changelog -You can see the [full history of the Python API on the documentation site](http://developer.shotgunsoftware.com/python-api/changelog.html). +You can see the [full history of the Python API on the documentation site](http://developer.shotgridsoftware.com/python-api/changelog.html). ## Updating HTTPLib2 @@ -108,8 +108,8 @@ Integration and unit tests are provided. - A `tests/config` file (you can copy an example from `tests/example_config`). - Tests can be run individually like this: `nosetests --config="nose.cfg" tests/test_client.py` - Make sure to not forget the `--config="nose.cfg"` option. This option tells nose to use our config file. This will exclude python 2- and 3-specific files in the `/lib` directory, preventing a failure from being reported by nose for compilation due to incompatible syntax in those files. -- `test_client` and `tests_unit` use mock server interaction and do not require a Shotgun instance to be available (no modifications to `tests/config` are necessary). -- `test_api` and `test_api_long` *do* require a Shotgun instance, with a script key available for the tests. The server and script user values must be supplied in the `tests/config` file. The tests will add test data to your server based on information in your config. This data will be manipulated by the tests, and should not be used for other purposes. +- `test_client` and `tests_unit` use mock server interaction and do not require a ShotGrid instance to be available (no modifications to `tests/config` are necessary). +- `test_api` and `test_api_long` *do* require a ShotGrid instance, with a script key available for the tests. The server and script user values must be supplied in the `tests/config` file. The tests will add test data to your server based on information in your config. This data will be manipulated by the tests, and should not be used for other purposes. - To run all of the tests, use the shell script `run-tests`. ## Release process diff --git a/appveyor.yml b/appveyor.yml index 7ba21c8eb..39e7f0d27 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -24,7 +24,7 @@ environment: secure: 0/BofzMkXtzwtRqzC94FHt3lcyMBG0rr2w0rUropeT4= SG_SCRIPT_NAME: python-api-test SG_API_KEY: - secure: Zjz4JgVnT8npR4By6HZDJNJFjDDBFLW+7pOc/eD5kqQ= + secure: 8bHvvT/83p+3wHyQh4qsfXP3aBENRzk0DbXosKC/cuc= SG_PROJECT_NAME: SG unittest project for AppVeyor build: off diff --git a/docs/cookbook/examples/ami_version_packager.rst b/docs/cookbook/examples/ami_version_packager.rst index 7ef182782..67e983a2a 100644 --- a/docs/cookbook/examples/ami_version_packager.rst +++ b/docs/cookbook/examples/ami_version_packager.rst @@ -27,7 +27,7 @@ It is intended to be used in conjunction with the script dicussed in :ref:`ami_h It uses the example ActionMenu Python class also located in our docs for parsing the ActionMenuItem POST variables. For more information about it and accessing the variables in the ActionMenuItem POST request, - See: http://developer.shotgunsoftware.com/python-api/examples/ami_handler + See: http://developer.shotgridsoftware.com/python-api/examples/ami_handler The purpose of this script is to download attachment files from Shotgun, create an archive of them and copy them to a specified directory. You can invoke it with the following minimal example to connect diff --git a/docs/installation.rst b/docs/installation.rst index ddafc78c5..2a01630d6 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -9,7 +9,7 @@ Minimum Requirements - Shotgun server v5.4.14 or higher for API v3.0.16+. - Shotgun server v2.4.12 or higher for API v3.0.8. - Shotgun server v1.8 or higher for API v3.0.7. -- Python 2.6 - 2.7 or Python 3.7 +- Python 2.7 or Python 3.7 .. note:: Some features of the API are only supported by more recent versions of the Shotgun server. diff --git a/shotgun_api3/lib/README.md b/shotgun_api3/lib/README.md index 6cc12188d..a3aa1f0e5 100644 --- a/shotgun_api3/lib/README.md +++ b/shotgun_api3/lib/README.md @@ -41,15 +41,15 @@ The version of `six` bundled should be updated manually, however its version is ### mockgun -Mockgun is a Shotgun API mocker. It's a class that has got *most* of the same -methods and parameters that the Shotgun API has got. Mockgun is essentially a -Shotgun *emulator* that (for basic operations) looks and feels like Shotgun. +Mockgun is a ShotGrid API mocker. It's a class that has got *most* of the same +methods and parameters that the ShotGrid API has got. Mockgun is essentially a +ShotGrid *emulator* that (for basic operations) looks and feels like ShotGrid. The primary purpose of Mockgun is to drive unit test rigs where it becomes -too slow, cumbersome or non-practical to connect to a real Shotgun. Using a +too slow, cumbersome or non-practical to connect to a real ShotGrid. Using a Mockgun for unit tests means that a test can be rerun over and over again from exactly the same database state. This can be hard to do if you connect -to a live Shotgun instance. +to a live ShotGrid instance. ## Lib `requirements.txt` diff --git a/shotgun_api3/lib/mockgun/mockgun.py b/shotgun_api3/lib/mockgun/mockgun.py index acabd8f83..6a2f79de0 100644 --- a/shotgun_api3/lib/mockgun/mockgun.py +++ b/shotgun_api3/lib/mockgun/mockgun.py @@ -201,7 +201,7 @@ def __init__(self, if schema_path is None or schema_entity_path is None: raise MockgunError("Cannot create Mockgun instance because no schema files have been defined. " "Before creating a Mockgun instance, please call Mockgun.set_schema_paths() " - "in order to specify which Shotgun schema Mockgun should operate against.") + "in order to specify which ShotGrid schema Mockgun should operate against.") self._schema, self._schema_entity = SchemaFactory.get_schemas(schema_path, schema_entity_path) @@ -503,7 +503,7 @@ def _validate_entity_data(self, entity_type, data): "url": dict}[sg_type] except KeyError: raise ShotgunError( - "Field %s.%s: Handling for Shotgun type %s is not implemented" % + "Field %s.%s: Handling for ShotGrid type %s is not implemented" % (entity_type, field, sg_type) ) diff --git a/shotgun_api3/shotgun.py b/shotgun_api3/shotgun.py index f11f895df..75d2303c1 100644 --- a/shotgun_api3/shotgun.py +++ b/shotgun_api3/shotgun.py @@ -219,10 +219,10 @@ def __init__(self, host, meta): except AttributeError: self.version = None if not self.version: - raise ShotgunError("The Shotgun Server didn't respond with a version number. " + raise ShotgunError("The ShotGrid Server didn't respond with a version number. " "This may be because you are running an older version of " - "Shotgun against a more recent version of the Shotgun API. " - "For more information, please contact Shotgun Support.") + "ShotGrid against a more recent version of the ShotGrid API. " + "For more information, please contact ShotGrid Support.") if len(self.version) > 3 and self.version[3] == "Dev": self.is_dev = True @@ -774,9 +774,6 @@ def info(self): >>> sg.info() {'full_version': [8, 2, 1, 0], 'version': [8, 2, 1], 'user_authentication_method': 'default', ...} - Tokens and values - ----------------- - :: Token Value @@ -2730,13 +2727,11 @@ def get_attachment_download_url(self, attachment): .. note:: Support for passing in an int representing the Attachment ``id`` is deprecated - .. todo:: - Support for a standard entity hash should be removed: #22150 - :returns: the download URL for the Attachment or ``None`` if ``None`` was passed to ``attachment`` parameter. :rtype: str """ + # TODO: Support for a standard entity hash should be removed: #22150 attachment_id = None if isinstance(attachment, int): attachment_id = attachment @@ -3550,7 +3545,7 @@ def _parse_http_status(self, status): if status[0] >= 300: headers = "HTTP error from server" if status[0] == 503: - errmsg = "Shotgun is currently down for maintenance or too busy to reply. Please try again later." + errmsg = "ShotGrid is currently down for maintenance or too busy to reply. Please try again later." raise ProtocolError(self.config.server, error_code, errmsg, @@ -3636,12 +3631,12 @@ def _response_errors(self, sg_response): raise UserCredentialsNotAllowedForSSOAuthenticationFault( sg_response.get("message", "Authentication using username/password is not " - "allowed for an SSO-enabled Shotgun site") + "allowed for an SSO-enabled ShotGrid site") ) elif sg_response.get("error_code") == ERR_OXYG: raise UserCredentialsNotAllowedForOxygenAuthenticationFault( sg_response.get("message", "Authentication using username/password is not " - "allowed for an Autodesk Identity enabled Shotgun site") + "allowed for an Autodesk Identity enabled ShotGrid site") ) else: # raise general Fault diff --git a/tests/base.py b/tests/base.py index c14cd70b3..4dfc61cf2 100644 --- a/tests/base.py +++ b/tests/base.py @@ -1,4 +1,4 @@ -"""Base class for Shotgun API tests.""" +"""Base class for ShotGrid API tests.""" import os import re import unittest