Skip to content

Commit

Permalink
Update test/dev versions
Browse files Browse the repository at this point in the history
  • Loading branch information
fealho committed Apr 10, 2024
1 parent 42b044a commit 318f0e7
Show file tree
Hide file tree
Showing 21 changed files with 82 additions and 69 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dependency_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12']
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/minimum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12']
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12']
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -26,4 +26,4 @@ jobs:
run: invoke unit
- if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.8
name: Upload codecov report
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v4
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ install-develop: clean-build clean-pyc ## install the package in editable mode a
.PHONY: lint-sdv
lint-sdv: ## check style with flake8 and isort
flake8 sdv
isort -c --recursive sdv
isort -c sdv
pydocstyle sdv

.PHONY: lint-tests
lint-tests: ## check style with flake8 and isort
flake8 --ignore=D,SFS2 tests
isort -c --recursive tests
isort -c tests

.PHONY: check-dependencies
check-dependencies: ## test if there are any broken dependencies
Expand All @@ -106,7 +106,7 @@ lint: ## check style with flake8 and isort
fix-lint: ## fix lint issues using autoflake, autopep8, and isort
find sdv tests -name '*.py' | xargs autoflake --in-place --remove-all-unused-imports --remove-unused-variables
autopep8 --in-place --recursive --aggressive sdv tests
isort --apply --atomic --recursive sdv tests
isort --apply --atomic sdv tests


# TEST TARGETS
Expand Down
47 changes: 23 additions & 24 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ license = { text = 'BSL-1.1' }
requires-python = '>=3.8,<3.13'
readme = 'README.md'
dependencies = [
'boto3>=1.15.0',
'botocore>=1.18',
'boto3>=1.28',
'botocore>=1.31',
'cloudpickle>=2.1.0',
'graphviz>=0.13.2',
"numpy>=1.20.0;python_version<'3.10'",
Expand All @@ -33,7 +33,7 @@ dependencies = [
"pandas>=1.5.0;python_version>='3.11'",
'tqdm>=4.29',
'copulas @ git+https://github.com/sdv-dev/Copulas@main',
'ctgan @ git+https://github.com/sdv-dev/CTGAN@fix-rdt',
'ctgan @ git+https://github.com/sdv-dev/CTGAN@main',
'deepecho @ git+https://github.com/sdv-dev/DeepEcho@main',
'rdt @ git+https://github.com/sdv-dev/RDT@main',
'sdmetrics @ git+https://github.com/sdv-dev/SDMetrics@main',
Expand All @@ -53,36 +53,36 @@ sdv = { main = 'sdv.cli.__main__:main' }
test = [
'pytest>=3.4.2',
'pytest-cov>=2.6.0',
'pytest-rerunfailures>=10.3',
'notebook>=7.1.2',
'rundoc>=0.4.3',
'pytest-rerunfailures>=10.3,<15',
'jupyter>=1.0.0,<2',
'rundoc>=0.4.3,<0.5',
'pytest-runner >= 2.11.1',
'tomli>=2.0.0',
'tomli>=2.0.0,<3',
]
pomegranate = ['pomegranate>=0.14.3']
pomegranate = ['pomegranate>=0.14.3,<0.15']
dev = [
'sdv[test]',

# general
'build>=1.0.0',
'bump-my-version>=0.18.3',
'build>=1.0.0,<2',
'bump-my-version>=0.18.3,<1',
'pip>=9.0.1',
'watchdog>=1.0.1',
'watchdog>=1.0.1,<5',

# docs
'docutils>=0.12',
'm2r2>=0.2.5',
'nbsphinx>=0.5.0',
'sphinx_toolbox>=2.5',
'Sphinx>=3',
'pydata-sphinx-theme',
'markupsafe',
'docutils>=0.12,<1',
'm2r2>=0.2.5,<1',
'nbsphinx>=0.5.0,<1',
'sphinx_toolbox>=2.5,<4',
'Sphinx>=3,<8',
'pydata-sphinx-theme<1',
'markupsafe<3',

# Jinja2>=3 makes the sphinx theme fail
'Jinja2>=2',
'Jinja2>=2,<4',

# style check
'flake8>=3.7.7',
'flake8>=3.7.7,<8',
'flake8-absolute-import>=1.0,<2',
'flake8-builtins>=1.5.3,<3',
'flake8-comprehensions>=3.6.1,<4',
Expand All @@ -92,11 +92,11 @@ dev = [
'flake8-fixme>=1.1.1,<1.2',
'flake8-mock>=0.3,<1',
'flake8-multiline-containers>=0.0.18,<0.1',
'flake8-mutable>=1.2.0,<1.3', #
'flake8-mutable>=1.2.0,<1.3',
'flake8-expression-complexity>=0.0.9,<0.1',
'flake8-print>=4.0.0,<6',
'flake8-print>=4.0.0,<4.1',
'flake8-pytest-style>=1.5.0,<3',
'flake8-quotes>=3.3.0,<4', #
'flake8-quotes>=3.3.0,<4',
'flake8-sfs>=0.0.3,<2',
'flake8-variables-names>=0.0.4,<0.1',
'dlint>=0.11.0,<1',
Expand Down Expand Up @@ -189,7 +189,6 @@ replace = "__version__ = '{new_version}'"
line_length = 99
lines_between_types = 0
multi_line_output = 4
not_skip = ['__init__.py']
use_parentheses = true

[tool.pydocstyle]
Expand Down
11 changes: 8 additions & 3 deletions sdv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@

import sys
import warnings
from importlib.metadata import entry_points
from operator import attrgetter

from pkg_resources import iter_entry_points

from sdv import (
constraints, data_processing, datasets, evaluation, lite, metadata, metrics, multi_table,
sampling, sequential, single_table, version)
Expand Down Expand Up @@ -82,7 +81,13 @@ def _get_addon_target(addon_path_name):
def _find_addons():
"""Find and load all sdv add-ons."""
group = 'sdv_modules'
for entry_point in iter_entry_points(group=group):
try:
eps = entry_points(group=group)
except TypeError:
# Load-time selection requires Python >= 3.10 or importlib_metadata >= 3.6
eps = entry_points().get(group, [])

for entry_point in eps:
try:
addon = entry_point.load()
except Exception as e: # pylint: disable=broad-exception-caught
Expand Down
2 changes: 1 addition & 1 deletion sdv/metadata/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def _get_graphviz_extension(filepath):


def _replace_special_characters(string):
return string.replace('<', '\<').replace('>', '\>') # noqa: W605
return string.replace('<', '\\<').replace('>', '\\>') # noqa: W605


def visualize_graph(nodes, edges, filepath=None):
Expand Down
17 changes: 13 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@
max-line-length = 99
inline-quotes = single
exclude = docs, .tox, .git, __pycache__, .ipynb_checkpoints
extend-ignore = D105, # Missing docstring in magic method
D107, # Missing docstring in __init__
PD005, # Use arithmetic operator instead of method
SFS3 # String literal formatting using f-string
extend-ignore =
# Missing docstring in magic method
D105,
# Missing docstring in __init__
D107,
# Use arithmetic operator instead of method
PD005,
# String literal formatting using f-string
SFS3,
# TokenError: unterminated string literal
E902,
# Mutable default arg of type List
M511

[aliases]
test = pytest
2 changes: 1 addition & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def lint(c):
check_dependencies(c)
c.run('flake8 sdv')
c.run('flake8 tests --ignore=D,SFS2')
c.run('isort -c --recursive sdv tests')
c.run('isort -c sdv tests')
c.run('pydocstyle sdv')


Expand Down
2 changes: 1 addition & 1 deletion tests/integration/datasets/test_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from sdv.datasets.local import save_csvs


@pytest.fixture()
@pytest.fixture
def data():
parent = pd.DataFrame(data={
'id': [0, 1, 2, 3, 4],
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/multi_table/test_hma.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import datetime
import importlib.metadata
import re
import warnings

import numpy as np
import pandas as pd
import pkg_resources
import pytest
from faker import Faker
from rdt.transformers import FloatFormatter
Expand Down Expand Up @@ -116,7 +116,7 @@ def test_get_info(self):
info = synthesizer.get_info()

# Assert
version = pkg_resources.get_distribution('sdv').version
version = importlib.metadata.version('sdv')
assert info == {
'class_name': 'HMASynthesizer',
'creation_date': today,
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/single_table/test_base.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import datetime
import importlib.metadata
import re
import warnings
from unittest.mock import patch

import numpy as np
import pandas as pd
import pkg_resources
import pytest
from rdt.transformers import AnonymizedFaker, FloatFormatter, RegexGenerator, UniformEncoder

Expand Down Expand Up @@ -515,7 +515,7 @@ def test_get_info():
info = synthesizer.get_info()

# Assert
version = pkg_resources.get_distribution('sdv').version
version = importlib.metadata.version('sdv')
assert info == {
'class_name': 'GaussianCopulaSynthesizer',
'creation_date': today,
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/single_table/test_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ def _isinstance_side_effect(*args, **kwargs):
)


@pytest.fixture()
@pytest.fixture
def demo_data():
return DEMO_DATA


@pytest.fixture()
@pytest.fixture
def demo_metadata():
return DEMO_METADATA

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/utils/test_poc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from sdv.utils.poc import drop_unknown_references, simplify_schema


@pytest.fixture()
@pytest.fixture
def metadata():
return MultiTableMetadata.load_from_dict(
{
Expand Down Expand Up @@ -45,7 +45,7 @@ def metadata():
)


@pytest.fixture()
@pytest.fixture
def data():
parent = pd.DataFrame(data={
'id': [0, 1, 2, 3, 4],
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/constraints/test_tabular.py
Original file line number Diff line number Diff line change
Expand Up @@ -4026,7 +4026,8 @@ def test_reverse_transform_is_datetime(self, mock_sigmoid, mock_pd):
instance = ScalarRange('current_age', 20, 28)
instance._transformed_column = 'current_age#20#28'
instance._is_datetime = True
mock_pd.to_datetime.side_effect = lambda x, format: pd.to_datetime('2021-02-02 10:10:59')
mock_pd.to_datetime.side_effect = \
lambda x, format: pd.to_datetime('2021-02-02 10:10:59') # noqa: A006

# Run
output = instance.reverse_transform(transformed_data)
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/datasets/test_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,7 @@ def test_save_csvs_existing_files(tmp_path):


def test_save_csvs_existing_files_more_files(tmp_path):
"""Test ``save_csvs`` raises an error with a summary of the existing files when there are more than
three existing files."""
"""Test it errors with a summary of the existing files if more than three existing files."""
# Setup
folder = tmp_path / 'data'
folder.mkdir()
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/metadata/test_multi_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def test__validate_missing_relationship_keys_primary_key(self):
)

def test__validate_no_missing_tables_in_relationship(self):
"""Test the ``_validate_no_missing_tables_in_relationship`` method of ``MultiTableMetadata``.
"""Test ``_validate_no_missing_tables_in_relationship`` of ``MultiTableMetadata``.
Setup:
- Create a list of ``tables``.
Expand Down
Loading

0 comments on commit 318f0e7

Please sign in to comment.