Skip to content

Commit

Permalink
Bump to v0.1.12
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Camillo authored and Lucas Camillo committed Dec 26, 2024
1 parent 10d6752 commit bfb1036
Show file tree
Hide file tree
Showing 11 changed files with 1,294 additions and 940 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
Expand Down
10 changes: 3 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
<<<<<<< HEAD
pyaing/clocks
pyaging_data/
example_data/
testing.ipynb
=======
pyaging/clocks/
clocks/weights/
*.pt
*.json
pyaging_data/
example_data/
testing.ipynb
pyaging_manuscript.ipynb
.ipynb_checkpoints/
*.pyc
.DS_Store
pyaging.egg-info/
update_pipeline_steps.txt
update_package.sh
dist/
build/
docs/_build
docs/_templates
*.RData
>>>>>>> fd1440b (first commit)
.ruff_cache/
.pytest_cache/

9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.11
hooks:
- id: ruff
args: [ --fix, --ignore=E501,E722,B904,E902 ]
stages: [manual]
- id: ruff-format
stages: [manual]
10 changes: 5 additions & 5 deletions docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
- defaults
dependencies:
- python=3.9
- python=3.12
- pip>=22.3
- pip:
- sphinx>=7.2.6
Expand All @@ -15,15 +15,15 @@ dependencies:
- sphinx-design>=0.5.0
- scanpydoc>=0.10.0
- myst-parser>=2.0.0
- ipykernel>=5.5.6
- ipykernel>=6.29.0
- nbsphinx>=0.8.12
- pygments>=2.17.2
- pytest>=7.4.4
- nbmake>=1.4.6
- scikit-learn>=1.4.0
- pandas>=2.2.0
- torch>=2.1.2
- numpy>=1.26.3
- pyBigWig>=0.3.22
- torch>=2.2.0
- numpy>=2.0.0
- pyBigWig>=0.3.23
- anndata>=0.10.4

2 changes: 1 addition & 1 deletion docs/source/installation.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Installation
============

*Please note that pyaging is only supported by python versions 3.9, 3.10, and 3.11.**
*Please note that pyaging is supported by python versions 3.9, 3.10, 3.11, and 3.12.**

pyaging now has been released to PyPi and can easily be installed via:

Expand Down
2,025 changes: 1,109 additions & 916 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyaging/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
from . import predict as pred
from . import preprocess as pp

__version__ = "0.1.11"
__version__ = "0.1.12"
2 changes: 1 addition & 1 deletion pyaging/predict/_pred_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def load_clock(clock_name: str, device: str, dir: str, logger, indent_level: int
weights_path = os.path.join(dir, f"{clock_name}.pt")

# Load the clock from the file
clock = torch.load(weights_path)
clock = torch.load(weights_path, weights_only=False)

# Prepare clock for inference
clock.to(torch.float64)
Expand Down
2 changes: 1 addition & 1 deletion pyaging/utils/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
# Extract indent_level from kwargs, default to 1 if not provided
indent_level = kwargs["indent_level"] if "indent_level" in kwargs.keys() else 1
indent_level = kwargs["indent_level"] if "indent_level" in kwargs else 1

logger = args[-1] # Assumes logger is the last positional argument
logger.start_progress(f"{message} started", indent_level=indent_level)
Expand Down
15 changes: 8 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pyaging"
version = "v0.1.11"
version = "v0.1.12"
description = "A Python-based compendium of GPU-optimized aging clocks."
authors = ["Lucas Paulo de Lima Camillo <[email protected]>"]
license = "BSD"
Expand All @@ -11,12 +11,14 @@ homepage = "https://github.com/rsinghlab/pyaging"
repository = "https://github.com/rsinghlab/pyaging"

[tool.poetry.dependencies]
python = ">=3.9,<3.12"
python = ">=3.9,<3.13"
scikit-learn = "^1.3.2"
pandas = "^2.1.3"
torch = "^2.1.1"
numpy = "^1.26.2"
pandas = ">=2.2.0"
torch = ">=2.2.0"
numpy = ">=2.0.0"
anndata = "^0.10.3"
ipykernel = "^6.29.0"
pybigwig = "^0.3.23"

[tool.poetry.dev-dependencies]
sphinx = "^7.1.2"
Expand All @@ -28,12 +30,11 @@ sphinx-issues = "^3.0.1"
sphinx-design = "^0.5.0"
scanpydoc = "^0.10.0"
myst-parser = "^2.0.0"
ipykernel = "^5.1.0"
nbsphinx = "^0.8.11"
pygments = "^2.6.1"
pytest = "^7.2.0"
nbmake = "^1.4.6"
pyBigWig = {version = "^0.3.22", optional = true}
pyBigWig = {version = "^0.3.23", optional = true}

[tool.poetry.scripts]
pyaging = "pyaging:main"
Expand Down
155 changes: 155 additions & 0 deletions update_package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
#!/bin/bash

# Define the new version and commit/release messages
new_version="v0.1.12" # Replace with the actual version number
commit_message="Bump to $new_version" # Replace with the actual commit message
release_message="Release $new_version" # Replace with the actual release message

# Update version in pyproject.toml
echo "Updating version in pyproject.toml to $new_version..."
sed -i '' "s/^version = \".*\"/version = \"$new_version\"/" pyproject.toml
if [ $? -ne 0 ]; then
echo "Error updating version in pyproject.toml"
exit 1
fi

# Update version in __init__.py
echo "Updating version in __init__.py to $new_version..."
sed -i '' "s/__version__ = \".*\"/__version__ = \"${new_version#v}\"/" pyaging/__init__.py
if [ $? -ne 0 ]; then
echo "Error updating version in __init__.py"
exit 1
fi

# Run ruff for linting
echo "Running ruff for linting..."
ruff check pyaging --fix

# Run black for code formatting
echo "Running ruff for code formatting..."
ruff format pyaging
if [ $? -ne 0 ]; then
echo "ruff formatting failed"
exit 1
fi

# Run poetry update
echo "Running poetry update..."
poetry update
if [ $? -ne 0 ]; then
echo "Poetry update failed"
exit 1
fi

# Build the package
echo "Building the package..."
poetry build
if [ $? -ne 0 ]; then
echo "Poetry build failed"
exit 1
fi

# Install the package
echo "Installing the package..."
poetry install
if [ $? -ne 0 ]; then
echo "Poetry install failed"
exit 1
fi

# Update clocks and notebooks in the 'clocks/notebooks' directory
#echo "Updating clocks and notebooks..."
#cd clocks/notebooks
#total=$(ls *.ipynb | wc -l)
#counter=1
#for notebook in *.ipynb; do
# # Skip the file if it is 'template.ipynb'
# if [ "$notebook" = "template.ipynb" ]; then
# echo "Skipping template.ipynb"
# continue
# fi
#
# echo "Processing clock notebook ($counter/$total): $notebook"
# #jupyter nbconvert --to notebook --execute "$notebook" #Change
# jupyter nbconvert --execute --inplace "$notebook" # Execute in place
# if [ $? -ne 0 ]; then
# echo "Error processing $notebook"
# exit 1
# fi
# let counter=counter+1
#done
#cd ../..

# Run the script to update all clocks
#echo "Running script to update all clocks..."
#cd clocks
#python3 update_all_clocks.py $new_version
#if [ $? -ne 0 ]; then
# echo "Updating clocks failed"
# exit 1
#fi
#cd ..
#echo "Reminder: Upload all clocks and metadata to S3!"

# Process tutorials
#echo "Processing tutorials..."
#cd tutorials
#for notebook in *.ipynb; do
# echo "Processing tutorial notebook: $notebook"
# jupyter nbconvert --ExecutePreprocessor.timeout=600 --to notebook --execute --inplace "$notebook"
#done
#cd ..

# Run gold standard tests
echo "Running gold standard tests..."
poetry run pytest
if [ $? -ne 0 ]; then
echo "Gold standard tests failed"
exit 1
fi

# Run tutorial tests
echo "Running tutorial tests..."
poetry run pytest --nbmake tutorials/
if [ $? -ne 0 ]; then
echo "Tutorial tests failed"
exit 1
fi

# Build documentation
echo "Building documentation..."
cp tutorials/*.ipynb docs/source/tutorials
cp clocks/notebooks/*.ipynb docs/source/clock_notebooks
cd docs
make html
if [ $? -ne 0 ]; then
echo "Documentation build failed"
exit 1
fi
cd ..

# Commit and push changes
echo "Committing and pushing changes..."
git add .
git commit -m "$commit_message"
if [ $? -ne 0 ]; then
echo "Git commit failed"
exit 1
fi

git push
if [ $? -ne 0 ]; then
echo "Git push failed"
exit 1
fi

# Create and push tag
echo "Creating and pushing tag $new_version..."
git tag -a "$new_version" -m "$release_message"
git push origin "$new_version"
if [ $? -ne 0 ]; then
echo "Git tag creation or push failed"
exit 1
fi

echo "Version update pipeline completed successfully."

0 comments on commit bfb1036

Please sign in to comment.