[med-svn] [Git][med-team/python-etelemetry][master] 6 commits: New upstream version 0.2.2
Andreas Tille
gitlab at salsa.debian.org
Tue Sep 29 09:09:28 BST 2020
Andreas Tille pushed to branch master at Debian Med / python-etelemetry
Commits:
88a30e7d by Andreas Tille at 2020-09-29T09:46:21+02:00
New upstream version 0.2.2
- - - - -
b006f855 by Andreas Tille at 2020-09-29T09:46:21+02:00
routine-update: New upstream version
- - - - -
d590dc79 by Andreas Tille at 2020-09-29T09:46:21+02:00
Update upstream source from tag 'upstream/0.2.2'
Update to upstream version '0.2.2'
with Debian dir b87deef1a5eb6a43e063b8b5a0c25e8bdd52e983
- - - - -
8ac0827e by Andreas Tille at 2020-09-29T09:46:22+02:00
routine-update: debhelper-compat 13
- - - - -
aad6c49a by Andreas Tille at 2020-09-29T10:03:16+02:00
Adapt patches
- - - - -
52bb6848 by Andreas Tille at 2020-09-29T10:09:12+02:00
ci-info package is mandatory now and it does not seem to be possible to easily skip it via debian/patches/deb_optional_ci
- - - - -
10 changed files:
- + .github/workflows/pythonpackage.yml
- + .github/workflows/pythonpublish.yml
- .gitignore
- − .travis.yml
- README.md
- debian/changelog
- debian/control
- debian/patches/deb_optional_ci
- 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
=====================================
debian/changelog
=====================================
@@ -1,3 +1,12 @@
+python-etelemetry (0.2.2-1) UNRELEASED; urgency=medium
+
+ * New upstream version
+ * debhelper-compat 13 (routine-update)
+ TODO: ci-info package is mandatory now and it does not seem to be
+ possible to easily skip it via debian/patches/deb_optional_ci
+
+ -- Andreas Tille <tille at debian.org> Tue, 29 Sep 2020 09:46:21 +0200
+
python-etelemetry (0.2.0-3) unstable; urgency=medium
[ Sao I Kuan ]
=====================================
debian/control
=====================================
@@ -4,7 +4,7 @@ Priority: optional
Maintainer: Debian Med Packaging Team <debian-med-packaging at lists.alioth.debian.org>
Uploaders: Andreas Tille <tille at debian.org>,
Yaroslav Halchenko <debian at onerussian.com>,
-Build-Depends: debhelper-compat (= 12),
+Build-Depends: debhelper-compat (= 13),
dh-python,
python3-all,
python3-setuptools,
=====================================
debian/patches/deb_optional_ci
=====================================
@@ -4,39 +4,15 @@ Subject: Make use of ci module (from ci-info package) optional
Origin: Debian
Last-Update: 2020-03-23
---- a/etelemetry/client.py
-+++ b/etelemetry/client.py
-@@ -1,7 +1,11 @@
- from requests import request, ConnectionError, ReadTimeout
- import os
-
--import ci
-+try:
-+ import ci
-+except ImportError:
-+ # No ci module on Debian yet, we just will not provide CI information
-+ ci = None
-
- from .config import ET_PROJECTS
-
-@@ -13,7 +17,7 @@ def _etrequest(endpoint, method="get", *
- kwargs['timeout'] = 5
-
- params = {}
-- if ci.is_ci():
-+ if ci and ci.is_ci():
- # send along CI information
- params = ci.info()
-
--- a/setup.cfg
+++ b/setup.cfg
@@ -21,7 +21,8 @@ classifiers =
- python_requires = >= 3.5
+ python_requires = >= 3.6
install_requires =
requests
-- ci-info
+- ci-info >= 0.2
+ # No ci-info on debian yet, so we will not require it
-+ # ci-info
++ # ci-info >= 0.2
test_requires =
pytest >= 4.4.0
pytest-cov
=====================================
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/-/compare/0848b2b75a3208711d3b1602b7fa1c808b01b65d...52bb6848e2ec1d30eb506f3a39253291442700da
--
View it on GitLab: https://salsa.debian.org/med-team/python-etelemetry/-/compare/0848b2b75a3208711d3b1602b7fa1c808b01b65d...52bb6848e2ec1d30eb506f3a39253291442700da
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/b8195798/attachment-0001.html>
More information about the debian-med-commit
mailing list