Merge branch 'upgrade-dependencies-py38' into develop
All checks were successful
CI / Tests (Python 3.8) (push) Successful in 1m23s
All checks were successful
CI / Tests (Python 3.8) (push) Successful in 1m23s
This commit is contained in:
commit
fad875b332
13 changed files with 11750 additions and 2254 deletions
13366
poetry.lock
generated
13366
poetry.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -29,20 +29,20 @@ requires-python = ">=3.8,<4.0"
|
|||
|
||||
# Package => Code developed in *.py files and packaged under src/velofy
|
||||
dependencies = [
|
||||
"Shapely>=1.7.1,<2",
|
||||
"Shapely>=1.7.1,<3",
|
||||
"alembic>=1.4.2,<2",
|
||||
"click>=7.1.2,<8",
|
||||
"folium>=0.12.1,<0.13",
|
||||
"click>=7.1.2,<9",
|
||||
"folium>=0.12.1,<1",
|
||||
"geopy>=2.1.0,<3",
|
||||
"googlemaps>=4.4.2,<5",
|
||||
"matplotlib>=3.3.3,<4",
|
||||
"ordered-set>=4.0.2,<5",
|
||||
"pandas>=1.1.0,<2",
|
||||
"pandas>=1.1.0,<3",
|
||||
"psycopg2>=2.8.5,<3", # Adapter for PostgreSQL
|
||||
"rpy2>=3.4.1,<4",
|
||||
"sqlalchemy>=1.3.18,<2",
|
||||
"statsmodels>=0.12.1,<0.13",
|
||||
"utm>=0.7.0,<0.8",
|
||||
"sqlalchemy>=1.3.18,<3",
|
||||
"statsmodels>=0.12.1,<0.15",
|
||||
"utm>=0.7.0,<1",
|
||||
]
|
||||
|
||||
|
||||
|
|
@ -50,9 +50,9 @@ dependencies = [
|
|||
|
||||
# `jupyter lab` => Notebooks with analyses using the developed package
|
||||
research = [
|
||||
"jupyterlab>=2.2.2,<3",
|
||||
"numpy>=1.19.1,<2",
|
||||
"pytz>=2020.1,<2021",
|
||||
"jupyterlab>=2.2.2",
|
||||
"numpy>=1.19.1",
|
||||
"pytz>=2020.1",
|
||||
]
|
||||
|
||||
|
||||
|
|
@ -90,23 +90,23 @@ black = "^19.10b0"
|
|||
isort = "^4.3.21" # TODO (isort): Not ^5.5.4 due to `wemake-python-styleguide`
|
||||
|
||||
# Code Analyzers
|
||||
flake8 = "^3.8.3"
|
||||
flake8 = ">=3.8.3"
|
||||
flake8-annotations = "^2.3.0"
|
||||
flake8-black = "^0.2.1"
|
||||
flake8-pytest-style = "^1.2.2"
|
||||
mypy = "^0.782"
|
||||
wemake-python-styleguide = "^0.14.1" # `flake8` plug-in
|
||||
mypy = ">=0.782"
|
||||
wemake-python-styleguide = ">=0.14.1" # `flake8` plug-in
|
||||
|
||||
# Test Suite
|
||||
Faker = "^5.0.1"
|
||||
factory-boy = "^3.1.0"
|
||||
Faker = ">=5.0.1"
|
||||
factory-boy = ">=3.1.0"
|
||||
geopy = "^2.1.0"
|
||||
packaging = "^20.4" # Used to test the packaged version
|
||||
pytest = "^6.0.1"
|
||||
pytest-cov = "^2.10.0"
|
||||
pytest-env = "^0.6.2"
|
||||
pytest-mock = "^3.5.1"
|
||||
xdoctest = { version="^0.13.0", extras=["optional"] }
|
||||
packaging = ">=20.4" # Used to test the packaged version
|
||||
pytest = ">=6.0.1"
|
||||
pytest-cov = ">=2.10.0"
|
||||
pytest-env = ">=0.6.2"
|
||||
pytest-mock = ">=3.5.1"
|
||||
xdoctest = { version=">=0.13.0", extras=["optional"] }
|
||||
|
||||
# Documentation
|
||||
sphinx = "^3.1.2"
|
||||
|
|
|
|||
10
setup.cfg
10
setup.cfg
|
|
@ -82,6 +82,16 @@ ignore =
|
|||
# If --ignore is passed on the command
|
||||
# line, still ignore the following:
|
||||
extend-ignore =
|
||||
# TODO: New in `wemake-python-styleguide` v0.15 - v0.17, revisit in the tooling goal
|
||||
WPS110,
|
||||
WPS237,
|
||||
WPS238,
|
||||
WPS358,
|
||||
WPS456,
|
||||
WPS458,
|
||||
WPS459,
|
||||
WPS462,
|
||||
WPS469,
|
||||
# Too long line => duplicate with E501.
|
||||
B950,
|
||||
# Comply with black's style.
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@ import functools
|
|||
import os
|
||||
import subprocess # noqa:S404
|
||||
import sys
|
||||
from typing import Any, Callable
|
||||
from typing import Any
|
||||
from typing import Callable
|
||||
|
||||
import click
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import functools
|
|||
import itertools
|
||||
import json
|
||||
from typing import List
|
||||
from typing import Tuple
|
||||
|
||||
import folium
|
||||
import googlemaps as gm
|
||||
|
|
@ -211,7 +212,7 @@ class Path(meta.Base):
|
|||
# get from A to B. As a step's "start_location" may equal the previous step's
|
||||
# "end_location", we use an `OrderedSet` to find the unique latitude-longitude
|
||||
# pairs that make up the path from `.first_address` to `.second_address`.
|
||||
steps = ordered_set.OrderedSet()
|
||||
steps: ordered_set.OrderedSet[Tuple[float, float]] = ordered_set.OrderedSet()
|
||||
for step in route['steps']:
|
||||
steps.add( # noqa:WPS221
|
||||
(step['start_location']['lat'], step['start_location']['lng']),
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@
|
|||
from typing import Any
|
||||
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.ext import declarative
|
||||
from sqlalchemy import orm
|
||||
|
||||
import velofy
|
||||
|
||||
|
||||
Base: Any = declarative.declarative_base(
|
||||
Base: Any = orm.declarative_base(
|
||||
metadata=sa.MetaData(
|
||||
schema=velofy.config.CLEAN_SCHEMA,
|
||||
naming_convention={
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Optional, Tuple
|
||||
from typing import Optional
|
||||
from typing import Tuple
|
||||
|
||||
import utm
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using the `rpy2` library.
|
|||
"""
|
||||
|
||||
import math
|
||||
from typing import Optional
|
||||
|
||||
import pandas as pd
|
||||
from rpy2 import robjects
|
||||
|
|
@ -16,14 +17,14 @@ def stl( # noqa:C901,WPS210,WPS211
|
|||
*,
|
||||
frequency: int,
|
||||
ns: int,
|
||||
nt: int = None,
|
||||
nl: int = None,
|
||||
nt: Optional[int] = None,
|
||||
nl: Optional[int] = None,
|
||||
ds: int = 0,
|
||||
dt: int = 1,
|
||||
dl: int = 1,
|
||||
js: int = None,
|
||||
jt: int = None,
|
||||
jl: int = None,
|
||||
js: Optional[int] = None,
|
||||
jt: Optional[int] = None,
|
||||
jl: Optional[int] = None,
|
||||
ni: int = 2,
|
||||
no: int = 0, # noqa:WPS110
|
||||
) -> pd.DataFrame:
|
||||
|
|
|
|||
|
|
@ -54,8 +54,9 @@ def db_connection(request):
|
|||
db.connection = connection
|
||||
|
||||
if request.param == 'all_at_once':
|
||||
connection.execute(f'CREATE SCHEMA {config.CLEAN_SCHEMA};')
|
||||
db.Base.metadata.create_all(connection)
|
||||
with connection.begin():
|
||||
connection.execute(sa.text(f'CREATE SCHEMA {config.CLEAN_SCHEMA};'))
|
||||
db.Base.metadata.create_all(connection)
|
||||
else:
|
||||
cfg = migrations_config.Config('alembic.ini')
|
||||
migrations_cmd.upgrade(cfg, 'head')
|
||||
|
|
@ -69,12 +70,14 @@ def db_connection(request):
|
|||
connection.close()
|
||||
|
||||
with engine.begin() as cleanup:
|
||||
cleanup.execute(f'DROP SCHEMA {config.CLEAN_SCHEMA} CASCADE;')
|
||||
cleanup.execute(sa.text(f'DROP SCHEMA {config.CLEAN_SCHEMA} CASCADE;'))
|
||||
|
||||
if request.param == 'sequentially':
|
||||
tmp_alembic_version = f'{config.ALEMBIC_TABLE}_{config.CLEAN_SCHEMA}'
|
||||
cleanup.execute(
|
||||
f'DROP TABLE {config.ALEMBIC_TABLE_SCHEMA}.{tmp_alembic_version};',
|
||||
sa.text(
|
||||
f'DROP TABLE {config.ALEMBIC_TABLE_SCHEMA}.{tmp_alembic_version};', # noqa:E501
|
||||
),
|
||||
)
|
||||
|
||||
engine.dispose()
|
||||
|
|
|
|||
|
|
@ -49,11 +49,12 @@ def vertical_datetime_index():
|
|||
`frequency` of `7` times the number of daily time steps,
|
||||
which is `12` for `LONG_TIME_STEP` values.
|
||||
"""
|
||||
start_ats = pd.date_range(
|
||||
test_config.START, test_config.END, freq=f'{test_config.LONG_TIME_STEP}T',
|
||||
)
|
||||
gen = (
|
||||
start_at
|
||||
for start_at in pd.date_range(
|
||||
test_config.START, test_config.END, freq=f'{test_config.LONG_TIME_STEP}T',
|
||||
)
|
||||
for start_at in start_ats
|
||||
if config.SERVICE_START <= start_at.hour < config.SERVICE_END
|
||||
)
|
||||
|
||||
|
|
@ -101,12 +102,13 @@ def order_totals(good_pixel_id):
|
|||
"""
|
||||
pixel_ids = [good_pixel_id, good_pixel_id + 1]
|
||||
|
||||
start_ats = pd.date_range(
|
||||
test_config.START, test_config.END, freq=f'{test_config.LONG_TIME_STEP}T',
|
||||
)
|
||||
gen = (
|
||||
(pixel_id, start_at)
|
||||
for pixel_id in pixel_ids
|
||||
for start_at in pd.date_range(
|
||||
test_config.START, test_config.END, freq=f'{test_config.LONG_TIME_STEP}T',
|
||||
)
|
||||
for start_at in start_ats
|
||||
if config.SERVICE_START <= start_at.hour < config.SERVICE_END
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -27,11 +27,12 @@ def forecast_interval():
|
|||
future_day.year, future_day.month, future_day.day, config.SERVICE_END, 0,
|
||||
)
|
||||
|
||||
start_ats = pd.date_range(
|
||||
first_start_at, end_of_day, freq=f'{test_config.LONG_TIME_STEP}T',
|
||||
)
|
||||
gen = (
|
||||
start_at
|
||||
for start_at in pd.date_range(
|
||||
first_start_at, end_of_day, freq=f'{test_config.LONG_TIME_STEP}T',
|
||||
)
|
||||
for start_at in start_ats
|
||||
if config.SERVICE_START <= start_at.hour < config.SERVICE_END
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ class TestChooseTacticalModel:
|
|||
def test_best_model_for_unknown_train_horizon(
|
||||
self, order_history, good_pixel_id, predict_at, # noqa:RST215
|
||||
):
|
||||
"""For `train_horizon`s not included in the rule-based system ...
|
||||
"""For `train_horizon` values not included in the rule-based system ...
|
||||
|
||||
... the method raises a `RuntimeError`.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
"""Test the package's configuration module."""
|
||||
|
||||
import warnings
|
||||
|
||||
import pytest
|
||||
|
||||
from velofy import configuration
|
||||
|
|
@ -32,7 +34,8 @@ def test_database_uri_set(env, monkeypatch):
|
|||
# Prevent that a warning is emitted for a missing R_LIBS_PATH.
|
||||
monkeypatch.setattr(configuration.Config, 'R_LIBS_PATH', '.cache/r_libs')
|
||||
|
||||
with pytest.warns(None) as record:
|
||||
with warnings.catch_warnings(record=True) as record:
|
||||
warnings.simplefilter('always')
|
||||
configuration.make_config(env)
|
||||
|
||||
assert len(record) == 0 # noqa:WPS441,WPS507
|
||||
|
|
@ -49,7 +52,8 @@ def test_no_database_uri_set_with_testing_env_var(env, monkeypatch):
|
|||
# Prevent that a warning is emitted for a missing R_LIBS_PATH.
|
||||
monkeypatch.setattr(configuration.Config, 'R_LIBS_PATH', '.cache/r_libs')
|
||||
|
||||
with pytest.warns(None) as record:
|
||||
with warnings.catch_warnings(record=True) as record:
|
||||
warnings.simplefilter('always')
|
||||
configuration.make_config(env)
|
||||
|
||||
assert len(record) == 0 # noqa:WPS441,WPS507
|
||||
|
|
@ -79,7 +83,8 @@ def test_r_libs_path_set(env, monkeypatch):
|
|||
uri = 'postgresql://user:password@localhost/db'
|
||||
monkeypatch.setattr(configuration.ProductionConfig, 'DATABASE_URI', uri)
|
||||
|
||||
with pytest.warns(None) as record:
|
||||
with warnings.catch_warnings(record=True) as record:
|
||||
warnings.simplefilter('always')
|
||||
configuration.make_config(env)
|
||||
|
||||
assert len(record) == 0 # noqa:WPS441,WPS507
|
||||
|
|
@ -98,7 +103,8 @@ def test_no_r_libs_path_set_with_testing_env_var(env, monkeypatch):
|
|||
uri = 'postgresql://user:password@localhost/db'
|
||||
monkeypatch.setattr(configuration.ProductionConfig, 'DATABASE_URI', uri)
|
||||
|
||||
with pytest.warns(None) as record:
|
||||
with warnings.catch_warnings(record=True) as record:
|
||||
warnings.simplefilter('always')
|
||||
configuration.make_config(env)
|
||||
|
||||
assert len(record) == 0 # noqa:WPS441,WPS507
|
||||
|
|
|
|||
Loading…
Reference in a new issue