pairtools icon indicating copy to clipboard operation
pairtools copied to clipboard

Deprecation of `pipes` Module in Python 3.13 in `pairtools/lib/fileio.py`

Open ShigrafS opened this issue 8 months ago • 1 comments

In Python 3.13, the pipes module is deprecated and will be removed in future versions of Python. The current implementation in the pairtools/lib/fileio.py file relies on the pipes module, which triggers a DeprecationWarning when running the code on Python 3.13 or higher.

This issue tracks the necessary refactor to remove the use of the pipes module and ensure compatibility with future Python releases.

Affected File:

  • pairtools/lib/fileio.py

Problem:

The code in pairtools/lib/fileio.py uses the deprecated pipes module. Python's DeprecationWarning indicates that this module will be removed in Python 3.13, which could cause compatibility issues for users who upgrade to newer Python versions.

Example Warning:

When running the code on Python 3.13 or higher, the following warning is triggered:

DeprecationWarning: 'pipes' is deprecated and slated for removal in Python 3.13
    import pipes

Proposed Solution:

  • Refactor the pairtools/lib/fileio.py code to eliminate the use of the pipes module.
  • Replace pipes-based functionality with a more modern alternative, such as the subprocess module, which is the recommended way to interact with system processes in Python.
  • Ensure that the new implementation preserves the original behavior and functionality of the code.

Impact:

  • The removal of pipes will ensure that pairtools remains compatible with Python 3.13 and beyond.
  • Users running Python 3.13 or later will no longer see the DeprecationWarning related to the pipes module.

Additional Notes:

  • This change will help future-proof the code against Python 3.13+ by removing reliance on deprecated features.
  • Testing will be required after the refactor to verify that the changes do not affect the functionality or performance of the software.

Action Items:

  1. Identify all occurrences of pipes in pairtools/lib/fileio.py.
  2. Refactor the code to replace pipes with alternatives (e.g., subprocess or other suitable methods).
  3. Test the refactored code to ensure that it works as expected and does not trigger DeprecationWarnings.
  4. Document the change and update any relevant documentation or comments in the code.

This issue ensures that pairtools is prepared for future Python versions by addressing the deprecation of the pipes module.

ShigrafS avatar Mar 22 '25 18:03 ShigrafS

@nvictus Hello. I'm refactoring auto_open function right now. Can you make me assignee, i'll commit in a few days?

Reovirus avatar Apr 09 '25 16:04 Reovirus

Resolved with https://github.com/open2c/pairtools/commit/f8963118d7baffc525a51c3f8e2abe083dccb06c

agalitsyna avatar Jun 19 '25 17:06 agalitsyna