Skip to content

Commit 8cfe354

Browse files
committed
Python >= 3.7 anno, src layout
1 parent 4c33941 commit 8cfe354

19 files changed

Lines changed: 88 additions & 180 deletions

.gitattributes

Lines changed: 0 additions & 20 deletions
This file was deleted.

.mypy.ini

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
[mypy]
2-
files = sciencedates/
2+
files = src/
33

44
ignore_missing_imports = True
5-
strict_optional = False
65
allow_redefinition = True
76
show_error_context = False
87
show_column_numbers = True
98
warn_unreachable = False
10-
11-
[mypy-xarray]
12-
follow_imports = skip

archive/.appveyor.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

archive/.travis.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

date2doy.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
"""
33
command-line utility to convert date to day of year
44
"""
55
from argparse import ArgumentParser
66
from sciencedates import date2doy
77

88

9-
def main():
10-
p = ArgumentParser(description="convert date to day of year")
11-
p.add_argument("date", help="yyyy-mm-dd")
12-
P = p.parse_args()
9+
p = ArgumentParser(description="convert date to day of year")
10+
p.add_argument("date", help="yyyy-mm-dd")
11+
P = p.parse_args()
1312

14-
doy, year = date2doy(P.date)
13+
doy, year = date2doy(P.date)
1514

16-
print(doy.item())
17-
18-
19-
if __name__ == "__main__":
20-
main()
15+
print(doy.item())

findnearest.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
import numpy as np
33
from bisect import bisect
44
import sciencedates as sd
@@ -13,11 +13,6 @@ def INCORRECTRESULT_using_bisect(x, X0): # pragma: no cover
1313
return np.asanyarray(ind), x[ind]
1414

1515

16-
def main():
17-
print(sd.find_nearest([10, 15, 12, 20, 14, 33], [32, 12.01]))
16+
print(sd.find_nearest([10, 15, 12, 20, 14, 33], [32, 12.01]))
1817

19-
print(INCORRECTRESULT_using_bisect([10, 15, 12, 20, 14, 33], [32, 12.01]))
20-
21-
22-
if __name__ == "__main__": # pragma: no cover
23-
main()
18+
print(INCORRECTRESULT_using_bisect([10, 15, 12, 20, 14, 33], [32, 12.01]))

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
requires = ["setuptools", "wheel"]
33

44
[tool.black]
5-
line-length = 132
5+
line-length = 100

randomdate.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
"""
33
generate a random date (month and day) in a year.
44
Michael Hirsch, Ph.D.
@@ -8,13 +8,8 @@
88
from sciencedates import randomdate
99

1010

11-
def main():
12-
p = ArgumentParser(description="generate random date in year")
13-
p.add_argument("year", type=int, nargs="?", default=date.today().year)
14-
P = p.parse_args()
11+
p = ArgumentParser(description="generate random date in year")
12+
p.add_argument("year", type=int, nargs="?", default=date.today().year)
13+
P = p.parse_args()
1514

16-
print(randomdate(P.year))
17-
18-
19-
if __name__ == "__main__":
20-
main()
15+
print(randomdate(P.year))

setup.cfg

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = sciencedates
3-
version = 1.5.0
3+
version = 1.5.1
44
author = Michael Hirsch, Ph.D.
55
author_email = scivision@users.noreply.github.com
66
url = https://github.com/geospace-code/sciencedates
@@ -21,22 +21,25 @@ long_description = file: README.md
2121
long_description_content_type = text/markdown
2222

2323
[options]
24-
python_requires = >= 3.5
24+
python_requires = >= 3.7
2525
packages = find:
26-
scripts =
27-
date2doy.py
28-
findnearest.py
29-
randomdate.py
3026
install_requires =
3127
numpy
3228
python-dateutil
29+
package_dir=
30+
=src
31+
32+
[options.packages.find]
33+
where=src
3334

3435
[options.extras_require]
3536
tests =
3637
pytest
3738
lint =
3839
flake8
3940
mypy
41+
types-pytz
42+
types-python-dateutil
4043
plot =
4144
xarray
4245
matplotlib

0 commit comments

Comments
 (0)