Skip to content
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

Add type hints to api functions class #216

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4efd64b
Sketch of class-based api_functions
kylebarron Feb 17, 2022
c698be8
Remove dynamic globals update
kylebarron Feb 21, 2022
2cd9e42
Add script to build api functions
kylebarron Feb 21, 2022
dab3b63
Update types
kylebarron Feb 22, 2022
05c85a8
Merge branch 'master' of github.com:uber/h3-py into kyle/class-api-fu…
kylebarron Feb 22, 2022
e508cbc
Pass tests on 3.7
kylebarron Feb 22, 2022
2745a98
Use type comments to support python 2
kylebarron Feb 22, 2022
1af8f11
Turn off fail-fast
kylebarron Feb 22, 2022
b4c5514
Exclude 3.5 on windows
kylebarron Feb 22, 2022
a2afa2a
Fix 3.10
kylebarron Feb 22, 2022
daf7059
Merge branch 'master' into kyle/class-api-functions
kylebarron Feb 23, 2022
5ac6613
Use introspection in api_functions script
kylebarron Feb 23, 2022
f20ddce
Merge branch 'master' into kyle/class-api-types
kylebarron Apr 9, 2022
c058463
Remove api_functions script
kylebarron Apr 9, 2022
368ddf7
Revert api/__init__ changes
kylebarron Apr 9, 2022
9401df5
Merge branch 'master' into kyle/class-api-types
kylebarron Apr 18, 2022
ea3d66f
Add types to unstable.vect
kylebarron Apr 18, 2022
16ad670
Fix resolution return type
kylebarron Apr 18, 2022
04aa7ef
Minimal type tests
kylebarron Apr 18, 2022
eca42c9
Ignore line length on type comment
kylebarron Apr 18, 2022
58f5e4f
Don't run type tests on 3.5
kylebarron Apr 18, 2022
bdeec9f
Test static methods
kylebarron Apr 21, 2022
0c1e420
WIP start basic_str type tests
kylebarron Apr 21, 2022
22d2b3d
Add a few more tests
kylebarron Apr 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/coverage-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: pylint --disable=all --enable=import-error tests/

- name: Coverage
run: pytest --cov=h3 --full-trace --cov-report=xml
run: pytest --cov=h3 --full-trace --cov-report=xml tests/*.py

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3.0.0
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be reverted before merging

matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
python-version: ['2.7', '3.5', '3.6', '3.7', '3.8', '3.9', '3.10']
Expand Down Expand Up @@ -47,4 +48,11 @@ jobs:
pip install .[all]

- name: Tests
run: pytest --cov=h3 --full-trace
run: pytest --cov=h3 --full-trace tests/*.py
shell: bash

- name: Type Tests
if: matrix.python-version != '2.7' && matrix.python-version != '3.5'
run: |
pytest --mypy-same-process --mypy-ini-file=mypy.ini tests/*.yml
shell: bash
5 changes: 4 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ purge: clear
-@rm -rf env

test:
env/bin/pytest tests/* --cov=h3 --cov-report term-missing --durations=10
env/bin/pytest tests/*.py --cov=h3 --cov-report term-missing --durations=10

test-types:
env/bin/pytest tests/*.yml --mypy-same-process --durations=10 --mypy-ini-file=mypy.ini

lint:
env/bin/flake8 src/h3 setup.py tests
Expand Down
2 changes: 2 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[mypy]
ignore_missing_imports = True
23 changes: 20 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ def long_desc():
return long_description


numpy_requires = ['numpy']
test_requires = [
'pytest',
'pytest-cov',
'flake8',
'pylint',
'pytest-mypy-plugins==1.9.3;python_version>="3.6"',
]
install_requires = ['typing_extensions;python_version<"3.8"']

setup(
name = 'h3',
version = about['__version__'],
Expand All @@ -34,11 +44,18 @@ def long_desc():
'src',
exclude = ["*.tests", "*.tests.*", "tests.*", "tests"],
),
package_data={
'h3': [
'py.typed',
]
},
zip_safe=False,
package_dir = {'': 'src'},
cmake_languages = ('C'),
install_requires=install_requires,
extras_require={
'numpy': ['numpy'],
'test': ['pytest', 'pytest-cov', 'flake8', 'pylint'],
'all': ['numpy', 'pytest', 'pytest-cov', 'flake8', 'pylint'],
'numpy': numpy_requires,
'test': test_requires,
'all': numpy_requires + test_requires,
},
)
Loading