Skip to content

Commit

Permalink
Merge branch 'main' into greg-db-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-db authored Dec 27, 2024
2 parents 8cac039 + c5ea3f8 commit 7b3025e
Show file tree
Hide file tree
Showing 28 changed files with 3,222 additions and 1,522 deletions.
62 changes: 40 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,27 @@ jobs:
# https://github.com/actions/python-versions/blob/main/versions-manifest.json
strategy:
matrix:
os: [macos-latest, windows-latest]
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, pypy-2.7, pypy-3.7]
os: [macos-13, windows-latest]
python-version: [3.6, 3.7, 3.8, pypy-3.7]
exclude:
- os: windows-latest
python-version: 3.6
include:
- os: ubuntu-latest
- os: ubuntu-20.04
python-version: 3.7
- os: ubuntu-20.04
python-version: 2.7
steps:
- uses: actions/checkout@v2
- name: Setup Python environment
uses: actions/setup-python@v2.2.2
- if: ${{ matrix.python-version == '2.7' }}
name: Setup Python environment (2.7)
run: |
sudo apt-get install python-is-python2
curl -sSL https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
python get-pip.py
- if: ${{ matrix.python-version != '2.7' }}
name: Setup Python environment
uses: actions/setup-python@v3.1.4
with:
python-version: ${{ matrix.python-version }}
- name: Install Requirements
Expand All @@ -30,19 +39,19 @@ jobs:
pip install flake8 pytest
pip install -r requirements.txt
pip install -r test/requirements.txt
python setup.py install
python setup.py install --user
- name: Run Linter
run: |
flake8 setup.py dropbox example test
- name: Run Unit Tests
run: |
pytest test/unit/test_dropbox_unit.py
pytest -v test/unit/test_dropbox_unit.py
Docs:
runs-on: macos-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Setup Python environment
uses: actions/setup-python@v2.2.2
uses: actions/setup-python@v3.1.4
with:
python-version: '3.7'
- name: Install Requirements
Expand All @@ -64,18 +73,27 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest]
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, pypy-2.7, pypy-3.7]
exclude:
- os: windows-latest
python-version: 3.6
include:
- os: ubuntu-latest
python-version: 3.7
steps:
os: [macos-13, windows-latest]
python-version: [3.6, 3.7, 3.8, pypy-3.7]
exclude:
- os: windows-latest
python-version: 3.6
include:
- os: ubuntu-20.04
python-version: 3.7
- os: ubuntu-20.04
python-version: 2.7
steps:
- uses: actions/checkout@v2.3.4
- name: Setup Python environment
uses: actions/setup-python@v2.2.2
- if: ${{ matrix.python-version == '2.7' }}
name: Setup Python environment (2.7)
run: |
sudo apt-get install python-is-python2
curl -sSL https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
python get-pip.py
- if: ${{ matrix.python-version != '2.7' }}
name: Setup Python environment
uses: actions/setup-python@v3.1.4
with:
python-version: ${{ matrix.python-version }}
- name: Install Requirements
Expand All @@ -84,7 +102,7 @@ jobs:
pip install flake8 pytest
pip install -r requirements.txt
pip install -r test/requirements.txt
python setup.py install
python setup.py install --user
- name: Run Integration Tests
env:
LEGACY_USER_DROPBOX_TOKEN: ${{ secrets.LEGACY_USER_DROPBOX_TOKEN }}
Expand All @@ -101,4 +119,4 @@ jobs:
SCOPED_TEAM_REFRESH_TOKEN: ${{ secrets.SCOPED_TEAM_REFRESH_TOKEN }}
DROPBOX_SHARED_LINK: ${{ secrets.DROPBOX_SHARED_LINK }}
run: |
pytest test/integration/test_dropbox.py
pytest -v test/integration/test_dropbox.py
12 changes: 7 additions & 5 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Setup Python environment
uses: actions/setup-python@v2.2.2
uses: actions/setup-python@v3.1.4
with:
python-version: '3.7'
- name: Install Requirements
Expand All @@ -28,16 +28,17 @@ jobs:
coverage run --rcfile=.coveragerc -m pytest test/unit/test_dropbox_unit.py
coverage xml
- name: Publish Coverage
uses: codecov/codecov-action@v1.3.2
uses: codecov/codecov-action@v3.1.6
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unit
fail_ci_if_error: true
IntegrationCoverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python environment
uses: actions/setup-python@v2.2.2
uses: actions/setup-python@v3.1.4
with:
python-version: '3.7'
- name: Install Requirements
Expand Down Expand Up @@ -66,7 +67,8 @@ jobs:
coverage run --rcfile=.coveragerc -m pytest test/integration/test_dropbox.py
coverage xml
- name: Publish Coverage
uses: codecov/codecov-action@v1.3.2
uses: codecov/codecov-action@v3.1.6
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: integration
fail_ci_if_error: true
fail_ci_if_error: true
21 changes: 14 additions & 7 deletions .github/workflows/pypiupload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,22 @@ on:

jobs:
deploy:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [2.7, 3.x]
python-version: [2.7, 3.7]

steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2.2.2
- uses: actions/checkout@v2.3.4
- if: ${{ matrix.python-version == '2.7' }}
name: Setup Python environment (2.7)
run: |
sudo apt-get install python-is-python2
curl -sSL https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
python get-pip.py
- if: ${{ matrix.python-version != '2.7' }}
name: Setup Python environment
uses: actions/setup-python@v3.1.4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -27,9 +34,9 @@ jobs:
- name: Build
run: |
python setup.py bdist_wheel
- name: Build Sources (3.x)
- name: Build Sources (Python 3)
run: python setup.py sdist
if: matrix.python-version == '3.x'
if: ${{ matrix.python-version != '2.7' }}
- name: Publish
env:
TWINE_USERNAME: __token__
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/spec_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Setup Python environment
uses: actions/setup-python@v2.2.2
uses: actions/setup-python@v3.1.4
with:
python-version: 3.7
- name: Get current time
Expand Down
22 changes: 18 additions & 4 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# .readthedocs.yml
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Don't build any extra formats
# https://docs.readthedocs.io/en/latest/yaml-config.html#formats
formats: []
version: 2

build:
os: ubuntu-20.04
tools:
python: "3.7"

python:
install:
- requirements: requirements.txt
- method: setuptools
path: .

sphinx:
configuration: docs/conf.py
4 changes: 4 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
This document is designed to show you how to upgrade to the latest version of the SDK accomodating any breaking changes introduced by major version updates.
If you find any issues with either this guide on upgrading or the changes introduced in the new version, please see [CONTRIBUTING.md](CONTRIBUTING.md)

# Upgrading to v12.0.0
* The SDK no longer provides its own CA bundle to verify TLS connections. It will continue to verify connections through the `requests` library, which makes use of [`certifi`](https://github.com/certifi/python-certifi). You may still provide your own bundle through the `ca_certs` parameter of the `Dropbox` classes and of the `create_session` function (see the [documentation](https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html) for details).
* This will be the last major version to support Python 2.

# Upgrading from v10.X.X to v11.0.0
The major change that happened in this new version is that we regenerated the client files using Stone 3.2.0,
so relative imports are removed from the generated client files.
Expand Down
5 changes: 3 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.mathjax',
'sphinx_rtd_theme',
]

# Add any paths that contain templates here, relative to this directory.
Expand All @@ -54,7 +55,7 @@

# General information about the project.
project = u'Dropbox for Python'
copyright = u'2015-2019, Dropbox, Inc.'
copyright = u'2015-2024, Dropbox, Inc.'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -108,7 +109,7 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
html_theme = 'sphinx_rtd_theme'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Dropbox for Python Documentation
tutorial

.. toctree::
:maxdepth: 2
:maxdepth: 1

api/async
api/auth
Expand Down
2 changes: 1 addition & 1 deletion dropbox/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ def _process_custom_annotations(self, annotation_type, field_path, processor):
token_from_oauth1 = bb.Route(
'token/from_oauth1',
1,
False,
True,
TokenFromOAuth1Arg_validator,
TokenFromOAuth1Result_validator,
TokenFromOAuth1Error_validator,
Expand Down
6 changes: 5 additions & 1 deletion dropbox/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ def auth_token_from_oauth1(self,
If this raises, ApiError will contain:
:class:`dropbox.auth.TokenFromOAuth1Error`
"""
warnings.warn(
'token/from_oauth1 is deprecated.',
DeprecationWarning,
)
arg = auth.TokenFromOAuth1Arg(oauth1_token,
oauth1_token_secret)
r = self.request(
Expand Down Expand Up @@ -2880,7 +2884,7 @@ def files_save_url(self,
url):
"""
Save the data from a specified URL into a file in user's Dropbox. Note
that the transfer from the URL must complete within 5 minutes, or the
that the transfer from the URL must complete within 15 minutes, or the
operation will time out and the job will fail. If the given path already
exists, the file will be renamed to avoid the conflict (e.g. myfile
(1).txt).
Expand Down
16 changes: 12 additions & 4 deletions dropbox/base_team.py
Original file line number Diff line number Diff line change
Expand Up @@ -1257,8 +1257,10 @@ def team_member_space_limits_excluded_users_remove(self,
def team_member_space_limits_get_custom_quota(self,
users):
"""
Get users custom quota. Returns none as the custom quota if none was
set. A maximum of 1000 members can be specified in a single call.
Get users custom quota. A maximum of 1000 members can be specified in a
single call. Note: to apply a custom space limit, a team admin needs to
set a member space limit for the team first. (the team admin can check
the settings here: https://www.dropbox.com/team/admin/settings/space).
Route attributes:
scope: members.read
Expand All @@ -1283,7 +1285,10 @@ def team_member_space_limits_remove_custom_quota(self,
users):
"""
Remove users custom quota. A maximum of 1000 members can be specified in
a single call.
a single call. Note: to apply a custom space limit, a team admin needs
to set a member space limit for the team first. (the team admin can
check the settings here:
https://www.dropbox.com/team/admin/settings/space).
Route attributes:
scope: members.write
Expand All @@ -1308,7 +1313,10 @@ def team_member_space_limits_set_custom_quota(self,
users_and_quotas):
"""
Set users custom quota. Custom quota has to be at least 15GB. A maximum
of 1000 members can be specified in a single call.
of 1000 members can be specified in a single call. Note: to apply a
custom space limit, a team admin needs to set a member space limit for
the team first. (the team admin can check the settings here:
https://www.dropbox.com/team/admin/settings/space).
Route attributes:
scope: members.read
Expand Down
2 changes: 1 addition & 1 deletion dropbox/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class EchoArg(bb.Struct):
"""
EchoArg contains the arguments to be sent to the Dropbox servers.
Contains the arguments to be sent to the Dropbox servers.
:ivar check.EchoArg.query: The string that you'd like to be echoed back to
you.
Expand Down
5 changes: 2 additions & 3 deletions dropbox/dropbox_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ def __init__(self,
Not required if PKCE was used to authorize the token
:param list scope: list of scopes to request on refresh. If left blank,
refresh will request all available scopes for application
:param str ca_certs: path to CA certificate. If left blank, default certificate location \
will be used
:param str ca_certs: a path to a file of concatenated CA certificates in PEM format.
Has the same meaning as when using :func:`ssl.wrap_socket`.
"""

if not (oauth2_access_token or oauth2_refresh_token or (app_key and app_secret)):
Expand Down Expand Up @@ -590,7 +590,6 @@ def request_json_string(self,
headers=headers,
data=body,
stream=stream,
verify=True,
timeout=timeout,
)
self.raise_dropbox_error_for_resp(r)
Expand Down
6 changes: 3 additions & 3 deletions dropbox/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -10868,7 +10868,7 @@ def _process_custom_annotations(self, annotation_type, field_path, processor):
SearchV2Cursor_validator = bv.String(min_length=1)
Sha256HexHash_validator = bv.String(min_length=64, max_length=64)
SharedLinkUrl_validator = bv.String()
TagText_validator = bv.String(min_length=1, max_length=32, pattern='[A-Za-z0-9_]+')
TagText_validator = bv.String(min_length=1, max_length=32, pattern='[\\w]+')
WritePath_validator = bv.String(pattern='(/(.|[\\r\\n])*)|(ns:[0-9]+(/.*)?)')
WritePathOrId_validator = bv.String(pattern='(/(.|[\\r\\n])*)|(ns:[0-9]+(/.*)?)|(id:.*)')
AddTagArg.path.validator = Path_validator
Expand Down Expand Up @@ -11086,7 +11086,7 @@ def _process_custom_annotations(self, annotation_type, field_path, processor):
('parent_rev', DeleteArg.parent_rev.validator),
]

DeleteBatchArg.entries.validator = bv.List(DeleteArg_validator)
DeleteBatchArg.entries.validator = bv.List(DeleteArg_validator, max_items=1000)
DeleteBatchArg._all_field_names_ = set(['entries'])
DeleteBatchArg._all_fields_ = [('entries', DeleteBatchArg.entries.validator)]

Expand Down Expand Up @@ -11979,7 +11979,7 @@ def _process_custom_annotations(self, annotation_type, field_path, processor):
('rev', MinimalFileLinkMetadata.rev.validator),
]

RelocationBatchArgBase.entries.validator = bv.List(RelocationPath_validator, min_items=1)
RelocationBatchArgBase.entries.validator = bv.List(RelocationPath_validator, min_items=1, max_items=1000)
RelocationBatchArgBase.autorename.validator = bv.Boolean()
RelocationBatchArgBase._all_field_names_ = set([
'entries',
Expand Down
Loading

0 comments on commit 7b3025e

Please sign in to comment.