Skip to content

Commit

Permalink
Merge pull request #88 from NatLibFi/drop-python-2
Browse files Browse the repository at this point in the history
Drop Python 2 compatibility, add Python 3.9 support
  • Loading branch information
osma committed Aug 30, 2021
2 parents 0bcb8d7 + fc2bb3d commit b79bd47
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
dist: xenial
language: python
python:
- '2.7'
- '3.6'
- '3.7'
- '3.8'
- '3.9'

install:
- python setup.py install
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ the SKOS specification and related best practices.
Installation
============

Skosify requires Python 2.7 or 3.6+.
Skosify requires Python 3.6+.

.. code-block:: console
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@
long_description=README,
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
],
keywords='rdf skos',
author='Osma Suominen',
author_email='osma.suominen@helsinki.fi',
url='https://github.com/NatLibFi/Skosify',
license='MIT',
install_requires=['rdflib'],
setup_requires=['rdflib>=3.0.0', 'pytest-runner>=2.9'],
setup_requires=['rdflib>=3.0.0,<6.0.0', 'pytest-runner>=2.9'],
tests_require=['pytest<6.0.0', 'pytest-pep8', 'pytest-cov', 'pytest-catchlog'],
packages=['skosify', 'skosify.rdftools'],
entry_points={'console_scripts': ['skosify=skosify.cli:main']}
Expand Down
15 changes: 2 additions & 13 deletions skosify/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
from copy import copy
from rdflib.namespace import URIRef, Namespace, RDF, RDFS, OWL, SKOS, DC, DCTERMS, XSD

# import for both Python 2 and Python 3
try:
from configparser import ConfigParser
except ImportError:
from ConfigParser import SafeConfigParser as ConfigParser
from configparser import ConfigParser

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

if hasattr(file, 'readline'):
# we have a file object
if sys.version_info >= (3, 2):
cfgparser.read_file(file) # Added in Python 3.2
else:
cfgparser.readfp(file) # Deprecated since Python 3.2

cfgparser.read_file(file)
else:
# we have a file name
cfgparser.read(file)
Expand Down Expand Up @@ -153,9 +145,6 @@ def expand_curielike(namespaces, curie):

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

if curie.startswith('[') and curie.endswith(']'):
# decode SafeCURIE
Expand Down

0 comments on commit b79bd47

Please sign in to comment.