Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): allow xopen major version 2 #1532

Merged
merged 6 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## __NEXT__

### Features

* Support xopen major version 2. Deprecate v1. Schedule for removal around November 2024. [#1532][] (@corneliusroemer)

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

## 25.0.0 (10 July 2024)

Expand Down
4 changes: 4 additions & 0 deletions DEPRECATED.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ These features are deprecated, which means they are no longer maintained and
will go away in a future major version of Augur. They are currently still
available for backwards compatibility, but should not be used in new code.

## `xopen` major version 1

*Deprecated in version __NEXT__ (July 2024). Planned for removal at the earliest with major version 26 not before November 2024*

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

*Deprecated in February 2024. Planned to be reordered June 2024 or after.*
Expand Down
16 changes: 15 additions & 1 deletion augur/io/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,23 @@
from contextlib import contextmanager
from io import IOBase
from textwrap import dedent
from xopen import PipedCompressionReader, PipedCompressionWriter, xopen

from xopen import xopen

from augur.errors import AugurError
corneliusroemer marked this conversation as resolved.
Show resolved Hide resolved

# 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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"phylo-treetime >=0.11.2, <0.12",
"pyfastx >=1.0.0, <3.0",
"scipy ==1.*",
"xopen[zstd] >=1.7.0, ==1.*"
"xopen[zstd] >=1.7.0, <3" # TODO: Deprecated, remove v1 support around November 2024
],
extras_require = {
'dev': [
Expand Down
Loading