Skip to content

Commit fa53a9d

Browse files
author
Dejan Knezevic
committed
Remove python 2 support
- remove six - update ci - remove __ne__ methods - use f-strings - Update classes (remove object as inheritance) and super calls
1 parent ce39166 commit fa53a9d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+896
-1431
lines changed

.coveragerc

Whitespace-only changes.

.github/workflows/python-package.yml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
pull_request:
8+
branches:
9+
- develop
10+
release:
11+
types:
12+
- published
13+
14+
jobs:
15+
tests:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
python-version:
20+
- 3.6
21+
- 3.7
22+
- 3.8
23+
- 3.9
24+
steps:
25+
- uses: actions/checkout@v2
26+
- name: Set up Python ${{ matrix.python-version }}
27+
uses: actions/setup-python@v2
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
- name: Install dependencies
31+
run: |
32+
pip install -r requirements-dev.txt
33+
- name: Test with pytest
34+
run: |
35+
flake8
36+
pytest --verbose --cov-config setup.cfg
37+
38+
release:
39+
needs: tests
40+
if: github.event_name == 'release' && github.event.action == 'published'
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v2
44+
- name: Set up Python
45+
uses: actions/setup-python@v2
46+
with:
47+
python-version: 3.9
48+
- name: Build and publish
49+
env:
50+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
51+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
52+
run: |
53+
pip install wheel twine
54+
export PACKAGE_VERSION=${GITHUB_REF:10}
55+
echo "__version__ = '$PACKAGE_VERSION'" > sevenbridges/version.py
56+
python setup.py sdist bdist_wheel
57+
twine upload dist/*

.gitlab-ci.yml

+12-30
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
image: python:3.8-buster
2-
3-
variables:
4-
REQUIREMENTS: "requirements.txt"
5-
REQUIREMENTS2: "requirements2.txt"
1+
image: python:3.9-slim-buster
62

73
stages:
84
- test
@@ -11,54 +7,40 @@ stages:
117
.test: &test
128
stage: test
139
before_script:
14-
- infinity config build-info
1510
- python --version
16-
- pip install -U -r $REQUIREMENTS
11+
- pip install -r requirements-dev.txt
1712
- export PYTHONPATH=$(pwd):$PYTHONPATH
1813
script:
1914
- flake8
20-
- pytest -v --cov-config setup.cfg
15+
- pytest --verbose --cov-config setup.cfg
2116
artifacts:
2217
paths:
2318
- coverage_report/*
2419

25-
# Test with python 2.7
26-
test:2.7:
27-
stage: test
28-
before_script:
29-
- infinity config build-info
30-
- python --version
31-
- pip install -U -r $REQUIREMENTS2
32-
- export PYTHONPATH=$(pwd):$PYTHONPATH
33-
script:
34-
- flake8
35-
- pytest -v --cov-config setup.cfg
36-
image: python:2.7
37-
38-
# Test with python 3.5
39-
test:3.5:
40-
<<: *test
41-
image: python:3.5
42-
4320
# Test with python 3.6
4421
test:3.6:
4522
<<: *test
46-
image: python:3.6
23+
image: python:3.6-slim-buster
4724

4825
# Test with python 3.7
4926
test:3.7:
5027
<<: *test
51-
image: python:3.7-stretch
28+
image: python:3.7-slim-buster
5229

5330
# Test with python 3.8
5431
test:3.8:
5532
<<: *test
56-
image: python:3.8-buster
33+
image: python:3.8-slim-buster
34+
35+
# Test with python 3.9
36+
test:3.9:
37+
<<: *test
38+
image: python:3.9-slim-buster
5739

5840
sonar:
5941
stage: sonar
6042
image: emeraldsquad/sonar-scanner:1.0.0
6143
script: infinity sonar scanner
6244
allow_failure: true
6345
dependencies:
64-
- test:3.8
46+
- test:3.9

.travis.yml

-33
This file was deleted.

MANIFEST.in

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
include sevenbridges/VERSION LICENCE README.md requirements*.txt setup.cfg
1+
include LICENCE
2+
include README.md

README.md

+9-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
sevenbridges-python
22
===================
33

4-
[![Travis](https://travis-ci.org/sbg/sevenbridges-python.svg)](https://travis-ci.org/sbg/sevenbridges-python)
54
[![PyPI version](https://badge.fury.io/py/sevenbridges-python.svg)](https://pypi.python.org/pypi/sevenbridges-python)
65
[![Documentation](https://readthedocs.org/projects/sevenbridges-python/badge/?version=latest)](http://sevenbridges-python.readthedocs.org/en/latest/)
76
[![Licence](https://img.shields.io/badge/licence-Apache-orange.svg)](https://github.com/sbg/sevenbridges-python/blob/develop/LICENCE)
@@ -12,7 +11,7 @@ sevenbridges-python is a [Python](http://www.python.org/) library that
1211
provides an interface for the [Seven Bridges Platform](https://www.sbgenomics.com/) the
1312
[Cancer Genomics Cloud](http://www.cancergenomicscloud.org/) and
1413
[Cavatica](http://www.cavatica.org) public APIs. It works with Python
15-
versions 2.6+ and supports Python 3.
14+
versions 3.6+.
1615

1716
The [Seven Bridges Platform](https://www.sbgenomics.com/) is a
1817
cloud-based environment for conducting bioinformatic analyses. It is a
@@ -32,7 +31,7 @@ than a petabyte of multi-dimensional data available immediately to
3231
authorized researchers. You can add your own data to analyze alongside
3332
TCGA using predefined analytical workflows or your own tools.
3433

35-
[Cavatica](http://www.cavatica.org/),
34+
The [Cavatica](http://www.cavatica.org/),
3635
powered by [Seven Bridges](https://www.sbgenomics.com/), is a data analysis and sharing
3736
platform designed to accelerate discovery in a scalable, cloud-based
3837
compute environment where data, results, and workflows are shared among
@@ -48,7 +47,7 @@ The latest documentation can be found on [readthedocs](http://sevenbridges-pytho
4847
Installation
4948
------------
5049

51-
The easiest way to install sevenbridges-python is using pip. :
50+
The easiest way to install sevenbridges-python is using pip:
5251

5352
$ pip install sevenbridges-python
5453

@@ -69,16 +68,15 @@ package, or install it into your site-packages by invoking: :
6968

7069
If you are interested in reviewing this documentation locally, clone
7170
this repository, position yourself in the docs directory and after
72-
installing `requirements.txt` (or `requirements2.txt` if using python 2), invoke:
71+
installing `requirements-dev.txt`, invoke:
7372

7473
$ make html
7574

7675
Run Tests
7776
---------
7877

7978
In order to run tests clone this repository, position yourself in the
80-
root of the cloned project and after installing `requirements.txt` (or
81-
`requirements2.txt` if using python 2), invoke:
79+
root of the cloned project and after installing `requirements-dev.txt`, invoke:
8280

8381
$ pytest
8482

@@ -116,8 +114,8 @@ before using this library:
116114
Initialize configuration using the configuration file
117115
-----------------------------------------------------
118116

119-
Once you obtain your authentication token you can pass it to the Config
120-
object. You can instantiate your API object by passing the appropriate
117+
Once you obtain your authentication token, you can pass it to the Config
118+
object. You can instantiate the API object by passing the appropriate
121119
configuration. There are three ways you can pass configure the library:
122120

123121
1. Pass parameters `url` and `token` explicitly when initializing the
@@ -137,9 +135,8 @@ api = sbg.Api(url='https://api.sbgenomics.com/v2', token='<TOKEN_HERE>')
137135
### Initialization via environment variables
138136

139137
```python
140-
import sevenbridges as sbg
141-
142138
import os
139+
import sevenbridges as sbg
143140

144141
# Usually these would be set in the shell beforehand
145142
os.environ['SB_API_ENDPOINT'] = 'https://api.sbgenomics.com/v2'
@@ -222,7 +219,7 @@ before submitting a pull request.
222219
Copyright
223220
---------
224221

225-
Copyright (c) 2016-2018 Seven Bridges Genomics, Inc. All rights
222+
Copyright (c) 2020 Seven Bridges Genomics, Inc. All rights
226223
reserved.
227224

228225
This project is open-source via the [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0).

docs/conf.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414

1515
import os
1616
import sys
17-
17+
from datetime import datetime
1818

1919
# If extensions (or modules to document with autodoc) are in another directory,
2020
# add these directories to sys.path here. If the directory is relative to the
2121
# documentation root, use os.path.abspath to make it absolute, like shown here.
2222
extra_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
2323
os.environ['SPHINX_DOC'] = 'True'
2424
sys.path.append(extra_path)
25-
from sevenbridges import __version__ as version_pkg
25+
from sevenbridges import __version__ as version_pkg # noqa
2626

2727
# -- General configuration ------------------------------------------------
2828

@@ -54,9 +54,9 @@
5454
master_doc = 'index'
5555

5656
# General information about the project.
57-
project = u'sevenbridges-python'
58-
copyright = u'2018, Seven Bridges Genomics Inc.'
59-
author = u'Seven Bridges Genomics'
57+
project = 'sevenbridges-python'
58+
copyright = f'{datetime.utcnow().year}, Seven Bridges Genomics Inc.'
59+
author = 'Seven Bridges Genomics'
6060

6161
# The version info for the project you're documenting, acts as replacement for
6262
# |version| and |release|, also used in various other places throughout the
@@ -227,8 +227,8 @@
227227
# (source start file, target name, title,
228228
# author, documentclass [howto, manual, or own class]).
229229
latex_documents = [
230-
(master_doc, 'sbg.tex', u'sbg Documentation',
231-
u'Seven Bridges Genomics', 'manual'),
230+
(master_doc, 'sbg.tex', 'sbg Documentation',
231+
'Seven Bridges Genomics', 'manual'),
232232
]
233233

234234
# The name of an image file (relative to this directory) to place at the top of
@@ -257,7 +257,7 @@
257257
# One entry per manual page. List of tuples
258258
# (source start file, name, description, authors, manual section).
259259
man_pages = [
260-
(master_doc, 'sbg', u'sbg Documentation',
260+
(master_doc, 'sbg', 'sbg Documentation',
261261
[author], 1)
262262
]
263263

@@ -271,7 +271,7 @@
271271
# (source start file, target name, title, author,
272272
# dir menu entry, description, category)
273273
texinfo_documents = [
274-
(master_doc, 'sbg', u'sbg Documentation',
274+
(master_doc, 'sbg', 'sbg Documentation',
275275
author, 'sbg', 'One line description of project.',
276276
'Miscellaneous'),
277277
]

requirements-dev.txt

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-r requirements.txt
2+
3+
flake8==3.8.4
4+
pytest==6.2.1
5+
pytest-cov==2.10.1
6+
requests-mock==1.8.0
7+
faker==5.0.2
8+
sphinx==3.4.0
9+
sphinx_rtd_theme==0.5.0

requirements.txt

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,2 @@
1-
six>=1.10.0
2-
requests>=2.20.0
3-
4-
flake8==3.8.4
5-
pytest==6.1.2
6-
pytest-cov==2.10.1
7-
requests-mock==1.8.0
8-
faker==4.14.2
9-
sphinx==3.3.0
10-
sphinx_rtd_theme==0.1.9
1+
requests>=2.25.1
2+
urllib3>=1.26.2

requirements2.txt

-12
This file was deleted.

setup.cfg

-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
[bdist_wheel]
2-
universal=1
3-
4-
[metadata]
5-
description-file =
6-
README.md
7-
8-
[flake8]
9-
exclude =
10-
docs/conf.py
11-
sevenbridges/__init__.py
12-
131
[tool:pytest]
142
addopts =
153
--cov=sevenbridges

0 commit comments

Comments
 (0)