Skip to content

Commit

Permalink
Merge pull request #66 from capitalone/dev
Browse files Browse the repository at this point in the history
Release v2023.6.1
  • Loading branch information
Faisal authored Jul 1, 2023
2 parents a66656f + 3715423 commit a8ea11c
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest]
python-version:
- 3.7
- 3.8
- 3.9
- "3.10"
- "3.11"
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Table Of Contents
Install
-------

Create a ``conda`` environment with Python 3.7+ and install from PyPI:
Create a ``conda`` environment with Python 3.8+ and install from PyPI:

```console
$ python -m pip install edgetest
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
author = "Akshay Gupta"

# The short X.Y version
version = "2023.6.0"
version = "2023.6.1"
# The full version, including alpha/beta/rc tags
release = ""

Expand Down
2 changes: 1 addition & 1 deletion edgetest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Package initialization."""


__version__ = "2023.6.0"
__version__ = "2023.6.1"

__title__ = "edgetest"
__description__ = "Bleeding edge dependency testing"
Expand Down
8 changes: 6 additions & 2 deletions edgetest/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from pluggy._hooks import _HookRelay

from .logger import get_logger
from .utils import _run_command, pushd
from .utils import _isin_case_dashhyphen_ins, _run_command, pushd

LOG = get_logger(__name__)

Expand Down Expand Up @@ -149,7 +149,11 @@ def upgraded_packages(self) -> List[Dict[str, str]]:
outjson = json.loads(out)

upgrade_wo_extras = [pkg.split("[")[0] for pkg in self.upgrade]
return [pkg for pkg in outjson if pkg.get("name", "") in upgrade_wo_extras]
return [
pkg
for pkg in outjson
if _isin_case_dashhyphen_ins(pkg.get("name", ""), upgrade_wo_extras)
]

def run_tests(self, command: str) -> int:
"""Run the tests in the package directory.
Expand Down
21 changes: 21 additions & 0 deletions edgetest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,3 +479,24 @@ def upgrade_pyproject_toml(
parser["project"]["optional-dependencies"][extra] = upgraded.split("\n") # type: ignore

return parser


def _isin_case_dashhyphen_ins(a: str, vals: List[str]) -> bool:
"""Run isin check that is case and dash/hyphen insensitive.
Paramaters
----------
a : str
String value to check for membership against ``vals``.
vals : list of str
List of strings to check ``a`` against.
Returns
-------
bool
Return ``True`` if ``a`` in vals, otherwise ``False``.
"""
for b in vals:
if a.replace("_", "-").lower() == b.replace("_", "-").lower():
return True
return False
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ maintainer = Akshay Gupta
maintainer_email = [email protected]
url = https://github.com/capitalone/edgetest
python_requires =
>=3.7.0
>=3.8.0
project_urls =
Documentation = https://capitalone.github.io/edgetest/
Bug Tracker = https://github.com/capitalone/edgetest/issues
Expand All @@ -23,10 +23,10 @@ classifiers =
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11

[options]
zip_safe = False
Expand Down Expand Up @@ -100,7 +100,7 @@ console_scripts =
edgetest = edgetest.interface:cli

[bumpver]
current_version = "2023.6.0"
current_version = "2023.6.1"
version_pattern = "YYYY.MM.INC0"
commit_message = "Bump {old_version} to {new_version}"
commit = True
Expand Down
15 changes: 9 additions & 6 deletions tests/test_integration_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
include_package_data = True
packages = find:
install_requires =
click<=8.0.0,>=7.1
scikit-learn>=1.0,<=1.2.0
dask[dataframe]<=2022.1.0
[options.extras_require]
Expand All @@ -57,8 +57,8 @@
extras =
tests
upgrade =
click
dask[dataframe]
Scikit_Learn
Dask[DataFrame]
"""


Expand Down Expand Up @@ -109,6 +109,7 @@ def test_toy_package():
assert result.exit_code == 0
assert Path(loc, ".edgetest").is_dir()
assert Path(loc, ".edgetest", "pandas").is_dir()
assert "pandas" in result.stdout

if not sys.platform == "win32":
assert Path(
Expand Down Expand Up @@ -150,13 +151,15 @@ def test_toy_package_dask():
loc, ".edgetest", "core", "lib", PY_VER, "site-packages", "pandas"
).is_dir()
assert Path(
loc, ".edgetest", "core", "lib", PY_VER, "site-packages", "click"
loc, ".edgetest", "core", "lib", PY_VER, "site-packages", "sklearn"
).is_dir()

config = configparser.ConfigParser()
config.read("setup.cfg")

assert "click" in config["options"]["install_requires"]
assert "scikit-learn" in config["options"]["install_requires"]
assert "dask[dataframe]" in config["options"]["install_requires"]
assert config["edgetest.envs.core"]["extras"] == "\ntests"
assert config["edgetest.envs.core"]["upgrade"] == "\nclick\ndask[dataframe]"
assert config["edgetest.envs.core"]["upgrade"] == "\nScikit_Learn\nDask[DataFrame]"
assert "dask" in result.stdout
assert "scikit-learn" in result.stdout
15 changes: 9 additions & 6 deletions tests/test_integration_toml.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
version = "0.1.0"
description = "Fake description"
requires-python = ">=3.7.0"
dependencies = ["click<=8.0.0,>=7.1", "dask[dataframe]<=2022.1.0"]
dependencies = ["Scikit_Learn>=1.0,<=1.2.0", "Dask[dataframe]<=2022.1.0"]
[project.optional-dependencies]
tests = ["pytest"]
[edgetest.envs.core]
extras = ["tests"]
upgrade = ["click", "dask[dataframe]"]
upgrade = ["scikit-learn", "dask[dataframe]"]
"""


Expand Down Expand Up @@ -89,6 +89,7 @@ def test_toy_package():
assert result.exit_code == 0
assert Path(loc, ".edgetest").is_dir()
assert Path(loc, ".edgetest", "pandas").is_dir()
assert "pandas" in result.stdout

if not sys.platform == "win32":
assert Path(
Expand Down Expand Up @@ -130,15 +131,17 @@ def test_toy_package_dask():
loc, ".edgetest", "core", "lib", PY_VER, "site-packages", "pandas"
).is_dir()
assert Path(
loc, ".edgetest", "core", "lib", PY_VER, "site-packages", "click"
loc, ".edgetest", "core", "lib", PY_VER, "site-packages", "sklearn"
).is_dir()

config = load(open("pyproject.toml"))

assert "click" in config["project"]["dependencies"][0]
assert "dask" in config["project"]["dependencies"][1]
assert "Scikit_Learn" in config["project"]["dependencies"][0]
assert "Dask" in config["project"]["dependencies"][1]
assert config["edgetest"]["envs"]["core"]["extras"] == ["tests"]
assert config["edgetest"]["envs"]["core"]["upgrade"] == [
"click",
"scikit-learn",
"dask[dataframe]",
]
assert "dask" in result.stdout
assert "scikit-learn" in result.stdout
13 changes: 13 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
parse_toml,
upgrade_pyproject_toml,
upgrade_setup_cfg,
_isin_case_dashhyphen_ins,
)

REQS = """
Expand Down Expand Up @@ -481,3 +482,15 @@ def test_upgrade_pyproject_toml(tmpdir):
"optional-dependencies": {"tests": ["pytest<=4.0.0,>=1.0.0"]},
}
}


def test_isin_case_dashhyphen_ins():
vals = ["pandas", "python-dateutil"]

assert _isin_case_dashhyphen_ins("pandas", vals)
assert _isin_case_dashhyphen_ins("Pandas", vals)
assert not _isin_case_dashhyphen_ins("Panda$", vals)
assert _isin_case_dashhyphen_ins("python-dateutil", vals)
assert _isin_case_dashhyphen_ins("Python_Dateutil", vals)
assert not _isin_case_dashhyphen_ins("Python_Dateut1l", vals)
assert not _isin_case_dashhyphen_ins("pandaspython-dateutil", vals)

0 comments on commit a8ea11c

Please sign in to comment.