Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
ee618b5
fix: validate channel ID against template ID in term info parsing
Robbie1977 May 27, 2025
21b2b1a
fix: update label assignment logic in term info parsing for accurate …
Robbie1977 May 27, 2025
bd59fb0
fix: correct image ID and label in template example for consistency
Robbie1977 May 27, 2025
4ac721c
fix: update file paths in template example for correct resource linking
Robbie1977 May 27, 2025
515458d
typo fix
Robbie1977 May 27, 2025
6a05f86
fix: add lineage_CM3 tag to neuron examples and update thumbnail URLs
Robbie1977 May 27, 2025
c2a7cda
fix: update term info deserialization test for accurate synonym matching
Robbie1977 May 27, 2025
f979343
fix: update term info serialization test to check for presence of exa…
Robbie1977 May 27, 2025
2b048c3
fix: update pip install command to ensure dependencies are upgraded
Robbie1977 May 27, 2025
1f5321e
fix: update expected short form in term info serialization test
Robbie1977 May 27, 2025
579295c
fix: add debug prints for term info deserialization from dict
Robbie1977 May 27, 2025
4e1ef28
fix: update publish workflow and versioning for PyPI release
Robbie1977 Jun 15, 2025
364bc22
fix: update .gitignore and .env files, enhance SolrTermInfoFetcher wi…
Robbie1977 Jun 16, 2025
aeabfe5
fix: correct JSON formatting in README and update example data for te…
Robbie1977 Jun 16, 2025
c03dd0f
fix: remove redundant JSON code block in individual example of README
Robbie1977 Jun 16, 2025
740eb82
fix: remove incorrect JSON code block from class example in README
Robbie1977 Jun 16, 2025
c86bfd9
fix: replace dict_cursor with lazy-loaded get_dict_cursor in DataFram…
Robbie1977 Jun 16, 2025
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
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PYTHONPATH=${workspaceFolder}/src
MPLBACKEND=Agg
VISPY_GL_LIB=osmesa
VISPY_USE_EGL=0
152 changes: 102 additions & 50 deletions .github/workflows/publish_to_pypi.yaml
Original file line number Diff line number Diff line change
@@ -1,63 +1,115 @@
name: Publish to PyPI
name: Publish 🐍 📦 to PyPI

on:
workflow_dispatch:
release:
types: [created]
# TODO: For testing purpose, delete this trigger afterwards
# push:
# paths:
# - '.github/workflows/publish_to_pypi.yaml'

jobs:
build-n-publish:
name: Build and publish Python distributions to PyPI
runs-on: ubuntu-22.04
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v2
- name: Install semver
run: |
npm install semver
- name: Update version in setup.py
uses: actions/github-script@v4
with:
script: |
const fs = require('fs');
const semver = require('semver');
const version = context.payload.release.tag_name.replace(/^v/, '');
const setupFile = `${process.env.GITHUB_WORKSPACE}/setup.py`;
const setupContent = fs.readFileSync(setupFile, 'utf8');
const newSetupContent = setupContent.replace(
/__version__\s*=\s*['"][^'"]*['"]/,
`__version__ = '${version}'`
);
fs.writeFileSync(setupFile, newSetupContent, 'utf8');
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python 3.8
uses: actions/setup-python@v2
- uses: actions/checkout@v4
with:
python-version: 3.8
- name: Install wheel and setuptools
run: >-
python -m
pip install
wheel
setuptools
get_version
--user
--upgrade
- name: Build a binary wheel and a source tarball
run: >-
python3
setup.py
sdist
bdist_wheel
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
fetch-depth: 0 # Fetch full history including tags
ref: ${{ github.ref }} # Explicitly checkout the tag

- name: Set up Python 3.10.18
uses: actions/setup-python@v5
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
python-version: 3.10.18

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build wheel "setuptools>=45,<69" twine
python -m pip list

- name: Set version from GitHub Release tag
run: |
echo "Git information:"
git tag -l
git log -1 --oneline
git describe --tags --always

# When running from a release, extract version from tag
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
# Extract clean version number from tag (removes v prefix)
VERSION=${GITHUB_REF#refs/tags/v}
echo "Running from GitHub release tag: v$VERSION"

# Set environment variables for the build
echo "VERSION=$VERSION" >> $GITHUB_ENV

# Update version in setup.py
echo "Updating version in setup.py to $VERSION"
sed -i "s/__version__ = \"[^\"]*\"/__version__ = \"$VERSION\"/" setup.py

# Update version in package __init__.py
echo "Updating version in src/vfbquery/__init__.py to $VERSION"
sed -i "s/__version__ = \"[^\"]*\"/__version__ = \"$VERSION\"/" src/vfbquery/__init__.py

echo "Updated setup.py version:"
grep "__version__" setup.py
echo "Updated package version:"
grep "__version__" src/vfbquery/__init__.py
else
# Not running from a tag, show current version
echo "Not running from a tag, using existing version from setup.py"
grep "__version__" setup.py
fi

- name: Build distributions
run: |
echo "Building distributions..."
python -m build

# Verify the source distribution metadata
if [[ -n "$VERSION" ]]; then
echo "Checking source distribution metadata:"
SDIST_NAME_BASE="vfbquery-${VERSION}"
SDIST_FILE="dist/${SDIST_NAME_BASE}.tar.gz"
PKG_INFO_PATH="${SDIST_NAME_BASE}/PKG-INFO"
echo "Extracting Version from PKG-INFO in ${SDIST_FILE} (path: ${PKG_INFO_PATH})"
tar -zxf "${SDIST_FILE}" -O "${PKG_INFO_PATH}" | grep "^Version:"

# Verify the wheel metadata
WHEEL_NAME="vfbquery-${VERSION}-py3-none-any.whl"
WHEEL_FILE="dist/${WHEEL_NAME}"
DIST_INFO_PATH="vfbquery-${VERSION}.dist-info/METADATA"
echo "Extracting Version from ${DIST_INFO_PATH} in ${WHEEL_FILE}"
unzip -p "${WHEEL_FILE}" "${DIST_INFO_PATH}" | grep "^Version:"
fi

- name: Verify metadata with twine
run: |
python -m twine check dist/*

- name: Install and verify wheel version
run: |
# Install the wheel
python -m pip install dist/*.whl

# Verify the installed version matches the expected version
if [[ -n "$VERSION" ]]; then
INSTALLED_VERSION=$(python -c "import vfbquery; print(getattr(vfbquery, '__version__', 'unknown'))" 2>/dev/null || echo "unknown")
echo "Expected version: $VERSION"
echo "Installed version: $INSTALLED_VERSION"

if [[ "$VERSION" != "$INSTALLED_VERSION" ]] && [[ "$INSTALLED_VERSION" != "unknown" ]]; then
echo "WARNING: Version mismatch detected, but proceeding with build"
fi

echo "Version verification completed"
else
echo "No explicit version set, skipping version verification"
python -c "import vfbquery; print(f'Package installed successfully')" 2>/dev/null || echo "Package verification completed"
fi

- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@v1.12.2
# - name: Publish package to TestPyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -r requirements.txt
python -m pip install -U -r requirements.txt
python -m pip install .
- name: Run term_info_queries_test
run: |
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ src/vfbquery/ontology/__pycache__/
build/
test_examples.py
test_results.py
.vscode
.pytest_cache
.venv
.vscode/settings.json
8 changes: 6 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
"-s",
"./src/test/",
"-p",
"*.py"
"*test*.py"
],
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": true
"python.testing.unittestEnabled": true,
"python.testing.cwd": "${workspaceFolder}",
"python.envFile": "${workspaceFolder}/.env",
"python.terminal.activateEnvironment": true,
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python"
}
Loading
Loading