Skip to content

Commit 19deedf

Browse files
committed
rquire python 3.6
1 parent 3c4582e commit 19deedf

File tree

6 files changed

+26
-39
lines changed

6 files changed

+26
-39
lines changed

.travis.yml

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,10 @@ env:
1717
# - TORCH_VERSION=1.4.0 PYTHON_VERSION=3.7 IDX=cu92
1818
# - TORCH_VERSION=1.4.0 PYTHON_VERSION=3.7 IDX=cu100
1919
# - TORCH_VERSION=1.4.0 PYTHON_VERSION=3.7 IDX=cu101
20-
# - TORCH_VERSION=1.4.0 PYTHON_VERSION=3.6 IDX=cpu
20+
- TORCH_VERSION=1.4.0 PYTHON_VERSION=3.6 IDX=cpu
2121
# - TORCH_VERSION=1.4.0 PYTHON_VERSION=3.6 IDX=cu92
2222
# - TORCH_VERSION=1.4.0 PYTHON_VERSION=3.6 IDX=cu100
2323
# - TORCH_VERSION=1.4.0 PYTHON_VERSION=3.6 IDX=cu101
24-
- TORCH_VERSION=1.4.0 PYTHON_VERSION=3.5 IDX=cpu
25-
# - TORCH_VERSION=1.4.0 PYTHON_VERSION=3.5 IDX=cu92
26-
# - TORCH_VERSION=1.4.0 PYTHON_VERSION=3.5 IDX=cu100
27-
# - TORCH_VERSION=1.4.0 PYTHON_VERSION=3.5 IDX=cu101
2824

2925
jobs:
3026
exclude: # Exclude *all* macOS CUDA jobs and Windows CUDA 9.2/10.0 jobs.
@@ -46,12 +42,6 @@ jobs:
4642
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.6 IDX=cu100
4743
- os: osx
4844
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.6 IDX=cu101
49-
- os: osx
50-
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.5 IDX=cu92
51-
- os: osx
52-
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.5 IDX=cu100
53-
- os: osx
54-
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.5 IDX=cu101
5545
- os: windows
5646
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.8 IDX=cu92
5747
- os: windows
@@ -64,24 +54,21 @@ jobs:
6454
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.6 IDX=cu92
6555
- os: windows
6656
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.6 IDX=cu100
67-
- os: windows
68-
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.5 IDX=cu92
69-
- os: windows
70-
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.5 IDX=cu100
7157

7258

7359
install:
7460
- source script/cuda.sh
7561
- source script/conda.sh
62+
- pip install flake8 codecov
7663
- python setup.py install
7764

7865
script:
79-
- if [ "${PYTHON_VERSION}" != "3.5" ]; then pip install flake8 && flake8 .; fi
66+
- flake8 .
8067
- python setup.py test
8168
after_success:
8269
- python setup.py bdist_wheel --dist-dir=dist/torch-${TORCH_VERSION}
8370
- python script/rename_wheel.py ${IDX}
84-
- pip install codecov && codecov
71+
- codecov
8572
deploy:
8673
provider: s3
8774
region: eu-central-1

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ def get_extensions():
3737

3838
sources = [main]
3939

40-
path = osp.join(extensions_dir, 'cpu', name + '_cpu.cpp')
40+
path = osp.join(extensions_dir, 'cpu', f'{name}_cpu.cpp')
4141
if osp.exists(path):
4242
sources += [path]
4343

44-
path = osp.join(extensions_dir, 'cuda', name + '_cuda.cu')
44+
path = osp.join(extensions_dir, 'cuda', f'{name}_cuda.cu')
4545
if WITH_CUDA and osp.exists(path):
4646
sources += [path]
4747

@@ -70,7 +70,7 @@ def get_extensions():
7070
description='PyTorch Extension Library of Optimized Scatter Operations',
7171
keywords=['pytorch', 'scatter', 'segment', 'gather'],
7272
license='MIT',
73-
python_requires='>=3.5',
73+
python_requires='>=3.6',
7474
install_requires=install_requires,
7575
setup_requires=setup_requires,
7676
tests_require=tests_require,

torch_scatter/__init__.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# flake8: noqa
22

3-
import glob
3+
import importlib
44
import os.path as osp
55

66
import torch
@@ -9,16 +9,16 @@
99
expected_torch_version = (1, 4)
1010

1111
try:
12-
torch.ops.load_library(
13-
glob.glob(osp.join(osp.dirname(__file__), '_version.*'))[0])
12+
torch.ops.load_library(importlib.machinery.PathFinder().find_spec(
13+
'_version', [osp.dirname(__file__)]).origin)
1414
except OSError as e:
1515
if 'undefined symbol' in str(e):
1616
major, minor = [int(x) for x in torch.__version__.split('.')[:2]]
1717
t_major, t_minor = expected_torch_version
1818
if major != t_major or (major == t_major and minor != t_minor):
1919
raise RuntimeError(
20-
'Expected PyTorch version {}.{} but found version '
21-
'{}.{}.'.format(t_major, t_minor, major, minor))
20+
f'Expected PyTorch version {t_major}.{t_minor} but found '
21+
f'version {major}.{minor}.')
2222
raise OSError(e)
2323

2424
from .scatter import (scatter_sum, scatter_add, scatter_mean, scatter_min,
@@ -43,11 +43,11 @@
4343

4444
if t_major != major or t_minor != minor:
4545
raise RuntimeError(
46-
'Detected that PyTorch and torch_scatter were compiled with '
47-
'different CUDA versions. PyTorch has CUDA version={}.{} and '
48-
'torch_scatter has CUDA version={}.{}. Please reinstall the '
49-
'torch_scatter that matches your PyTorch install.'.format(
50-
t_major, t_minor, major, minor))
46+
f'Detected that PyTorch and torch_scatter were compiled with '
47+
f'different CUDA versions. PyTorch has CUDA version '
48+
f'{t_major}.{t_minor} and torch_scatter has CUDA version '
49+
f'{major}.{minor}. Please reinstall the torch_scatter that '
50+
f'matches your PyTorch install.')
5151

5252
__all__ = [
5353
'scatter_sum',

torch_scatter/scatter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import glob
1+
import importlib
22
import os.path as osp
33
from typing import Optional, Tuple
44

55
import torch
66

77
from .utils import broadcast
88

9-
torch.ops.load_library(
10-
glob.glob(osp.join(osp.dirname(__file__), '_scatter.*'))[0])
9+
torch.ops.load_library(importlib.machinery.PathFinder().find_spec(
10+
'_scatter', [osp.dirname(__file__)]).origin)
1111

1212

1313
@torch.jit.script

torch_scatter/segment_coo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import glob
1+
import importlib
22
import os.path as osp
33
from typing import Optional, Tuple
44

55
import torch
66

7-
torch.ops.load_library(
8-
glob.glob(osp.join(osp.dirname(__file__), '_segment_coo.*'))[0])
7+
torch.ops.load_library(importlib.machinery.PathFinder().find_spec(
8+
'_segment_coo', [osp.dirname(__file__)]).origin)
99

1010

1111
@torch.jit.script

torch_scatter/segment_csr.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import glob
1+
import importlib
22
import os.path as osp
33
from typing import Optional, Tuple
44

55
import torch
66

7-
torch.ops.load_library(
8-
glob.glob(osp.join(osp.dirname(__file__), '_segment_csr.*'))[0])
7+
torch.ops.load_library(importlib.machinery.PathFinder().find_spec(
8+
'_segment_csr', [osp.dirname(__file__)]).origin)
99

1010

1111
@torch.jit.script

0 commit comments

Comments
 (0)