Skip to content

Commit

Permalink
Merge pull request #1692: Drop support for xopen v1
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlin authored Dec 9, 2024
2 parents 037525d + cc6d19a commit ecce553
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 16 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
### Major Changes

- Drop support for older versions of jsonschema (<4.18.0). [#1691] (@victorlin)
- Drop support for xopen <2.0.0. [#1692] (@victorlin)

### Bug fixes

- export: validation will no longer crash with `KeyError: 'tree'` when newer versions of jsonschema (≥4.18.0) are installed. [#1691] (@victorlin)

[#1691]: https://github.com/nextstrain/augur/pull/1691
[#1692]: https://github.com/nextstrain/augur/pull/1692

## 26.2.0 (20 November 2024)

Expand Down
2 changes: 1 addition & 1 deletion DEPRECATED.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ available for backwards compatibility, but should not be used in new code.

## `xopen` major version 1

*Deprecated in version 25.1.0 (July 2024). Planned for removal November 2024 or after.*
*Deprecated in version 25.1.0 (July 2024). Removed in version 27.0.0 (December 2024).*

## `augur parse` preference of `name` over `strain` as the sequence ID field

Expand Down
16 changes: 2 additions & 14 deletions augur/io/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,9 @@
from contextlib import contextmanager
from io import IOBase
from textwrap import dedent
from xopen import xopen
from xopen import xopen, _PipedCompressionProgram
from augur.errors import AugurError

# Workaround to maintain compatibility with both xopen v1 and v2
# Around November 2024, we shall drop support for xopen v1
# by removing the try-except block and using
# _PipedCompressionProgram directly
try:
from xopen import _PipedCompressionProgram as PipedCompressionReader
from xopen import _PipedCompressionProgram as PipedCompressionWriter
except ImportError:
from xopen import ( # type: ignore[attr-defined, no-redef]
PipedCompressionReader,
PipedCompressionWriter,
)

ENCODING = "utf-8"

Expand Down Expand Up @@ -63,7 +51,7 @@ def open_file(path_or_buffer, mode="r", **kwargs):
Try re-saving the file using the {e.encoding!r} encoding."""))


elif isinstance(path_or_buffer, (IOBase, PipedCompressionReader, PipedCompressionWriter)):
elif isinstance(path_or_buffer, (IOBase, _PipedCompressionProgram)):
yield path_or_buffer

else:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"python_calamine >=0.2.0",
"referencing >=0.29.1, <1.0",
"scipy ==1.*",
"xopen[zstd] >=1.7.0, <3" # TODO: Deprecated, remove v1 support around November 2024
"xopen[zstd] >=2.0.0, <3"
],
extras_require = {
'dev': [
Expand Down

0 comments on commit ecce553

Please sign in to comment.