Skip to content

Refresh#35

Merged
davek44 merged 4 commits intomasterfrom
refresh
Apr 4, 2026
Merged

Refresh#35
davek44 merged 4 commits intomasterfrom
refresh

Conversation

@davek44
Copy link
Copy Markdown
Contributor

@davek44 davek44 commented Apr 4, 2026

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:

  • Updated supported Python versions to 3.10, 3.11, and 3.12 in the GitHub Actions workflow and documentation, removing support for older versions. [1] [2]
  • Updated the project version to 0.4.0 in both VERSION and scnym/__init__.py. [1] [2]

Linting, Pre-commit, and CI Improvements:

  • Switched from flake8 to ruff for linting in both GitHub Actions and pre-commit hooks, and added a new .pre-commit-config.yaml for automated code quality checks. [1] [2]
  • Added a pyproject.toml configuration for ruff and pytest.

Code Modernization and Compatibility:

  • Replaced deprecated or ambiguous NumPy types (e.g., 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]
  • Updated usage of Scanpy and AnnData APIs for compatibility, such as switching from scanpy.api to scanpy, and from scanpy.pp.normalize_per_cell to scanpy.pp.normalize_total, and from anndata.concatenate to anndata.concat. [1] [2]

Error Handling and Robustness:

  • Improved error handling by replacing assert statements with explicit exceptions (e.g., FileNotFoundError, ValueError, RuntimeError) for clearer feedback and better debugging. [1] [2] [3] [4]

Miscellaneous Improvements:

  • Simplified or removed TensorBoard/TensorFlow compatibility code that is no longer needed.
  • Updated YAML loading to use yaml.safe_load for security.
  • Fixed parameter ordering in PyTorch's add_ method for future compatibility.

These changes collectively modernize the codebase, improve reliability and maintainability, and streamline the development workflow.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.toml tool 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.

@davek44 davek44 merged commit e19f4f7 into master Apr 4, 2026
0 of 3 checks passed
@davek44 davek44 deleted the refresh branch April 4, 2026 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants