-
Notifications
You must be signed in to change notification settings - Fork 17
Type hinting #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Type hinting #28
Changes from all commits
a8f8fc3
3df42fe
72e00b9
95d6ab2
c78e5f7
7d586ad
5728cd3
7fbc401
d562dd3
1009b9c
81c0fa7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| include README.rst | ||
| include LICENSE.txt | ||
| include *jdcal.py | ||
| include src/jdcal/*.py | ||
| include src/jdcal/py.typed | ||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,16 +1,16 @@ | ||||||||
| #!/usr/bin/env python | ||||||||
|
|
||||||||
| from setuptools import setup | ||||||||
| from setuptools import setup, find_packages | ||||||||
|
|
||||||||
| import jdcal | ||||||||
|
|
||||||||
| version = jdcal.__version__ | ||||||||
|
|
||||||||
| long_description = open("README.rst").read() | ||||||||
|
|
||||||||
| with open("src/jdcal/version.py") as f: | ||||||||
| exec(f.read()) | ||||||||
|
|
||||||||
| setup( | ||||||||
| name="jdcal", | ||||||||
| version=version, | ||||||||
| version=__version__, | ||||||||
| description="Julian dates from proleptic Gregorian and Julian calendars.", | ||||||||
| long_description=long_description, | ||||||||
| license='BSD', | ||||||||
|
|
@@ -35,5 +35,9 @@ | |||||||
| 'Programming Language :: Python :: Implementation :: CPython', | ||||||||
| 'Programming Language :: Python :: Implementation :: PyPy', | ||||||||
| ], | ||||||||
| py_modules=["jdcal"] | ||||||||
| # py_modules=["jdcal"], | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't need to keep this.
Suggested change
|
||||||||
| packages=find_packages("src"), | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As the package has no subpackages,
Suggested change
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Won't some of these suggestions change since we have decided to go with the latest recommendation
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When adjusting |
||||||||
| package_dir={"": "src"}, | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should also mention the
Suggested change
|
||||||||
| install_requires=["typing;python_version<'3.5'"], | ||||||||
| include_package_data=True, | ||||||||
| ) | ||||||||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,14 @@ | ||||
| #!/usr/bin/env python | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file is a package and has no external side effects, it should not be executable as is.
Suggested change
|
||||
| # -*- coding: utf-8 -*- | ||||
|
|
||||
| # see https://mypy.readthedocs.io/en/latest/config_file.html#confval-implicit_reexport | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO, it is more conventional to express exports using __all__ = ["__version__", "MJD_0", ...] |
||||
| from .version import __version__ as __version__ | ||||
| from .jdcal import ( | ||||
| MJD_0 as MJD_0, | ||||
| MJD_JD2000 as MJD_JD2000, | ||||
| is_leap as is_leap, | ||||
| gcal2jd as gcal2jd, | ||||
| jd2gcal as jd2gcal, | ||||
| jcal2jd as jcal2jd, | ||||
| jd2jcal as jd2jcal, | ||||
| ) | ||||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,4 @@ | ||||
| #!/usr/bin/env python | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
| # -*- coding: utf-8 -*- | ||||
|
|
||||
| __version__ = "1.4.1" | ||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,6 +1,6 @@ | ||||||
| [tox] | ||||||
| project = jdcal | ||||||
| envlist = py{27,34,35,36,37,38,py,py3}, codestyle, docstyle | ||||||
| envlist = py{27,34,35,36,37,38,py,py3}, codestyle, docstyle, mypy | ||||||
|
|
||||||
| [testenv] | ||||||
| deps = pytest | ||||||
|
|
@@ -13,8 +13,12 @@ deps = | |||||
|
|
||||||
| [testenv:codestyle] | ||||||
| deps = pycodestyle | ||||||
| commands = pycodestyle --ignore=E722,E501 jdcal.py test_jdcal.py | ||||||
| commands = pycodestyle --ignore=E722,E501 src/jdcal/jdcal.py tests/test_jdcal.py | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. run on entire directory. |
||||||
|
|
||||||
| [testenv:docstyle] | ||||||
| deps = pydocstyle | ||||||
| commands = pydocstyle jdcal.py test_jdcal.py | ||||||
| commands = pydocstyle src/jdcal/jdcal.py | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same, run on full package. |
||||||
|
|
||||||
| [testenv:mypy] | ||||||
| deps = mypy | ||||||
| commands = mypy --strict src/jdcal/jdcal.py | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should type check the entire package, not just one file.
Suggested change
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be included automatically by setuptools. We only need to mention the test files: