Skip to content

Commit

Permalink
Remove pandas dependency (#273)
Browse files Browse the repository at this point in the history
* removing MemoryCache and pandas requirement

* got rid of six dependency

* got rid of two different requirements lists

* added unit test for shell
  • Loading branch information
iskandr authored Dec 1, 2022
1 parent 7aeef3d commit 1231e96
Show file tree
Hide file tree
Showing 23 changed files with 13 additions and 286 deletions.
2 changes: 0 additions & 2 deletions pyensembl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from .memory_cache import MemoryCache
from .database import Database
from .download_cache import DownloadCache
from .ensembl_release import EnsemblRelease, cached_release
Expand Down Expand Up @@ -41,7 +40,6 @@

__all__ = [
"__version__",
"MemoryCache",
"DownloadCache",
"Database",
"EnsemblRelease",
Expand Down
1 change: 0 additions & 1 deletion pyensembl/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

from functools import wraps


def dump_pickle(obj, filepath):
with open(filepath, "wb") as f:
# use lower protocol for compatibility between Python 2 and Python 3
Expand Down
1 change: 0 additions & 1 deletion pyensembl/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import datacache
from typechecks import require_integer, require_string

from gtfparse import read_gtf, create_missing_features

from .common import memoize
Expand Down
5 changes: 1 addition & 4 deletions pyensembl/genome.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

from serializable import Serializable

from .memory_cache import MemoryCache
from .download_cache import DownloadCache
from .database import Database
from .exon import Exon
Expand Down Expand Up @@ -108,7 +107,6 @@ def __init__(
copy_local_files_to_cache=self.copy_local_files_to_cache,
install_string_function=self.install_string,
cache_directory_path=cache_directory_path)
self.memory_cache = MemoryCache()
self._init_lazy_fields()

@property
Expand Down Expand Up @@ -435,8 +433,7 @@ def __hash__(self):

def clear_cache(self):
"""
Clear any in-memory cached values and short-lived on-disk
materializations from MemoryCache
Clear any in-memory cached values
"""
for maybe_fn in self.__dict__.values():
# clear cache associated with all memoization decorators,
Expand Down
136 changes: 0 additions & 136 deletions pyensembl/memory_cache.py

This file was deleted.

7 changes: 2 additions & 5 deletions pyensembl/sequence_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
from os.path import exists, abspath, split, join
import logging
from collections import Counter

from six.moves import cPickle as pickle
from six import string_types

import pickle
from .common import (load_pickle, dump_pickle)
from .fasta import parse_fasta_dictionary

Expand All @@ -34,7 +31,7 @@ def __init__(
fasta_paths,
cache_directory_path=None):

if isinstance(fasta_paths, string_types):
if type(fasta_paths) is str:
fasta_paths = [fasta_paths]

self.fasta_paths = [abspath(path) for path in fasta_paths]
Expand Down
2 changes: 1 addition & 1 deletion pyensembl/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.1.0'
__version__ = '2.2.0'
9 changes: 3 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
typechecks>=0.0.2
numpy>=1.7
pandas>=0.15
datacache>=1.1.4
memoized-property>=1.0.2
nose>=1.3.3
tinytimer
six>=1.9.0
gtfparse>=1.3.0
serializable
nose>=1.3.3
pylint>=1.4.4
gtfparse>=1.1.0
serializable
13 changes: 4 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
raise RuntimeError('Cannot find version information')

if __name__ == '__main__':
with open("requirements.txt") as f:
requirements = [l.strip() for l in f]

setup(
name=package_name,
version=version,
Expand All @@ -63,15 +66,7 @@
'Programming Language :: Python',
'Topic :: Scientific/Engineering :: Bio-Informatics',
],
install_requires=[
"typechecks>=0.0.2",
"pandas>=0.15",
"datacache>=1.1.4",
"memoized-property>=1.0.2",
"gtfparse>=1.1.0",
"serializable",
"tinytimer",
],
install_requires=requirements,
long_description=readme_markdown,
long_description_content_type='text/markdown',
packages=[package_name],
Expand Down
2 changes: 0 additions & 2 deletions test/common.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

import functools

from pyensembl import (
Expand Down
2 changes: 0 additions & 2 deletions test/test_download_cache.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

from nose.tools import assert_raises, ok_
from pyensembl.download_cache import (
DownloadCache,
Expand Down
2 changes: 0 additions & 2 deletions test/test_gene_objects.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

from nose.tools import eq_

from .common import test_ensembl_releases
Expand Down
2 changes: 0 additions & 2 deletions test/test_id_length.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

from .common import major_releases

from nose.tools import nottest
Expand Down
2 changes: 0 additions & 2 deletions test/test_locus.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

from pyensembl.locus import Locus
from pyensembl.normalization import normalize_chromosome

Expand Down
94 changes: 0 additions & 94 deletions test/test_memory_cache.py

This file was deleted.

2 changes: 0 additions & 2 deletions test/test_missing_genome_sources.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

from pyensembl import Genome
from nose.tools import eq_, ok_, assert_raises

Expand Down
2 changes: 0 additions & 2 deletions test/test_mouse.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

from nose.tools import eq_, with_setup

from .data import (
Expand Down
Loading

0 comments on commit 1231e96

Please sign in to comment.