[med-svn] [Git][med-team/python-etelemetry][upstream] New upstream version 0.2.2

Andreas Tille gitlab at salsa.debian.org
Tue Sep 29 09:09:33 BST 2020



Andreas Tille pushed to branch upstream at Debian Med / python-etelemetry


Commits:
88a30e7d by Andreas Tille at 2020-09-29T09:46:21+02:00
New upstream version 0.2.2
- - - - -


7 changed files:

- + .github/workflows/pythonpackage.yml
- + .github/workflows/pythonpublish.yml
- .gitignore
- − .travis.yml
- README.md
- etelemetry/client.py
- setup.cfg


Changes:

=====================================
.github/workflows/pythonpackage.yml
=====================================
@@ -0,0 +1,40 @@
+# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
+# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
+
+name: Python package
+
+on:
+  push:
+    branches: [ master ]
+  pull_request:
+    branches: [ master ]
+
+jobs:
+  build:
+
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        os: [ubuntu-latest, macos-latest, windows-latest]
+        python-version: [3.6, 3.7, 3.8]
+
+    steps:
+    - uses: actions/checkout at v2
+    - name: Set up Python ${{ matrix.python-version }}
+      uses: actions/setup-python at v2
+      with:
+        python-version: ${{ matrix.python-version }}
+    - name: Install dependencies
+      run: |
+        python -m pip install --upgrade pip setuptools
+        pip install -U -e .[test]
+    - name: Test with pytest
+      run: |
+        pytest -vs --cov ./ --cov-config .coveragerc --cov-report xml:cov.xml --doctest-modules etelemetry
+    - uses: codecov/codecov-action at v1
+      with:
+        token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
+        file: ./cov.xml # optional
+        flags: unittests # optional
+        name: codecov-et # optional
+        fail_ci_if_error: true # optional (default = false)
\ No newline at end of file


=====================================
.github/workflows/pythonpublish.yml
=====================================
@@ -0,0 +1,31 @@
+# This workflows will upload a Python Package using Twine when a release is created
+# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
+
+name: Upload Python Package
+
+on:
+  release:
+    types: [created]
+
+jobs:
+  deploy:
+
+    runs-on: ubuntu-latest
+
+    steps:
+    - uses: actions/checkout at v2
+    - name: Set up Python
+      uses: actions/setup-python at v1
+      with:
+        python-version: '3.x'
+    - name: Install dependencies
+      run: |
+        python -m pip install --upgrade pip
+        pip install setuptools wheel twine
+    - name: Build and publish
+      env:
+        TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
+        TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
+      run: |
+        python setup.py bdist_wheel
+        twine upload dist/*


=====================================
.gitignore
=====================================
@@ -3,8 +3,10 @@
 *.egg-info/
 __pycache__/
 .pytest_cache/
-
+*pyc
 .coverage*
 cov.xml
 build
 dist
+.idea
+.DS_Store
\ No newline at end of file


=====================================
.travis.yml deleted
=====================================
@@ -1,15 +0,0 @@
-# vim ft=yaml
-language: python
-python:
-  - 3.5
-  - 3.6
-  - 3.7
-
-install:
-  - pip install -U -e .[test]
-
-script:
-  - pytest -vs --cov etelemetry --cov-config .coveragerc --cov-report xml:cov.xml --doctest-modules etelemetry
-
-after_success:
-  - codecov --file cov.xml --flags unittests -e TRAVIS_JOB_NUMBER


=====================================
README.md
=====================================
@@ -25,9 +25,36 @@ can use the following form
 
 ```python
 import etelemetry
-etelemetry.check_available_version("nipy/nipype", "1.2.1")
+etelemetry.check_available_version("nipy/nipype", "1.2.1") # github_org/project
 
 A newer version (1.4.2) of nipy/nipype is available. You are using 1.2.1
 You are using a version of nipy/nipype with a critical bug. Please use a different version.
 returns: {'version': '1.4.2', 'bad_versions': ['1.2.1', '1.2.3', '1.3.0']}
-```
\ No newline at end of file
+```
+
+### Adding etelemetry to your project
+
+You can include etelemetry in your project by adding `etelemetry` package to your setup process 
+and by adding the following snippet to your `__init__.py`. The code snippet below assumes you 
+have a `__version__` and `usemylogger` (logger) variables available. The check takes the form 
+of `github_org/project`.
+
+```python
+# Run telemetry on import for interactive sessions, such as IPython, Jupyter
+# notebooks, Python REPL
+import __main__
+
+if not hasattr(__main__, "__file__"):
+    import etelemetry
+    etelemetry.check_available_version("dandi/dandi-cli", __version__, lgr=usemylogger)
+```
+
+To add support checking for bad versions you will need to add a file named
+`.et` to your github project containing a simple json snippet. 
+
+```json
+{ "bad_versions" : []
+}
+```
+
+Here is an example: https://github.com/nipy/nipype/blob/master/.et


=====================================
etelemetry/client.py
=====================================
@@ -1,21 +1,33 @@
 from requests import request, ConnectionError, ReadTimeout
 import os
 
-import ci
+try:
+    import ci_info
+except ImportError:
+    import warnings
+    warnings.warn(
+        "Deprecated version of ci-info found, upgrade to remove this warning", DeprecationWarning
+    )
+    import ci as ci_info
 
 from .config import ET_PROJECTS
 
 _available_version_checked = None
 
 
+class BadVersionError(RuntimeError):
+    """Local version is known to contain a critical bug etc."""
+    pass
+
+
 def _etrequest(endpoint, method="get", **kwargs):
     if kwargs.get('timeout') is None:
         kwargs['timeout'] = 5
 
     params = {}
-    if ci.is_ci():
+    if ci_info.is_ci():
         # send along CI information
-        params = ci.info()
+        params = ci_info.info()
 
     try:
         res = request(method, endpoint, params=params, **kwargs)
@@ -58,6 +70,7 @@ def get_project(repo, **rargs):
 def check_available_version(project, version, lgr=None, raise_exception=False):
     """A helper to check (and report) if newer version of project is available
     Should be ok to execute multiple times, it will be checked only one time
+
     Parameters
     ----------
     project: str
@@ -67,7 +80,7 @@ def check_available_version(project, version, lgr=None, raise_exception=False):
     lgr: python logger object
       external logger to be used
     raise_exception: bool
-      raise an exception if a bad local version is detected
+      raise a BadVersionError exception if a bad local version is detected
     """
     global _available_version_checked
     if _available_version_checked is not None:
@@ -110,7 +123,7 @@ def check_available_version(project, version, lgr=None, raise_exception=False):
                 message = ("You are using a version of {0} with a critical bug. "
                           "Please use a different version.").format(project)
                 if raise_exception:
-                    raise RuntimeError(message)
+                    raise BadVersionError(message)
                 else:
                     lgr.critical(message)
             _available_version_checked = latest


=====================================
setup.cfg
=====================================
@@ -1,5 +1,5 @@
 [metadata]
-url = https://github.com/mgxd/etelemetry-client
+url = https://github.com/sensein/etelemetry-client
 author = Senseable Intelligence Group
 maintainer = Mathias Goncalves
 maintainer_email = mathiasg at mit.edu
@@ -13,15 +13,15 @@ classifiers =
     Development Status :: 3 - Alpha
     Intended Audience :: Science/Research
     License :: OSI Approved :: Apache Software License
-    Programming Language :: Python :: 3.5
     Programming Language :: Python :: 3.6
     Programming Language :: Python :: 3.7
+    Programming Language :: Python :: 3.8
 
 [options]
-python_requires = >= 3.5
+python_requires = >= 3.6
 install_requires =
     requests
-    ci-info
+    ci-info >= 0.2
 test_requires =
     pytest >= 4.4.0
     pytest-cov
@@ -39,6 +39,9 @@ tests =
 all =
     %(test)s
 
+[flake8]
+max-line-length = 99
+
 [versioneer]
 VCS = git
 style = pep440



View it on GitLab: https://salsa.debian.org/med-team/python-etelemetry/-/commit/88a30e7d17c79c9f2507ff1e8fbe2696f2c98ffa

-- 
View it on GitLab: https://salsa.debian.org/med-team/python-etelemetry/-/commit/88a30e7d17c79c9f2507ff1e8fbe2696f2c98ffa
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20200929/17d78499/attachment-0001.html>


More information about the debian-med-commit mailing list