Skip to content

Commit b79bd47

Browse files
authoredAug 30, 2021
Merge pull request #88 from NatLibFi/drop-python-2
Drop Python 2 compatibility, add Python 3.9 support
2 parents 0bcb8d7 + fc2bb3d commit b79bd47

File tree

4 files changed

+6
-17
lines changed

4 files changed

+6
-17
lines changed
 

Diff for: ‎.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
dist: xenial
22
language: python
33
python:
4-
- '2.7'
54
- '3.6'
65
- '3.7'
76
- '3.8'
7+
- '3.9'
88

99
install:
1010
- python setup.py install

Diff for: ‎README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ the SKOS specification and related best practices.
1818
Installation
1919
============
2020

21-
Skosify requires Python 2.7 or 3.6+.
21+
Skosify requires Python 3.6+.
2222

2323
.. code-block:: console
2424

Diff for: ‎setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@
1919
long_description=README,
2020
classifiers=[
2121
'Programming Language :: Python',
22-
'Programming Language :: Python :: 2.7',
2322
'Programming Language :: Python :: 3.6',
2423
'Programming Language :: Python :: 3.7',
2524
'Programming Language :: Python :: 3.8',
25+
'Programming Language :: Python :: 3.9',
2626
],
2727
keywords='rdf skos',
2828
author='Osma Suominen',
2929
author_email='osma.suominen@helsinki.fi',
3030
url='https://github.com/NatLibFi/Skosify',
3131
license='MIT',
3232
install_requires=['rdflib'],
33-
setup_requires=['rdflib>=3.0.0', 'pytest-runner>=2.9'],
33+
setup_requires=['rdflib>=3.0.0,<6.0.0', 'pytest-runner>=2.9'],
3434
tests_require=['pytest<6.0.0', 'pytest-pep8', 'pytest-cov', 'pytest-catchlog'],
3535
packages=['skosify', 'skosify.rdftools'],
3636
entry_points={'console_scripts': ['skosify=skosify.cli:main']}

Diff for: ‎skosify/config.py

+2-13
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@
99
from copy import copy
1010
from rdflib.namespace import URIRef, Namespace, RDF, RDFS, OWL, SKOS, DC, DCTERMS, XSD
1111

12-
# import for both Python 2 and Python 3
13-
try:
14-
from configparser import ConfigParser
15-
except ImportError:
16-
from ConfigParser import SafeConfigParser as ConfigParser
12+
from configparser import ConfigParser
1713

1814
# default namespaces to register in the graph
1915
DEFAULT_NAMESPACES = {
@@ -105,11 +101,7 @@ def read_file(self, cfgparser, file):
105101

106102
if hasattr(file, 'readline'):
107103
# we have a file object
108-
if sys.version_info >= (3, 2):
109-
cfgparser.read_file(file) # Added in Python 3.2
110-
else:
111-
cfgparser.readfp(file) # Deprecated since Python 3.2
112-
104+
cfgparser.read_file(file)
113105
else:
114106
# we have a file name
115107
cfgparser.read(file)
@@ -153,9 +145,6 @@ def expand_curielike(namespaces, curie):
153145

154146
if curie == '':
155147
return None
156-
if sys.version < '3' and not isinstance(curie, type(u'')):
157-
# Python 2 ConfigParser gives raw byte strings
158-
curie = curie.decode('UTF-8') # ...make those into Unicode objects
159148

160149
if curie.startswith('[') and curie.endswith(']'):
161150
# decode SafeCURIE

0 commit comments

Comments
 (0)
Please sign in to comment.