From 43cef0483bdcc96397fc824183fdc865c9de3766 Mon Sep 17 00:00:00 2001 From: Erik Cederstrand Date: Thu, 10 Oct 2019 09:09:03 +0200 Subject: [PATCH 1/4] Don't import biopandas during install Getting the __version__ during install is more safely done by reading __init__ as text. The reason is that __init__ may at some point include code that requires importing packages that have not yet been installed. Installing a package should always be possible using `pip install biopython` in an empty virtualenv. --- setup.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index c4d4497..47db349 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,13 @@ from os.path import realpath, dirname, join from setuptools import setup, find_packages -import biopandas -VERSION = biopandas.__version__ +VERSION = None +with io.open(os.path.join(os.path.dirname(__file__), 'biopandas/__init__.py'), encoding='utf-8') as f: + for l in f: + if not l.startswith('__version__'): + continue + VERSION = l.split('=')[1].strip(' "\'\n') + break PROJECT_ROOT = dirname(realpath(__file__)) REQUIREMENTS_FILE = join(PROJECT_ROOT, 'requirements.txt') From c8c0b283d59ad37a2d8610f5b2719dd3045deb2b Mon Sep 17 00:00:00 2001 From: Erik Cederstrand Date: Thu, 10 Oct 2019 10:51:26 +0200 Subject: [PATCH 2/4] Fix pep8 --- setup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 47db349..0ce8fb8 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,10 @@ from setuptools import setup, find_packages VERSION = None -with io.open(os.path.join(os.path.dirname(__file__), 'biopandas/__init__.py'), encoding='utf-8') as f: +with io.open( + os.path.join(os.path.dirname(__file__), 'biopandas/__init__.py'), + encoding='utf-8' +) as f: for l in f: if not l.startswith('__version__'): continue From b7cd7540e9974983240281d7efe764a4e2499aa9 Mon Sep 17 00:00:00 2001 From: Erik Cederstrand Date: Thu, 10 Oct 2019 15:19:33 +0200 Subject: [PATCH 3/4] Update setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 0ce8fb8..d73d2d5 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages VERSION = None -with io.open( +with open( os.path.join(os.path.dirname(__file__), 'biopandas/__init__.py'), encoding='utf-8' ) as f: From f531786f3eed0a3bac7b91e7ed925f4affce6f35 Mon Sep 17 00:00:00 2001 From: Erik Cederstrand Date: Thu, 10 Oct 2019 20:05:58 +0200 Subject: [PATCH 4/4] Fix imports --- setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index d73d2d5..c5cf3a3 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -from os.path import realpath, dirname, join +import os from setuptools import setup, find_packages VERSION = None @@ -11,9 +11,9 @@ continue VERSION = l.split('=')[1].strip(' "\'\n') break -PROJECT_ROOT = dirname(realpath(__file__)) +PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__)) -REQUIREMENTS_FILE = join(PROJECT_ROOT, 'requirements.txt') +REQUIREMENTS_FILE = os.path.join(PROJECT_ROOT, 'requirements.txt') with open(REQUIREMENTS_FILE) as f: install_reqs = f.read().splitlines()