Skip to content

Commit

Permalink
Feat/dev 1627 drop py2 (#391)
Browse files Browse the repository at this point in the history
* remove py2 in travis and tox

* remove extra requirements for py2

* remove functools32 import

* pyupgrade py files

* remove six

* recompile dependencies with python3.5

* remove python2 pins in dev-requirements.in
  • Loading branch information
qiaouchicago committed Jan 4, 2023
1 parent 3f1058f commit b084a23
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 66 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ language: python
dist: focal

python:
- 2.7
- 3.5
- 3.6.8
- 3.7
Expand Down
10 changes: 0 additions & 10 deletions dev-requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,3 @@ jupyter-core>=4.1.0,<4.7
pytest>=4.6.5,<4.6.11
pytest-cov~=2.8.1
pre-commit~=1.21.0
cfgv~=2.0.1

# python2 pins
more-itertools<=5.0.0
nbformat<=4.4.0
ipykernel<5
ipython<=5.10.0
pyzmq<=19.0.2
testpath<=0.4.4
tornado<=5.1.1
21 changes: 5 additions & 16 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#
# pip-compile dev-requirements.in
#

aspy.yaml==1.3.0
# via pre-commit
atomicwrites==1.4.0
Expand All @@ -18,9 +19,7 @@ backports.entry-points-selectable==1.1.0
bleach==3.3.1
# via nbconvert
cfgv==2.0.1
# via
# -r dev-requirements.in
# pre-commit
# via pre-commit
coverage==5.5
# via pytest-cov
decorator==4.4.2
Expand Down Expand Up @@ -53,7 +52,6 @@ importlib-resources==3.2.1
# virtualenv
ipykernel==4.10.1
# via
# -r dev-requirements.in
# ipywidgets
# jupyter
# jupyter-console
Expand All @@ -67,7 +65,6 @@ ipython-genutils==0.2.0
# traitlets
ipython==5.10.0
# via
# -r dev-requirements.in
# ipykernel
# ipywidgets
# jupyter-console
Expand Down Expand Up @@ -107,16 +104,13 @@ markupsafe==1.1.1
mistune==0.8.4
# via nbconvert
more-itertools==5.0.0
# via
# -r dev-requirements.in
# pytest
# via pytest
nbconvert==5.6.1
# via
# jupyter
# notebook
nbformat==4.4.0
# via
# -r dev-requirements.in
# ipywidgets
# nbconvert
# notebook
Expand All @@ -133,7 +127,7 @@ packaging==20.9
# pytest
pandocfilters==1.4.3
# via nbconvert
pathlib2==2.3.6
pathlib2==2.3.7.post1
# via pytest
pexpect==4.8.0
# via ipython
Expand Down Expand Up @@ -177,7 +171,6 @@ pyyaml==5.3.1
# pre-commit
pyzmq==19.0.2
# via
# -r dev-requirements.in
# jupyter-client
# qtconsole
qtconsole==4.7.7
Expand All @@ -196,21 +189,17 @@ six==1.15.0
# pathlib2
# pre-commit
# prompt-toolkit
# pyrsistent
# pytest
# traitlets
# virtualenv
terminado==0.8.3
# via notebook
testpath==0.4.4
# via
# -r dev-requirements.in
# nbconvert
# via nbconvert
toml==0.10.2
# via pre-commit
tornado==5.1.1
# via
# -r dev-requirements.in
# ipykernel
# notebook
# terminado
Expand Down
17 changes: 5 additions & 12 deletions gdcdatamodel/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,12 @@
- jsm
"""
import os
import sys

import six

try:
from functools import lru_cache
except ImportError:
from functools32 import lru_cache

import hashlib
import logging
import os
import sys
from collections import defaultdict
from functools import lru_cache
from types import ModuleType

from psqlgraph import Edge, Node, ext, pg_property
Expand Down Expand Up @@ -375,11 +368,11 @@ def get_tag_property_values(self):

if not property_val:
raise ValueError(
"Property {0} must have a value on instance {1} for tagging to proceed".format(
"Property {} must have a value on instance {} for tagging to proceed".format(
prop, self
)
)
keys.append(six.ensure_str(property_val))
keys.append(str(property_val))
return keys

@property
Expand Down
18 changes: 5 additions & 13 deletions gdcdatamodel/models/versioning.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import os
import uuid
from functools import lru_cache

import six
from sqlalchemy import and_, event, select

try:
from functools import lru_cache
except ImportError:
from functools32 import lru_cache


UUID_NAMESPACE_SEED = os.getenv(
"UUID_NAMESPACE_SEED", "86bb916a-24c5-48e4-8a46-5ea73a379d47"
)
Expand Down Expand Up @@ -113,7 +107,7 @@ def is_taggable(self, node):
def __generate_hash(seed, label):
namespace = UUID_NAMESPACE
name = "{}-{}".format(seed, label)
return six.ensure_str(str(uuid.uuid5(namespace, name)))
return str(uuid.uuid5(namespace, name))


@lru_cache(maxsize=None)
Expand All @@ -126,11 +120,9 @@ def compute_tag(node):
"""
keys = node.get_tag_property_values()
keys += sorted(
[
six.ensure_str(compute_tag(p.dst))
for p in node.edges_out
if p.dst.is_taggable() and p.label != "relates_to"
]
compute_tag(p.dst)
for p in node.edges_out
if p.dst.is_taggable() and p.label != "relates_to"
)
return __generate_hash(keys, node.label)

Expand Down
2 changes: 1 addition & 1 deletion gdcdatamodel/validators/json_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

missing_prop_re = re.compile("'([a-zA-Z_-]+)' is a required property")
extra_prop_re = re.compile(
"Additional properties are not allowed \(u'([a-zA-Z_-]+)' was unexpected\)"
r"Additional properties are not allowed \(u'([a-zA-Z_-]+)' was unexpected\)"
)


Expand Down
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
#
# This file is autogenerated by pip-compile with python 3.9
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile
#

attrs==21.2.0
# via jsonschema
decorator==4.4.2
# via gdcdatamodel (setup.py)
gdc-ng-models @ git+https://github.com/NCI-GDC/gdc-ng-models.git@1.5.2
git+https://github.com/NCI-GDC/gdc-ng-models.git@1.5.2#egg=gdc-ng-models
# via gdcdatamodel (setup.py)
gdcdictionary @ git+https://github.com/NCI-GDC/gdcdictionary.git@2.5.0-rc.0
git+https://github.com/NCI-GDC/gdcdictionary.git@2.5.0-rc.0#egg=gdcdictionary
# via gdcdatamodel (setup.py)
graphviz==0.14.2
# via gdcdatamodel (setup.py)
Expand All @@ -20,7 +21,7 @@ jsonschema==3.2.0
# via
# gdcdatamodel (setup.py)
# gdcdictionary
psqlgraph @ git+https://github.com/NCI-GDC/psqlgraph.git@3.4.0
git+https://github.com/NCI-GDC/psqlgraph.git@3.4.0#egg=psqlgraph
# via gdcdatamodel (setup.py)
psycopg2==2.8.6
# via psqlgraph
Expand All @@ -36,7 +37,6 @@ rstr==2.2.6
# via psqlgraph
six==1.15.0
# via
# gdcdatamodel (setup.py)
# jsonschema
# psqlgraph
# pyrsistent
Expand Down
7 changes: 0 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
setup_requires=["setuptools_scm<6"],
packages=find_packages(),
install_requires=[
"six~=1.15",
"pytz~=2020.1",
"graphviz>=0.4.10,<0.17",
"jsonschema~=3.2",
Expand All @@ -19,12 +18,6 @@
"gdc-ng-models @ git+https://github.com/NCI-GDC/gdc-ng-models.git@1.5.2#egg=gdc-ng-models",
"psqlgraph @ git+https://github.com/NCI-GDC/psqlgraph.git@3.4.0#egg=psqlgraph",
],
extras_require={
'python_version == "2.7"': [
"futures~=3.3",
"functools32~=3.2",
]
},
package_data={
"gdcdatamodel": [
"xml_mappings/*.yaml",
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py27,py35,py36,py37,py38
envlist = py35,py36,py37,py38

[pytest]
testpaths =
Expand Down

0 comments on commit b084a23

Please sign in to comment.