Skip to content

Commit 442d5b9

Browse files
Enable mypy type-checking
Using the module I was getting this message from mypy: ``` Skipping analyzing "engineering_notation": module is installed, but missing library stubs or py.typed marker ``` While not the biggest issue, I tried my hand at fixing things. This commit represents that attempt.
1 parent bbc9206 commit 442d5b9

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

engineering_notation/engineering_notation.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
from string import digits
33
import sys
44

5+
from typing import Optional
6+
57
try:
68
import numpy
79
except ImportError:
@@ -51,7 +53,7 @@ class EngUnit:
5153
Represents an engineering number, complete with units
5254
"""
5355
def __init__(self, value,
54-
precision=2, significant=0, unit: str = None, separator=""):
56+
precision=2, significant=0, unit: Optional[str] = None, separator=""):
5557
"""
5658
Initialize engineering with units
5759
:param value: the desired value in the form of a string, int, or float

setup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from setuptools import setup, find_packages
1+
from setuptools import setup
2+
23
import os
34

45
__version__ = None
@@ -36,7 +37,8 @@
3637
author='Jason R. Jones',
3738
author_email='slightlynybbled@gmail.com',
3839
url='https://github.com/slightlynybbled/engineering_notation',
39-
packages=find_packages(),
40+
packages=["engineering_notation"],
41+
package_data={"engineering_notation": ["py.typed"]},
4042
install_requires=requirements,
4143
setup_requires=['flake8', 'pytest'],
4244
license='MIT',

0 commit comments

Comments
 (0)