Skip to content

Commit acb9a8d

Browse files
authored
Merge pull request #24 from jbloomlab/remove-pkg_resources
remove deprecated `pkg_resources`
2 parents 31160ec + 53bd43a commit acb9a8d

File tree

11 files changed

+37
-20
lines changed

11 files changed

+37
-20
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: install python
2121
uses: actions/setup-python@v4
2222
with:
23-
python-version: "3.11"
23+
python-version: "3.13"
2424

2525
- name: install package and dependencies
2626
run: pip install -e . && pip install -r test_requirements.txt

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file.
33

44
The format is based on [Keep a Changelog](https://keepachangelog.com).
55

6+
## 0.7.1
7+
8+
### Fixed
9+
- Removed deprecated `pkg_resources`, which was root of [this issue](https://github.com/dms-vep/dms-vep-pipeline-3/issues/212#event-22715605282)
10+
11+
- Updated tests to use Python 3.13 and so they pass with the newer versions of `pandas`.
12+
13+
614
## 0.7.0
715

816
### Fixed

dmslogo/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
__author__ = "Jesse Bloom"
1717
__email__ = "jbloom@fredhutch.org"
18-
__version__ = "0.7.0"
18+
__version__ = "0.7.1"
1919
__url__ = "https://github.com/jbloomlab/dmslogo"
2020

2121
from dmslogo.facet import facet_plot # noqa: F401

dmslogo/colorschemes.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@
66
Color schemes.
77
"""
88

9-
109
import matplotlib.colors
1110
import matplotlib.pyplot as plt
1211

1312
import numpy
1413

15-
1614
#: color-blind safe palette with gray, from
1715
#: http://bconnelly.net/2013/10/creating-colorblind-friendly-figures
1816
CBPALETTE = [

dmslogo/facet.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
Facet multiple plots on the same figure.
77
"""
88

9-
109
import collections
1110
import operator
1211

dmslogo/line.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
Draw line plots of site-level properties.
77
"""
88

9-
109
import matplotlib.pyplot as plt
1110
import matplotlib.ticker
1211

dmslogo/logo.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
`pyseqlogo <https://github.com/saketkc/pyseqlogo>`_.
1010
"""
1111

12-
1312
import glob
13+
import importlib.resources
1414
import os
1515
import warnings
1616

@@ -24,17 +24,17 @@
2424

2525
import pandas as pd
2626

27-
import pkg_resources
28-
2927
import dmslogo.colorschemes
3028
import dmslogo.utils
3129

32-
3330
# default font
3431
_DEFAULT_FONT = "DejaVuSansMonoBold_SeqLogo"
3532

3633
# add fonts to font manager
37-
_FONT_PATH = pkg_resources.resource_filename("dmslogo", "ttf_fonts/")
34+
with importlib.resources.as_file(
35+
importlib.resources.files("dmslogo").joinpath("ttf_fonts")
36+
) as font_path:
37+
_FONT_PATH = str(font_path)
3838
if not os.path.isdir(_FONT_PATH):
3939
raise RuntimeError(f"Cannot find font directory {_FONT_PATH}")
4040

@@ -367,8 +367,8 @@ def draw_logo(
367367
ylabel = letter_height_col
368368

369369
# check letters are all upper case
370-
letters = str(data[letter_col].unique())
371-
if letters.upper() != letters:
370+
letters = data[letter_col].unique()
371+
if not all(str(letter) == str(letter).upper() for letter in letters):
372372
raise ValueError("letters in `letter_col` must be uppercase")
373373

374374
# checks on input data

dmslogo/utils.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
Utility functions for plotting.
77
"""
88

9-
109
import matplotlib.pyplot as plt
1110
import matplotlib.ticker
1211

@@ -66,21 +65,21 @@ class AxLimSetter:
6665
6766
>>> data = [0.5, 0.6, 0.4, 0.4, 0.3, 0.5]
6867
>>> setter_default = AxLimSetter()
69-
>>> setter_default.get_lims(data)
68+
>>> tuple(float(v) for v in setter_default.get_lims(data))
7069
(-0.03, 0.63)
7170
7271
Now use the `max_from_quantile` option to set an upper limit
7372
that substantially exceeds the "noise" of the all-similar values:
7473
7574
>>> setter_max_quantile = AxLimSetter(max_from_quantile=(0.5, 0.05))
76-
>>> setter_max_quantile.get_lims(data)
75+
>>> tuple(float(v) for v in setter_max_quantile.get_lims(data))
7776
(-0.45, 9.45)
7877
7978
Demonstrate `min_upperlim`:
8079
8180
>>> setter_min_upperlim = AxLimSetter(max_from_quantile=(0.5, 0.05),
8281
... min_upperlim=10)
83-
>>> setter_min_upperlim.get_lims(data)
82+
>>> tuple(float(v) for v in setter_min_upperlim.get_lims(data))
8483
(-0.45, 10.0)
8584
8685
"""

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ channels:
77

88
# conda dependencies
99
dependencies:
10-
- python==3.7
10+
- python==3.13
1111
- pip
1212
# install the current package with `pip install .`
1313
- pip:

nbval_sanitize.cfg

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,17 @@ replace: <cell_header_start>
99
[pandas_cell_header_end]
1010
regex: </t[hd]>
1111
replace: <cell_header_end>
12+
13+
# pandas 3 displays None where pandas 2 displayed NaN for missing string values
14+
[pandas_nan_none_html]
15+
regex: <cell_header_start>NaN<cell_header_end>
16+
replace: <cell_header_start>None<cell_header_end>
17+
18+
[pandas_nan_none_text]
19+
regex: \bNaN\b
20+
replace: None
21+
22+
# normalize runs of 2+ spaces to single space for text/plain DataFrame alignment
23+
[pandas_whitespace]
24+
regex: [ ][ ]+
25+
replace: SANITIZED_SPACE

0 commit comments

Comments
 (0)