From 3966b54f131b6407fdb5774818af65a8ba1589eb Mon Sep 17 00:00:00 2001 From: naemono Date: Tue, 16 Jan 2018 19:35:36 -0600 Subject: [PATCH 01/11] Release 0.4.9 Adjusting pypi url per recommendation --- setup.py | 2 +- tox.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index ba192f5..063f279 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import find_packages from setuptools import setup -VERSION = ('0', '4', '8') +VERSION = ('0', '4', '9') __version__ = '.'.join(VERSION) with open('README.md') as f: diff --git a/tox.ini b/tox.ini index 430cfff..000fc35 100644 --- a/tox.ini +++ b/tox.ini @@ -47,7 +47,7 @@ index-servers = pypitest [pypi] -repository = https://pypi.python.org/pypi +repository = https://upload.pypi.org/legacy/ [pypitest] repository = https://testpypi.python.org/pypi From 6dd702ca30ad8af6474305a43fe65a8908465a4c Mon Sep 17 00:00:00 2001 From: forrest andrews Date: Wed, 5 Sep 2018 13:22:24 -0500 Subject: [PATCH 02/11] don't try to subtract dicts from each other (#51) * don't try to subtract dicts from each other mongo 3.6 has added some additional information in the form of dicts to the network stats that is causing new relic stats collection to fail also upgrade to circleci 2 --- .circleci/config.yml | 56 +++++++++++++++++++++++++++++++ circle.yml | 31 ----------------- objectrocket/instances/mongodb.py | 2 +- requirements/dev.txt | 2 +- setup.py | 2 +- 5 files changed, 59 insertions(+), 34 deletions(-) create mode 100644 .circleci/config.yml delete mode 100644 circle.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..29758fb --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,56 @@ +version: 2 +jobs: + test: + docker: + - image: python:3.5 + working_directory: ~/python-client + steps: + - checkout + + - run: + command: pip install --upgrade pip tox + + - run: + command: | + tox -e lint + tox -e py35 + + pypi_upload: + docker: + - image: circleci/python:3.5 + steps: + - run: + command: tox -e build_pypi + + pypi_upload_rc: + docker: + - image: circleci/python:3.5 + steps: + - run: + command: tox -e build_testpypi + +workflows: + version: 2 + test: + jobs: + - test + pypi_upload: + jobs: + - pypi_upload: + requires: + - test + filters: + tags: + only: + - /^[0-9]+.[0-9]+.[0-9]+$/ + + - pypi_upload_rc: + requires: + - test + filters: + tags: + only: + - /^[0-9]+.[0-9]+.[0-9]+-rc[0-9]+$/ + + + \ No newline at end of file diff --git a/circle.yml b/circle.yml deleted file mode 100644 index 1a85f0d..0000000 --- a/circle.yml +++ /dev/null @@ -1,31 +0,0 @@ -machine: - environment: - COVERALLS_REPO_TOKEN: CUTHCbRbNtBjLFtFG4NSxVeIf1qQN3Zjo - - python: - version: 3.5.0 - -dependencies: - override: - - pip install -r requirements/dev.txt - - pip install tox-pyenv codecov coveralls twine - - pyenv local 2.7.10 3.5.0 - -test: - override: - - tox - - post: - - codecov - - coveralls - -deployment: - release: - tag: /^[0-9]+.[0-9]+.[0-9]+$/ - commands: - - tox -e build_pypi - - releaseCandidate: - tag: /^[0-9]+.[0-9]+.[0-9]+-rc[0-9]+$/ - commands: - - tox -e build_testpypi diff --git a/objectrocket/instances/mongodb.py b/objectrocket/instances/mongodb.py index f0d253a..ebbc17c 100644 --- a/objectrocket/instances/mongodb.py +++ b/objectrocket/instances/mongodb.py @@ -195,7 +195,7 @@ def _compile_new_relic_stats(self, stats_this_second, stats_next_second): first_doc = stats_this_second['aggregate_server_statistics'][subdoc] second_doc = stats_next_second['aggregate_server_statistics'][subdoc] keys = set(first_doc.keys()) | set(second_doc.keys()) - server_statistics_per_second[subdoc] = {key: int(second_doc[key]) - int(first_doc[key]) for key in keys} + server_statistics_per_second[subdoc] = {key: int(second_doc[key]) - int(first_doc[key]) for key in keys if isinstance(first_doc[key], int)} for node1, node2 in zip(stats_this_second['opcounters_per_node'], stats_next_second['opcounters_per_node']): node_opcounters_per_second = {} for repl, members in node2.items(): diff --git a/requirements/dev.txt b/requirements/dev.txt index a4f3ca1..1a78b3b 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -4,7 +4,7 @@ flake8>=2.1.0 mock>=1.0.1 pytest>=2.5.2 pytest-cov>=1.7.0 -setuptools>=2.1 +setuptools==40.2.0 sphinx_rtd_theme tox>=2.1 wheel>=0.22.0 diff --git a/setup.py b/setup.py index 063f279..567acbf 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import find_packages from setuptools import setup -VERSION = ('0', '4', '9') +VERSION = ('0', '4', '10') __version__ = '.'.join(VERSION) with open('README.md') as f: From a65868c7511ff49a5fbe304e53bf592b7fc6d5ef Mon Sep 17 00:00:00 2001 From: Forrest Andrews Date: Wed, 5 Sep 2018 14:45:12 -0500 Subject: [PATCH 03/11] more circle --- .circleci/config.yml | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 29758fb..32bfbff 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,17 +17,14 @@ jobs: pypi_upload: docker: - - image: circleci/python:3.5 + - image: python:3.5 steps: - - run: - command: tox -e build_pypi + - checkout - pypi_upload_rc: - docker: - - image: circleci/python:3.5 - steps: - run: - command: tox -e build_testpypi + command: | + pip install --upgrade pip tox + tox -e build_pypi workflows: version: 2 @@ -37,20 +34,9 @@ workflows: pypi_upload: jobs: - pypi_upload: - requires: - - test filters: tags: only: - /^[0-9]+.[0-9]+.[0-9]+$/ - - - pypi_upload_rc: - requires: - - test - filters: - tags: - only: - - /^[0-9]+.[0-9]+.[0-9]+-rc[0-9]+$/ - - - \ No newline at end of file + branches: + ignore: /.*/ \ No newline at end of file From 3082c2953b4e77a4adc686403f33014c3ab6560a Mon Sep 17 00:00:00 2001 From: Jesse Wiles Date: Mon, 24 Jun 2019 11:23:10 -0500 Subject: [PATCH 04/11] ORV4-314 pymongo-3.7.2 (#52) --- requirements/dev.txt | 2 +- requirements/prod.txt | 2 +- setup.py | 2 +- tox.ini | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/requirements/dev.txt b/requirements/dev.txt index 1a78b3b..3d0a1c9 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,5 +1,5 @@ -r prod.txt -Sphinx>=1.2.2 +Sphinx==1.8.5 flake8>=2.1.0 mock>=1.0.1 pytest>=2.5.2 diff --git a/requirements/prod.txt b/requirements/prod.txt index 37d7148..2c773fd 100644 --- a/requirements/prod.txt +++ b/requirements/prod.txt @@ -1,5 +1,5 @@ elasticsearch>=2.0.0 -pymongo>=2.7 +pymongo==3.7.2 redis>=2.0 requests>=2.0.0 six<2.0 diff --git a/setup.py b/setup.py index 567acbf..f0edd5b 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import find_packages from setuptools import setup -VERSION = ('0', '4', '10') +VERSION = ('0', '5', '0') __version__ = '.'.join(VERSION) with open('README.md') as f: diff --git a/tox.ini b/tox.ini index 000fc35..eecbff2 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 2.1 -envlist = lint,py27,py35 +envlist = lint,py27,py37 skipsdist = True [testenv] From 933b4f2d47eb6cb0041bbe213be560f5768e7f90 Mon Sep 17 00:00:00 2001 From: Jesse Wiles Date: Mon, 24 Jun 2019 14:04:48 -0500 Subject: [PATCH 05/11] Update package config (#54) --- setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index f0edd5b..4547519 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import find_packages from setuptools import setup -VERSION = ('0', '5', '0') +VERSION = ('0', '5', '1') __version__ = '.'.join(VERSION) with open('README.md') as f: @@ -20,6 +20,7 @@ include_package_data=True, install_requires=requirements, long_description=readme, + long_description_content_type='text/markdown', name='objectrocket', packages=find_packages(exclude=['tests*']), url='https://github.com/objectrocket/python-client/', @@ -31,8 +32,7 @@ 'Natural Language :: English', 'Operating System :: OS Independent', 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.7', 'Topic :: Database' ) ) From beab54c759ca824e4de14c68fffae0eee6352362 Mon Sep 17 00:00:00 2001 From: Jesse Wiles Date: Mon, 24 Jun 2019 14:23:27 -0500 Subject: [PATCH 06/11] Fix pypi upload (#55) --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4547519..fca9571 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import find_packages from setuptools import setup -VERSION = ('0', '5', '1') +VERSION = ('0', '5', '2') __version__ = '.'.join(VERSION) with open('README.md') as f: From 725be1dc095e17a7b8836ae42ea08becb03459c5 Mon Sep 17 00:00:00 2001 From: Freddy Esteban Perez <34690766+freddyperez1@users.noreply.github.com> Date: Wed, 15 Jan 2020 12:34:02 -0600 Subject: [PATCH 07/11] Bump pymongo (#56) * remove version number joined by dots, does not work well with release candidates. remove automatically upload to pypi. pymongo version bump. * python bump in circleci config * add py2 tests in circleci * version bump Co-authored-by: Freddy Esteban Perez <44184476+freddyesteban@users.noreply.github.com> --- .circleci/config.yml | 36 ++++++++++++++++-------------------- requirements/prod.txt | 2 +- setup.py | 3 +-- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 32bfbff..ce4cf6b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,42 +1,38 @@ version: 2 jobs: - test: + test-py2: docker: - - image: python:3.5 + - image: python:2.7 working_directory: ~/python-client steps: - checkout - run: command: pip install --upgrade pip tox - + - run: - command: | + command: | tox -e lint - tox -e py35 - - pypi_upload: + tox -e py27 + + test-py3: docker: - - image: python:3.5 + - image: python:3.7 + working_directory: ~/python-client steps: - checkout + - run: + command: pip install --upgrade pip tox + - run: command: | - pip install --upgrade pip tox - tox -e build_pypi + tox -e lint + tox -e py37 workflows: version: 2 test: jobs: - - test - pypi_upload: - jobs: - - pypi_upload: - filters: - tags: - only: - - /^[0-9]+.[0-9]+.[0-9]+$/ - branches: - ignore: /.*/ \ No newline at end of file + - test-py2 + - test-py3 \ No newline at end of file diff --git a/requirements/prod.txt b/requirements/prod.txt index 2c773fd..8d8fe3f 100644 --- a/requirements/prod.txt +++ b/requirements/prod.txt @@ -1,5 +1,5 @@ elasticsearch>=2.0.0 -pymongo==3.7.2 +pymongo==3.8.0 redis>=2.0 requests>=2.0.0 six<2.0 diff --git a/setup.py b/setup.py index fca9571..2ebfc0f 100755 --- a/setup.py +++ b/setup.py @@ -4,8 +4,7 @@ from setuptools import find_packages from setuptools import setup -VERSION = ('0', '5', '2') -__version__ = '.'.join(VERSION) +__version__ = '0.6.0' with open('README.md') as f: readme = f.read() From d5ed0f62630fa830b212d1db8c5702c9f1bfd775 Mon Sep 17 00:00:00 2001 From: Freddy Esteban Perez <44184476+freddyesteban@users.noreply.github.com> Date: Tue, 25 Aug 2020 11:19:20 -0500 Subject: [PATCH 08/11] Mongodb 4 2 support (#58) * Changelog update * Update to python 3.8 * Fix doc generation * Add ability to pass additional keyword arguments to client connection * version bump and changelog update --- .circleci/config.yml | 4 ++-- .gitignore | 3 +++ changelog.rst | 4 ++++ docs/source/conf.py | 2 +- objectrocket/__init__.py | 2 ++ objectrocket/instances/mongodb.py | 16 +++++++++------- requirements/prod.txt | 2 +- setup.py | 2 +- tox.ini | 2 +- 9 files changed, 24 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ce4cf6b..7cd5897 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,7 +17,7 @@ jobs: test-py3: docker: - - image: python:3.7 + - image: python:3.8 working_directory: ~/python-client steps: - checkout @@ -28,7 +28,7 @@ jobs: - run: command: | tox -e lint - tox -e py37 + tox -e py38 workflows: version: 2 diff --git a/.gitignore b/.gitignore index a9823c9..643bcde 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,6 @@ .cache build dist +.vscode/ +.python-version +.idea/ diff --git a/changelog.rst b/changelog.rst index 3d92504..659e3b4 100644 --- a/changelog.rst +++ b/changelog.rst @@ -1,6 +1,10 @@ changelog ========= +0.7.0 +----- +- Add ability to pass additional arguments when retrieving authenticated connection to instance. + 0.4.x ----- - New stats endpoint that provides instance stats (for consumption by newrelic) diff --git a/docs/source/conf.py b/docs/source/conf.py index 240350a..2fce43a 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -17,7 +17,7 @@ import sphinx_rtd_theme -from setup import __version__ +from objectrocket import __version__ # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the diff --git a/objectrocket/__init__.py b/objectrocket/__init__.py index 42e9110..ea0905a 100644 --- a/objectrocket/__init__.py +++ b/objectrocket/__init__.py @@ -1,3 +1,5 @@ """Top level package with imported objects for convenience.""" # Import this object for ease of access. from objectrocket.client import Client # noqa + +__version__ = '0.7.0' diff --git a/objectrocket/instances/mongodb.py b/objectrocket/instances/mongodb.py index ebbc17c..5bc9489 100644 --- a/objectrocket/instances/mongodb.py +++ b/objectrocket/instances/mongodb.py @@ -8,6 +8,7 @@ import requests from concurrent import futures +from distutils.version import LooseVersion from objectrocket import bases from objectrocket import util @@ -59,19 +60,21 @@ def compaction(self, request_compaction=False): return response.json() - def get_authenticated_connection(self, user, passwd, db='admin', ssl=True): + def get_authenticated_connection(self, user, passwd, db='admin', ssl=True, **kwargs): """Get an authenticated connection to this instance. :param str user: The username to use for authentication. :param str passwd: The password to use for authentication. :param str db: The name of the database to authenticate against. Defaults to ``'Admin'``. :param bool ssl: Use SSL/TLS if available for this instance. Defaults to ``True``. + :param kwargs: Additional keyword arguments to pass to MongoClient. :raises: :py:class:`pymongo.errors.OperationFailure` if authentication fails. """ # Attempt to establish an authenticated connection. try: - connection = self.get_connection(ssl=ssl) + connection = self.get_connection(ssl=ssl, **kwargs) connection[db].authenticate(user, passwd) + return connection # Catch exception here for logging, then just re-raise. @@ -79,12 +82,12 @@ def get_authenticated_connection(self, user, passwd, db='admin', ssl=True): logger.exception(ex) raise - def get_connection(self, ssl=True): + def get_connection(self, ssl=True, **kwargs): """Get a live connection to this instance. :param bool ssl: Use SSL/TLS if available for this instance. """ - return self._get_connection(ssl=ssl) + return self._get_connection(ssl=ssl, **kwargs) @util.token_auto_auth def shards(self, add_shard=False): @@ -264,7 +267,7 @@ def set_stepdown_window(self, start, end, enabled=True, scheduled=True, weekly=T ###################### # Private interface. # ###################### - def _get_connection(self, ssl): + def _get_connection(self, ssl, **kwargs): """Get a live connection to this instance.""" # Use SSL/TLS if requested and available. @@ -272,8 +275,7 @@ def _get_connection(self, ssl): if ssl and self.ssl_connect_string: connect_string = self.ssl_connect_string - return pymongo.MongoClient(connect_string) - + return pymongo.MongoClient(connect_string, **kwargs) class Shard(bases.Extensible): """An ObjectRocket MongoDB instance shard. diff --git a/requirements/prod.txt b/requirements/prod.txt index 8d8fe3f..df2d34d 100644 --- a/requirements/prod.txt +++ b/requirements/prod.txt @@ -1,5 +1,5 @@ elasticsearch>=2.0.0 -pymongo==3.8.0 +pymongo==3.10.1 redis>=2.0 requests>=2.0.0 six<2.0 diff --git a/setup.py b/setup.py index 2ebfc0f..43c8764 100755 --- a/setup.py +++ b/setup.py @@ -3,8 +3,8 @@ """Setup script for ObjectRocket Python client.""" from setuptools import find_packages from setuptools import setup +from objectrocket import __version__ -__version__ = '0.6.0' with open('README.md') as f: readme = f.read() diff --git a/tox.ini b/tox.ini index eecbff2..49b0655 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 2.1 -envlist = lint,py27,py37 +envlist = lint,py27,py38 skipsdist = True [testenv] From 89ef5c608f727e9cb8178e25b3cc0495d36eac58 Mon Sep 17 00:00:00 2001 From: Freddy Esteban Perez <44184476+freddyesteban@users.noreply.github.com> Date: Tue, 25 Aug 2020 11:36:04 -0500 Subject: [PATCH 09/11] fix it (#59) --- requirements/dev.txt | 1 + tox.ini | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements/dev.txt b/requirements/dev.txt index 3d0a1c9..9304148 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -10,3 +10,4 @@ tox>=2.1 wheel>=0.22.0 git+https://github.com/mverteuil/pytest-ipdb.git responses>=0.4.0 +twine \ No newline at end of file diff --git a/tox.ini b/tox.ini index 49b0655..9b1df56 100644 --- a/tox.ini +++ b/tox.ini @@ -13,7 +13,7 @@ recreate = False commands = {envbindir}/py.test --cov objectrocket --cov-report term-missing {toxinidir}/tests [testenv:build_pypi] -deps = twine +deps = -r requirements/dev.txt commands = {envbindir}/python setup.py clean bdist_wheel {toxinidir}/scripts/upload_to_pypi.sh pypi From 56451b207ce60079c6c459df4ba1afef1cd60615 Mon Sep 17 00:00:00 2001 From: Eric Bellefontaine Date: Wed, 9 Dec 2020 13:20:47 -0600 Subject: [PATCH 10/11] Add docker authentication --- .circleci/config.yml | 45 ++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7cd5897..c49b92b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,38 +1,47 @@ version: 2 +references: + objectrocket-docker-auth: &objectrocket-docker-auth + auth: + username: ${DOCKER_USERNAME} + password: ${DOCKER_PASSWORD} + context-to-use: &context-to-use + context: objectrocket-shared jobs: test-py2: docker: - - image: python:2.7 + - <<: *objectrocket-docker-auth + image: python:2.7 working_directory: ~/python-client steps: - - checkout + - checkout - - run: - command: pip install --upgrade pip tox + - run: + command: pip install --upgrade pip tox - - run: - command: | - tox -e lint - tox -e py27 + - run: + command: | + tox -e lint + tox -e py27 test-py3: docker: - - image: python:3.8 + - <<: *objectrocket-docker-auth + image: python:3.8 working_directory: ~/python-client steps: - - checkout + - checkout - - run: - command: pip install --upgrade pip tox + - run: + command: pip install --upgrade pip tox - - run: - command: | - tox -e lint - tox -e py38 + - run: + command: | + tox -e lint + tox -e py38 workflows: version: 2 test: jobs: - - test-py2 - - test-py3 \ No newline at end of file + - test-py2: *context-to-use + - test-py3: *context-to-use From d27778a50e3c4a3d06108bb8f90dbfc2ed0584f6 Mon Sep 17 00:00:00 2001 From: Eric Bellefontaine Date: Tue, 15 Dec 2020 15:48:54 -0600 Subject: [PATCH 11/11] Add stale.yml --- .github/stale.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/stale.yml diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 0000000..d93a1a6 --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,16 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 30 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 7 +# Issues with these labels will never be considered stale +exemptLabels: +- security +# Label to use when marking an issue as stale +staleLabel: stale +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false