Skip to content

Commit c07605d

Browse files
authored
Merge pull request #38 from cylammarco/dev
Housekeeping
2 parents 0a8c24c + fc3042d commit c07605d

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

.github/workflows/python-package.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ jobs:
4949
flag-name: Unit Test
5050

5151
upload_pypi:
52+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
5253
runs-on: ubuntu-latest
5354
environment: pypi
5455
permissions:

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
repos:
22
- repo: https://github.com/psf/black
3-
rev: 23.3.0
3+
rev: 25.1.0
44
hooks:
55
- id: black
6-
language_version: python3.10
6+
language_version: python3.11
77
args: # arguments to configure black
88
- --line-length=120
99

src/WDPhotTools/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
"""Initialise the import"""
55

6-
from pkg_resources import get_distribution, DistributionNotFound
6+
from importlib.metadata import version, PackageNotFoundError
77

88
try:
9-
__version__ = get_distribution(__name__).version
10-
except DistributionNotFound:
9+
__version__ = version(__name__)
10+
except PackageNotFoundError:
1111
pass # package is not installed
1212

1313

@@ -34,3 +34,4 @@
3434
]
3535
__credits__ = ["K W Yuen", "M Green", "W Li"]
3636
__status__ = "Production"
37+

src/WDPhotTools/util.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33

44
"""Some utility class/functions"""
55

6-
import glob
7-
import pkg_resources
8-
96
import numpy as np
107

8+
from importlib.resources import files
9+
1110

1211
def get_uncertainty_least_squares(res):
1312
"""
@@ -42,7 +41,8 @@ def load_ms_lifetime_datatable(filename):
4241
"""
4342

4443
datatable = np.loadtxt(
45-
glob.glob(pkg_resources.resource_filename("WDPhotTools", f"ms_lifetime/{filename}"))[0],
46-
delimiter=",",
44+
str(files("WDPhotTools").joinpath("ms_lifetime", filename)),
45+
delimiter=","
4746
)
4847
return datatable
48+

0 commit comments

Comments
 (0)