Conversation
There was a problem hiding this comment.
Pull request overview
Modernizes the scNym codebase for newer Python/scientific stack versions, improves CI/linting workflow, and updates deprecated APIs/types for forward compatibility.
Changes:
- Bumps supported Python versions (3.10–3.12), updates dependencies, and increments project version to 0.4.0.
- Migrates linting to Ruff and adds pre-commit +
pyproject.tomltool configuration. - Updates code/tests to newer AnnData/Scanpy/SciPy/NumPy APIs and replaces
assert-based checks with explicit exceptions.
Reviewed changes
Copilot reviewed 24 out of 26 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| VERSION | Version bump to 0.4.0. |
| setup.py | Reads version from VERSION, raises minimum Python, adds dev extras. |
| requirements.txt | Refreshes dependency pins for the modernized stack. |
| pyproject.toml | Adds Ruff + pytest configuration. |
| .pre-commit-config.yaml | Adds pre-commit hooks and Ruff integration. |
| .github/workflows/python-package.yml | Updates CI matrix/actions and switches linting to Ruff. |
| README.md | Updates recommended Python version and env setup instructions. |
| .gitignore | Expands ignored caches/artifacts and local env/editor files. |
| demo_script.sh | Updates Scanpy import/API usage for normalization. |
| scnym/utils.py | Replaces deprecated sparse/NumPy types and updates Scanpy Leiden calls. |
| scnym/api.py | Uses anndata.concat, improves error handling, updates bool dtype usage. |
| scnym/main.py | Removes legacy TensorBoard/TF workaround, uses yaml.safe_load, updates types. |
| scnym/trainer.py | Switches SummaryWriter import to tensorboardX. |
| scnym/losses.py | Replaces asserts with explicit exceptions; updates PyTorch add_ call signature. |
| scnym/dataprep.py | Replaces deprecated NumPy integer types and cleans up scalar extraction. |
| scnym/interpret.py | Replaces deprecated NumPy bool/int types. |
| scnym/predict.py | Updates sparse type hints. |
| scnym/init.py | Updates __version__ to 0.4.0. |
| tests/test_*.py | Updates tests for new Scanpy normalization/Leiden parameters and NumPy scalar extraction. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several important updates to modernize the codebase, improve reliability, and enhance developer experience. The main themes are the migration to newer Python versions, improved linting and pre-commit tooling, code modernization for compatibility, and enhanced error handling. Below are the most significant changes:
Python Version and Dependency Updates:
0.4.0in bothVERSIONandscnym/__init__.py. [1] [2]Linting, Pre-commit, and CI Improvements:
flake8torufffor linting in both GitHub Actions and pre-commit hooks, and added a new.pre-commit-config.yamlfor automated code quality checks. [1] [2]pyproject.tomlconfiguration forruffandpytest.Code Modernization and Compatibility:
np.int,np.bool,sparse.csr.csr_matrix) with standard Python types (int,bool,sparse.csr_matrix) throughout the codebase to ensure compatibility with newer Python and library versions. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18]scanpy.apitoscanpy, and fromscanpy.pp.normalize_per_celltoscanpy.pp.normalize_total, and fromanndata.concatenatetoanndata.concat. [1] [2]Error Handling and Robustness:
assertstatements with explicit exceptions (e.g.,FileNotFoundError,ValueError,RuntimeError) for clearer feedback and better debugging. [1] [2] [3] [4]Miscellaneous Improvements:
yaml.safe_loadfor security.add_method for future compatibility.These changes collectively modernize the codebase, improve reliability and maintainability, and streamline the development workflow.