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

Update to Python 3.8+ #65

Merged
merged 6 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
34 changes: 0 additions & 34 deletions .github/workflows/lint.yml

This file was deleted.

15 changes: 4 additions & 11 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,23 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, pypy3]
python-version: [3.8, 3.9, "3.10"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ ${{ matrix.python-version }} == 3.6 ]
then
# for other python versions the latest pandas and numpy versions are tested
pip install numpy==1.13.3 pandas==0.25
elif [ ${{ matrix.python-version }} == 'pypy3' ]
if [ ${{ matrix.python-version }} == 'pypy3' ]
then
pip install --extra-index-url https://antocuni.github.io/pypy-wheels/manylinux2010 numpy pandas
fi

pip install -e .
- name: Lint with flake8
run: |
pip install flake8
- name: Test with pytest
run: |
pip install pytest pytest-httpserver
Expand Down
29 changes: 21 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,32 @@ repos:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace


- repo: https://github.com/psf/black
rev: 22.3.0
rev: 22.12.0
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.7

- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: flake8
types: [file, python]
- id: pyupgrade
args: ["--py38-plus"]

- repo: https://github.com/hadialqattan/pycln
rev: "v2.1.2"
hooks:
- id: pycln
args: [--config=pyproject.toml]
stages: [manual]


- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.790
rev: v0.991
hooks:
- id: mypy
args:
- --ignore-missing-imports
files: ".+.py"

ci:
autoupdate_schedule: "quarterly"
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ For additional documentation see `pgeocode.readthedocs.io <https://pgeocode.read
Installation
------------

pgeocode requires Python 3.6+ as well as ``numpy`` and ``pandas`` packages. It can be installed with,
pgeocode requires Python 3.8+ as well as ``numpy`` and ``pandas`` packages. It can be installed with,

.. code::

Expand Down
3 changes: 1 addition & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# pgeocode documentation build configuration file, created by
# sphinx-quickstart on Sun Feb 4 15:22:38 2018.
Expand All @@ -23,11 +22,11 @@
sys.path.insert(0, os.path.abspath("../"))
sys.path.insert(0, os.path.abspath("sphinxext"))

import pgeocode # noqa
from typing import Any # noqa

from github_link import make_linkcode_resolve # noqa

import pgeocode # noqa

# -- General configuration ------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion pgeocode.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import urllib.request
import warnings
from io import BytesIO
from typing import Any, Tuple, List
from typing import Any, List, Tuple
from zipfile import ZipFile

import numpy as np
Expand Down
17 changes: 17 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ requires = ["setuptools>=42", "wheel"]
[tool.black]
line-length = 79

[tool.mypy]
python_version = "3.8"
show_error_codes = true
warn_unreachable = true

# Strict checks
disallow_untyped_calls = false
disallow_untyped_defs = false
disallow_incomplete_defs = true
no_implicit_optional = true

[tool.pycln]
all = true

[tool.isort]
profile = "black"

[tool.tox]
legacy_tox_ini = """
[tox]
Expand Down
8 changes: 2 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# https://packaging.python.org/guides/single-sourcing-package-version/
def read(*names, **kwargs):
with io.open(
with open(
os.path.join(os.path.dirname(__file__), *names),
encoding=kwargs.get("encoding", "utf8"),
) as fp:
Expand All @@ -29,10 +29,6 @@ def find_version(*file_paths):
License :: OSI Approved :: BSD License
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Topic :: Software Development
Operating System :: POSIX
Operating System :: Unix
Expand All @@ -47,7 +43,7 @@ def find_version(*file_paths):
author="Roman Yurchak",
author_email="roman.yurchak@symerio.com",
py_modules=["pgeocode"],
python_requires=">=3.6",
python_requires=">=3.8",
install_requires=["requests", "numpy", "pandas"],
classifiers=[_f for _f in CLASSIFIERS.split("\n") if _f],
license="BSD",
Expand Down
12 changes: 8 additions & 4 deletions test_pgeocode.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
# License 3-clause BSD
#
# Authors: Roman Yurchak <roman.yurchak@symerio.com>
import json
import os
import urllib
import json
from zipfile import ZipFile
from io import BytesIO
from zipfile import ZipFile

import numpy as np
import pandas as pd
import pytest
from numpy.testing import assert_allclose, assert_array_equal

import pgeocode
from pgeocode import GeoDistance, Nominatim, haversine_distance
from pgeocode import _open_extract_url
from pgeocode import (
GeoDistance,
Nominatim,
_open_extract_url,
haversine_distance,
)


@pytest.fixture
Expand Down