Skip to content

Commit

Permalink
Merge pull request #57 from gandersen101/refactor-pydantic-compat
Browse files Browse the repository at this point in the history
Refactor pydantic compat
  • Loading branch information
gandersen101 committed Apr 24, 2021
2 parents de34205 + e714253 commit d2161b5
Show file tree
Hide file tree
Showing 26 changed files with 707 additions and 695 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
*v0.5.1 Release Notes:*
- *Minor updates to allowed dependency versions and CI.*
- *Switched back to using typing types instead of generic types because spaCy v3 uses Pydantic and Pydantic does not support generic types in Python < 3.9. I don't know if this would actually cause any issues but I am playing it safe. Potentially more changes for spaczz to play nicely with Pydantic to follow.*

*v0.5.0 Release Notes:*
- *Support for spaCy v3.*
- *If using spaCy v3, the `SpaczzRuler` optional arguments no longer need to be prepended with `"spaczz_"`. This will still work in most cases offering some backwards compatibility. However, optional arguments prepended with `"spaczz_"` will not work with spaCy v3's new `spacy.load` and `nlp.add_pipe` config driven APIs. It is therefore recommended that users move away from using the prepended versions if using spaCy v3. It should be noted however that the prepended arguments are still necessary if using spaczz with spaCy v2.*
Expand Down
13 changes: 3 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,16 @@ Fuzzy matching is currently performed with matchers from [RapidFuzz](https://git

Spaczz has been tested on Ubuntu 18.04, MacOS 10.15, and Windows Server 2019.

*Note: Python 3.9.1 and Numpy on MacOS can have issues. This is not a spaczz issue. Try Python 3.9.0 instead.*
*v0.5.1 Release Notes:*
- *Minor updates to allowed dependency versions and CI.*
- *Switched back to using typing types instead of generic types because spaCy v3 uses Pydantic and Pydantic does not support generic types in Python < 3.9. I don't know if this would actually cause any issues but I am playing it safe. Potentially more changes for spaczz to play nicely with Pydantic to follow.*

*v0.5.0 Release Notes:*
- *Support for spaCy v3.*
- *If using spaCy v3, the `SpaczzRuler` optional arguments no longer need to be prepended with `"spaczz_"`. This will still work in most cases offering some backwards compatibility. However, optional arguments prepended with `"spaczz_"` will not work with spaCy v3's new `spacy.load` and `nlp.add_pipe` config driven APIs. It is therefore recommended that users move away from using the prepended versions if using spaCy v3. It should be noted however that the prepended arguments are still necessary if using spaczz with spaCy v2.*
- *`Matcher.pipe` methods are now deprecated in accordance with spaCy v3.*
- *`spaczz_span` custom attribute is deprecated in favor of `spaczz_ent`. They both have the same functionality but the `spaczz_ent` name makes more sense.*

*v0.4.2 Release Notes:*
- *Fixed a bug where `TokenMatcher` callbacks did nothing.*
- *Fixed a bug where `spaczz_token_defaults` in the `SpaczzRuler` did nothing.*
- *Fixed a bug where defaults would not be added to their respective matchers when loading from bytes/disk in the `SpaczzRuler`.*
- *Fixed some inconsistencies in the `SpaczzRuler` which will be particularly noticeable with ent_ids. See the "Known Issues" section below for more details.*
- *Small tweaks to spaczz custom attributes.*
- *Available fuzzy matching functions have changed in RapidFuzz and have changed in spaczz accordingly.*
- *Preparing for spaCy v3 updates.*

Please see the [changelog](https://github.com/gandersen101/spaczz/blob/master/CHANGELOG.md) for previous release notes. This will eventually be moved to the [Read the Docs](https://spaczz.readthedocs.io/en/latest/) page.

<h1>Table of Contents<span class="tocSkip"></span></h1>
Expand Down
17 changes: 2 additions & 15 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
nox.options.sessions = "lint", "mypy", "safety", "tests"
locations = "src", "tests", "noxfile.py", "docs/conf.py"
min_cov = 98
current_spacy = "3.0.3"
current_spacy = "3.0.6"


def install_with_constraints(session: Session, *args: str, **kwargs: Any) -> None:
Expand All @@ -37,8 +37,8 @@ def install_with_constraints(session: Session, *args: str, **kwargs: Any) -> Non
"poetry",
"export",
"--dev",
"--format=requirements.txt",
"--without-hashes",
"--format=requirements.txt",
f"--output={req_path}",
external=True,
)
Expand Down Expand Up @@ -132,7 +132,6 @@ def safety(session: Session) -> None:
"check",
f"--file={req_path}",
"--full-report",
"--ignore=39462", # tornado issue 2981
)
os.unlink(req_path)
else:
Expand Down Expand Up @@ -167,24 +166,12 @@ def tests(session: Session, spacy: str) -> None:
"coverage[toml]",
"pytest",
"pytest-cov",
"pytest-mock",
spacy_version=spacy,
)
session.run("python", "-m", "spacy", "download", "en_core_web_md")
session.run("pytest", *args)


# Typeguard does not seem to currently work with PEP585
# @nox.session(python=["3.9", "3.8", "3.7"])
# def typeguard(session: Session) -> None:
# """Runtime type checking using Typeguard."""
# args = session.posargs
# session.run("poetry", "install", "--no-dev", external=True)
# install_with_constraints(session, "pytest", "pytest-mock", "typeguard")
# session.run("python", "-m", "spacy", "download", "en_core_web_md")
# session.run("pytest", f"--typeguard-packages={package}", *args)


@nox.session(python=["3.9", "3.8", "3.7"])
def xdoctest(session: Session) -> None:
"""Run examples with xdoctest."""
Expand Down
Loading

0 comments on commit d2161b5

Please sign in to comment.