Skip to content

Commit

Permalink
Drop hard dependency on smart_open (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
clintval committed May 20, 2019
1 parent 116ac6f commit e69a34e
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 18 deletions.
4 changes: 2 additions & 2 deletions docs/quick-start.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Quick Start
===========

To demonstrate the features of this library we will use a test file
available at this remote location:
To demonstrate the features of this library we will use a test file at an HTTPS endpoint.
To follow along, ensure you have the `smart_open` library installed!

.. code-block:: python
Expand Down
1 change: 0 additions & 1 deletion docs/sample_sheet.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ API Reference
:members:
:undoc-members:
:show-inheritance:

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[tool.black]
line-length = 79
py36 = true
skip-string-normalization = true
include = '\.pyi?$'
exclude = '''
Expand Down
11 changes: 8 additions & 3 deletions sample_sheet/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import csv
import importlib
import json
import os
import re
Expand All @@ -23,7 +24,11 @@
)

from requests.structures import CaseInsensitiveDict
from smart_open import smart_open # type: ignore

try:
from smart_open import smart_open as open # type: ignore
except ImportError:
pass
from tabulate import tabulate # type: ignore
from terminaltables import SingleTable

Expand Down Expand Up @@ -384,7 +389,7 @@ class SampleSheet(object):
Args:
path: Any path supported by :class:`pathlib.Path` and/or
:class:`smart_open.smart_open`.
:class:`smart_open.smart_open` when `smart_open` is installed.
"""

Expand Down Expand Up @@ -471,7 +476,7 @@ def _parse(self, path: Union[Path, str]) -> None:
section_name: str = ''
sample_header: Optional[List[str]] = None

with smart_open(path, encoding=self._encoding) as handle:
with open(path, encoding=self._encoding) as handle:
lines = list(csv.reader(handle, skipinitialspace=True))

for i, line in enumerate(lines):
Expand Down
1 change: 1 addition & 0 deletions sample_sheet/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '0.9.0'
30 changes: 19 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
import setuptools
import sys

from pathlib import Path
from setuptools import find_packages

PACKAGE: str = 'sample_sheet'

if sys.version_info < (3, 6):
sys.exit(f'Python < 3.6 will not be supported.')


def this_version() -> str:
"""Read the variable `__version__` from the module itself."""
contents = Path('sample_sheet/_version.py').read_text()
*_, version = contents.strip().split()
return version


setuptools.setup(
name='sample-sheet',
version='0.8.0',
version=this_version(),
author='clintval',
author_email='valentine.clint@gmail.com',
description='An Illumina Sample Sheet parsing library',
url='https://github.com/clintval/sample-sheet',
download_url='https://github.com/sample-sheet/archive/v0.8.0.tar.gz',
download_url=f'https://github.com/sample-sheet/archive/v{this_version()}.tar.gz',
long_description=Path('README.md').read_text(),
long_description_content_type='text/markdown',
license='MIT',
zip_safe=True,
packages=find_packages(),
install_requires=[
'click',
'requests',
'smart_open>=1.5.4',
'tabulate',
'terminaltables',
],
packages=setuptools.find_packages(where='./'),
install_requires=['click', 'requests', 'tabulate', 'terminaltables'],
extras_require={'smart_open': ['smart_open>=1.5.4']},
scripts=['scripts/sample-sheet'],
keywords='illumina samplesheet sample sheet parser bioinformatics',
classifiers=[
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ envlist =
py36-docs

[testenv]
extras = smart_open
description = run the test suite with (basepython)
deps = -rtest-requirements.txt
commands = pytest {posargs}
Expand Down

0 comments on commit e69a34e

Please sign in to comment.