Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: IBM/cloudant-python-sdk
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.8.1
Choose a base ref
...
head repository: IBM/cloudant-python-sdk
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
Showing with 8,422 additions and 4,965 deletions.
  1. +0 −26 .bumpversion.cfg
  2. +30 −0 .bumpversion.toml
  3. +1 −1 .github/ISSUE_TEMPLATE/bug_report.md
  4. +6 −0 .github/dependabot.yml
  5. +5 −4 .github/workflows/codeql.yml
  6. +5 −4 .github/workflows/docs.yml
  7. +4 −3 .github/workflows/test.yml
  8. +1 −0 .pylintrc
  9. +21 −23 Jenkinsfile
  10. +48 −102 README.md
  11. +96 −92 examples/README.md
  12. +2 −2 examples/snippets/deleteAttachment/example_request.py
  13. +3 −3 examples/snippets/deleteDocument/example_request.py
  14. +2 −2 examples/snippets/getAttachment/example_request.py
  15. +1 −1 examples/snippets/getDocument/example_request.py
  16. +1 −1 examples/snippets/getDocumentShardsInfo/example_request.py
  17. +2 −2 examples/snippets/getPartitionInformation/example_request.py
  18. +4 −4 examples/snippets/getSearchInfo/example_request.py
  19. +2 −2 examples/snippets/headAttachment/example_request.py
  20. +2 −2 examples/snippets/headDesignDocument/example_request.py
  21. +2 −2 examples/snippets/headDocument/example_request.py
  22. +1 −1 examples/snippets/postAllDocsQueries/example_request.py
  23. +4 −4 examples/snippets/postBulkDocs/example_request_as_a_stream.py
  24. +4 −4 examples/snippets/postBulkDocs/example_request_create_documents.py
  25. +2 −2 examples/snippets/postBulkDocs/example_request_delete_documents.py
  26. +2 −2 examples/snippets/postDocument/example_request.py
  27. +1 −1 examples/snippets/postFind/example_request_for_json_index_type.py
  28. +1 −1 examples/snippets/postFind/example_request_for_text_index_type.py
  29. +0 −12 examples/snippets/postMissingRevs/example_request.py
  30. +2 −2 examples/snippets/postPartitionAllDocs/example_request.py
  31. +14 −0 examples/snippets/postPartitionExplain/example_request.py
  32. +4 −4 examples/snippets/postPartitionFind/example_request.py
  33. +6 −6 examples/snippets/postPartitionSearch/example_request.py
  34. +6 −5 examples/snippets/postPartitionView/example_request.py
  35. +2 −0 examples/snippets/postRevsDiff/example_request.py
  36. +1 −1 examples/snippets/putAttachment/example_request.py
  37. +1 −1 examples/snippets/putDatabase/example_request.py
  38. +10 −10 examples/snippets/putDesignDocument/example_request.py
  39. +2 −2 examples/snippets/putDocument/example_request.py
  40. +3 −3 examples/snippets/putLocalDocument/example_request.py
  41. +4 −2 ibmcloudant/__init__.py
  42. +99 −21 ibmcloudant/cloudant_base_service.py
  43. +1,539 −566 ibmcloudant/cloudant_v1.py
  44. +26 −16 ibmcloudant/features/changes_follower.py
  45. +1 −1 ibmcloudant/version.py
  46. +15 −7 pyproject.toml
  47. +7 −7 requirements-dev.txt
  48. +3 −3 requirements-docs.txt
  49. +3,675 −2,769 stubs/gen-its-mappings.json
  50. +481 −377 stubs/mappings.json
  51. +196 −57 test/integration/test_cloudant_v1.py
  52. +17 −33 test/unit/features/conftest.py
  53. +163 −172 test/unit/features/test_changes_follower.py
  54. +476 −0 test/unit/test_cloudant_base_error_augment.py
  55. +1,416 −597 test/unit/test_cloudant_v1.py
26 changes: 0 additions & 26 deletions .bumpversion.cfg

This file was deleted.

30 changes: 30 additions & 0 deletions .bumpversion.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[tool.bumpversion]
current_version = "0.10.1"
commit = true
message = "Update version {current_version} -> {new_version}"
parse = "^(?P<major>0|[1-9]\\d*)\\.(?P<minor>0|[1-9]\\d*)\\.(?P<patch>0|[1-9]\\d*)(?P<prerelease>[a|b|rc](?:0|[1-9]\\d*))?(?P<devrelease>(?:\\.dev)(?:0|[1-9]\\d*))?(?P<buildmetadata>\\+[0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*)?$"
serialize = [
"{major}.{minor}.{patch}{prerelease}{devrelease}{buildmetadata}",
"{major}.{minor}.{patch}{prerelease}{devrelease}",
"{major}.{minor}.{patch}{prerelease}{buildmetadata}",
"{major}.{minor}.{patch}{prerelease}",
"{major}.{minor}.{patch}{devrelease}{buildmetadata}",
"{major}.{minor}.{patch}{devrelease}",
"{major}.{minor}.{patch}{buildmetadata}",
"{major}.{minor}.{patch}",
]

[[tool.bumpversion.files]]
filename = "ibmcloudant/version.py"
search = "__version__ = '{current_version}'"
replace = "__version__ = '{new_version}'"

[[tool.bumpversion.files]]
filename = "pyproject.toml"
search = "version = \"{current_version}\""
replace = "version = \"{new_version}\""

[[tool.bumpversion.files]]
filename = "README.md"
search = "{current_version}"
replace = "{new_version}"
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ assignees: ''

**Must gather (please complete the following information):**
- SDK Version [e.g. 1.2.1]
- Python Version [e.g. Python 3.8]
- Python Version [e.g. Python 3.9]
- Name of service that you're trying to use (if applicable)
- Name of operation that you're trying to invoke (if applicable)

6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
pull-request-branch-name:
separator: "-"
- package-ecosystem: "pip"
directory: "/"
open-pull-requests-limit: 10
9 changes: 5 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ on:
branches: ['main']
schedule:
- cron: '00 4 * * 2'
permissions: {}
jobs:
analyze:
name: Analyze
@@ -18,17 +19,17 @@ jobs:
language: ['python']
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
with:
languages: ${{ matrix.language }}
config: |
paths-ignore:
- 'examples/snippets/**/*.py'
- name: Autobuild
uses: github/codeql-action/autobuild@v3
uses: github/codeql-action/autobuild@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
with:
category: "/language:${{matrix.language}}"
9 changes: 5 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -2,18 +2,19 @@ name: docs
on:
pull_request:
branches: ['main']
permissions: {}
jobs:
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Setup python 3.12
uses: actions/setup-python@v5
- name: Setup python 3.13
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
with:
python-version: '3.12'
python-version: '3.13'
cache: 'pip'
- name: Install deps
run: pip install -r requirements-docs.txt
7 changes: 4 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ on:
branches: ['main']
pull_request:
branches-ignore: ['gh-pages']
permissions: {}
env:
SERVER_AUTH_TYPE: basic
SERVER_URL: http://127.0.0.1:5984
@@ -15,7 +16,7 @@ jobs:
test:
strategy:
matrix:
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
runs-on: ubuntu-latest
services:
couchdb:
@@ -33,11 +34,11 @@ jobs:
- 8080:8080
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Setup python ${{ matrix.python }}
uses: actions/setup-python@v5
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
with:
python-version: ${{ matrix.python }}
cache: 'pip'
1 change: 1 addition & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -45,6 +45,7 @@ confidence=HIGH
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
disable=too-many-arguments,
too-many-positional-arguments,
too-many-public-methods,
too-few-public-methods,
too-many-instance-attributes,
44 changes: 21 additions & 23 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -14,7 +14,6 @@ pipeline {
regex: /NONE|${globals.SVRE_PRE_RELEASE}/)
}
environment {
GH_CREDS = credentials('gh-sdks-automation')
ARTIFACTORY_CREDS = credentials('artifactory')
ARTIFACTORY_URL_UP = "${Artifactory.server('taas-artifactory-upload').getUrl()}"
ARTIFACTORY_URL_DOWN = "${Artifactory.server('taas-artifactory').getUrl()}"
@@ -26,12 +25,6 @@ pipeline {
defaultInit()
applyCustomizations()
commitHash = "${env.GIT_COMMIT.take(7)}"
sh '''
git config --global user.email $GH_SDKS_AUTOMATION_MAIL
git config --global user.name $GH_CREDS_USR
git config --global credential.username $GH_CREDS_USR
git config --global credential.helper '!f() { echo password=\$GH_CREDS_PSW; echo; }; f'
'''
}
}
}
@@ -69,10 +62,13 @@ pipeline {
environment {
scannerHome = tool 'SonarQubeScanner'
}
// Scanning runs only on non-dependabot branches
// Scanning runs on dependabot core update and non-dependabot branches
when {
not {
branch 'dependabot*'
anyOf {
branch pattern: /^dependabot.*(?i)(ibm)[\.-].+sdk-core.*$/, comparator: 'REGEXP'
not {
branch 'dependabot*'
}
}
}
steps {
@@ -106,7 +102,6 @@ pipeline {
steps {
script {
buildResults = null
prefixedSdkVersion = "${testVersionPrefix}${env.NEW_SDK_VERSION}"

// For standard builds attempt to run on a matching env.BRANCH_NAME branch first and if it doesn't exist
// then fallback to TARGET_GAUGE_RELEASE_BRANCH_NAME if set or env.TARGET_GAUGE_DEFAULT_BRANCH_NAME.
@@ -122,14 +117,14 @@ pipeline {
try {
buildResults = build job: "/${env.SDKS_GAUGE_PIPELINE_PROJECT}/${gaugeBranchName}", parameters: [
string(name: 'SDK_RUN_LANG', value: "$libName"),
string(name: "SDK_VERSION_${libName.toUpperCase()}", value: "$prefixedSdkVersion")]
string(name: "SDK_VERSION_${libName.toUpperCase()}", value: "${env.NEW_SDK_VERSION}")]
} catch (hudson.AbortException ae) {
// only run build in sdks-gauge default branch if BRANCH_NAME doesn't exist
if (ae.getMessage().contains("No item named /${env.SDKS_GAUGE_PIPELINE_PROJECT}/${gaugeBranchName} found")) {
echo "No matching branch named '${gaugeBranchName}' in sdks-gauge, building ${fallbackBranchName} branch"
build job: "/${env.SDKS_GAUGE_PIPELINE_PROJECT}/${fallbackBranchName}", parameters: [
string(name: 'SDK_RUN_LANG', value: "$libName"),
string(name: "SDK_VERSION_${libName.toUpperCase()}", value: "$prefixedSdkVersion")]
string(name: "SDK_VERSION_${libName.toUpperCase()}", value: "${env.NEW_SDK_VERSION}")]
} else {
throw ae
}
@@ -149,10 +144,12 @@ pipeline {
}
}
steps {
// bump the version
bumpVersion(false)
// Push the version bump and release tag
sh 'git push --tags origin HEAD:main'
gitsh('github.com') {
// bump the version
bumpVersion(false)
// Push the version bump and release tag
sh 'git push --tags origin HEAD:main'
}
}
}
stage('Publish[repository]') {
@@ -168,7 +165,9 @@ pipeline {
}
steps {
publishPublic()
publishDocs()
gitsh('github.com') {
publishDocs()
}
}
}
}
@@ -190,7 +189,7 @@ def buildType
def scanCode

void defaultInit() {
// Default to using bump2version
// Default to using bump-my-version
bumpVersion = { isDevRelease ->
newVersion = getNewVersion(isDevRelease)
// Set an env var with the new version
@@ -199,7 +198,7 @@ void defaultInit() {
}

doVersionBump = { isDevRelease, newVersion, allowDirty ->
sh "bump2version --new-version ${newVersion} ${allowDirty ? '--allow-dirty': ''} ${isDevRelease ? '--no-commit' : '--tag --tag-message "Release {new_version}"'} patch"
sh "bump-my-version bump patch --new-version ${newVersion} ${allowDirty ? '--allow-dirty': ''} ${isDevRelease ? '--no-commit' : '--tag --tag-message "Release {new_version}"'}"
}

getNewVersion = { isDevRelease ->
@@ -213,7 +212,7 @@ void defaultInit() {
version = params.TARGET_VERSION
} else {
// If a target version is not provided default to a patch bump
version = sh returnStdout: true, script: 'bump2version --list --dry-run patch | grep new_version=.* | cut -f2 -d='
version = sh returnStdout: true, script: 'bump-my-version show-bump --ascii | grep patch | rev | cut -f1 -d " " | rev'
}
return version.trim()
}
@@ -279,7 +278,6 @@ void defaultInit() {
// + other customizations
void applyCustomizations() {
libName = 'python'
testVersionPrefix = '=='
customizeVersion = { semverFormatVersion ->
// Use a python format version
semverFormatVersion.replace('-a','a').replace('-b','b').replace('-rc', 'rc').replace('-','.')
@@ -296,7 +294,7 @@ void runTests() {
sh '''
export PIP_INDEX_URL=https://${ARTIFACTORY_CREDS_USR}:${ARTIFACTORY_CREDS_PSW}@${ARTIFACTORY_URL_DOWN##'https://'}/api/pypi/cloudant-sdks-pypi-virtual/simple
pip install -r requirements-dev.txt && flit install --only-deps
pylint --rcfile=.pylintrc ibmcloudant test
pylint --rcfile=.pylintrc ibmcloudant
python3 -m pytest --junitxml=junitreports/junit-pytest.xml --cov=ibmcloudant
'''
}
Loading