Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
94 changes: 94 additions & 0 deletions .github/workflows/test_auto_fixes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Run Python test
permissions:
contents: write
on:
workflow_call:
inputs:
skip_tests:
type: boolean
default: false
required: false
test_python_lower:
type: boolean
default: false
required: false
# DO NOT CHANGE NAME OF WORKFLOW, USED IN OTHER WORKFLOWS KEEP "Rust Tests"
jobs:
select-strategy:
runs-on: ubuntu-latest
outputs:
python-versions: ${{ steps.set-matrix.outputs.python-versions }}
steps:
- id: set-matrix
run: |
echo "python-versions=[\"3.9\",\"3.13\"]" >> $GITHUB_OUTPUT
python-test:
if: ${{ !inputs.skip_tests }}
name: Python Tests
needs: select-strategy
strategy:
matrix:
python: ${{ fromJson(needs.select-strategy.outputs.python-versions) }}
os: [ubuntu-latest]
runs-on: '${{ matrix.os }}'
steps:
- uses: actions/checkout@v4
name: Checkout
with:
ref: ${{ github.head_ref }}
- name: Setup Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: 'pip'
- name: Install Python dependencies
run: |
echo "Installing test dependencies..."
python -m pip install pytest tox
python -m pip install -e examples/netflow
python -m pip install black
echo "Installing linting dependencies from cache..."
python -m pip install maturin mypy networkx pyvis pandas-stubs
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Validate graphQL schema
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13'
run: |
npx graphql-schema-linter --rules fields-have-descriptions,types-have-descriptions raphtory-graphql/schema.graphql || true
- name: Update docs from graphQL schema
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13'
run: |
python docs/scripts/gen_docs_graphql_pages.py
- name: Run python linter
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13'
run: |
cd python && black .
- name: Run stubsgen
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13'
run: |
echo "Installing Raphtory from ./python"
pip install -e ./python
echo "Installing stubsgen"
python -m pip install -e stub_gen
cd python/scripts && python gen-stubs.py
- name: Run mypy
run: |
mypy -m raphtory
- name: Check for uncommitted changes
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "Changes detected. Committing and pushing..."
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout ${{ github.head_ref }}
git add .
git commit -m "chore: apply tidy-public auto-fixes"
git push --force-with-lease origin HEAD:${{ github.head_ref }}
else
echo "No changes to commit."
fi
7 changes: 7 additions & 0 deletions .github/workflows/test_during_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@
uses: ./.github/workflows/test_rust_disk_storage_workflow.yml
secrets: inherit
needs: rust-format-check
call-test-auto-fixes:
name: Run auto fixes
uses: ./.github/workflows/test_auto_fixes.yml
with:
test_python_lower: false
secrets: inherit
needs: rust-format-check
call-test-python-workflow-in-local-repo:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium test

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
name: Run Python tests
uses: ./.github/workflows/test_python_workflow.yml
with:
Expand Down
44 changes: 0 additions & 44 deletions .github/workflows/test_python_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,53 +64,9 @@ jobs:
python -m pip install black
echo "Installing linting dependencies from cache..."
python -m pip install maturin mypy networkx pyvis pandas-stubs
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Run Python tests
run: |
cd python && tox run
- name: Run Python extension tests
run: |
cd examples/netflow/test && pytest .
- name: Validate graphQL schema
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13'
run: |
npx graphql-schema-linter --rules fields-have-descriptions,types-have-descriptions raphtory-graphql/schema.graphql || true
- name: Update docs from graphQL schema
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13'
run: |
python docs/scripts/gen_docs_graphql_pages.py
- name: Run python linter
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13'
run: |
cd python && black .
- name: Run stubsgen
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13'
run: |
echo "Installing Raphtory from ./python"
pip install -e ./python
echo "Installing stubsgen"
python -m pip install -e stub_gen
cd python/scripts && python gen-stubs.py
- name: Run mypy
run: |
mypy -m raphtory

- name: Check for uncommitted changes
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "Changes detected. Committing and pushing..."
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout ${{ github.head_ref }}
git add .
git commit -m "chore: apply tidy-public auto-fixes"
git push --force-with-lease origin HEAD:${{ github.head_ref }}
else
echo "No changes to commit."
fi
32 changes: 16 additions & 16 deletions docs/reference/graphql/graphql_API.md
Original file line number Diff line number Diff line change
Expand Up @@ -2417,43 +2417,43 @@ This allows you to specify multiple operations together.
</thead>
<tbody>
<tr>
<td colspan="2" valign="top"><strong id="graphalgorithmplugin.shortest_path">shortest_path</strong></td>
<td valign="top">[<a href="#shortestpathoutput">ShortestPathOutput</a>!]!</td>
<td colspan="2" valign="top"><strong id="graphalgorithmplugin.pagerank">pagerank</strong></td>
<td valign="top">[<a href="#pagerankoutput">PagerankOutput</a>!]!</td>
<td></td>
</tr>
<tr>
<td colspan="2" align="right" valign="top">source</td>
<td valign="top"><a href="#string">String</a>!</td>
<td colspan="2" align="right" valign="top">iterCount</td>
<td valign="top"><a href="#int">Int</a>!</td>
<td></td>
</tr>
<tr>
<td colspan="2" align="right" valign="top">targets</td>
<td valign="top">[<a href="#string">String</a>!]!</td>
<td colspan="2" align="right" valign="top">threads</td>
<td valign="top"><a href="#int">Int</a></td>
<td></td>
</tr>
<tr>
<td colspan="2" align="right" valign="top">direction</td>
<td valign="top"><a href="#string">String</a></td>
<td colspan="2" align="right" valign="top">tol</td>
<td valign="top"><a href="#float">Float</a></td>
<td></td>
</tr>
<tr>
<td colspan="2" valign="top"><strong id="graphalgorithmplugin.pagerank">pagerank</strong></td>
<td valign="top">[<a href="#pagerankoutput">PagerankOutput</a>!]!</td>
<td colspan="2" valign="top"><strong id="graphalgorithmplugin.shortest_path">shortest_path</strong></td>
<td valign="top">[<a href="#shortestpathoutput">ShortestPathOutput</a>!]!</td>
<td></td>
</tr>
<tr>
<td colspan="2" align="right" valign="top">iterCount</td>
<td valign="top"><a href="#int">Int</a>!</td>
<td colspan="2" align="right" valign="top">source</td>
<td valign="top"><a href="#string">String</a>!</td>
<td></td>
</tr>
<tr>
<td colspan="2" align="right" valign="top">threads</td>
<td valign="top"><a href="#int">Int</a></td>
<td colspan="2" align="right" valign="top">targets</td>
<td valign="top">[<a href="#string">String</a>!]!</td>
<td></td>
</tr>
<tr>
<td colspan="2" align="right" valign="top">tol</td>
<td valign="top"><a href="#float">Float</a></td>
<td colspan="2" align="right" valign="top">direction</td>
<td valign="top"><a href="#string">String</a></td>
<td></td>
</tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion python/python/raphtory/vectors/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class VectorSelection(object):

def expand_entities_by_similarity(self, query: str | list, limit: int, window: Optional[Tuple[int | str, int | str]] = None) -> None:
"""
Add the top `limit` adjacent entities with higher score for `query` to the selection
Adds the top `limit` adjacent entities with higher score for `query` to the selection.

The expansion algorithm is a loop with two steps on each iteration:
1. All the entities 1 hop away of some of the entities included on the selection (and
Expand Down
2 changes: 1 addition & 1 deletion raphtory-graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -947,8 +947,8 @@ type Graph {
}

type GraphAlgorithmPlugin {
shortest_path(source: String!, targets: [String!]!, direction: String): [ShortestPathOutput!]!
pagerank(iterCount: Int!, threads: Int, tol: Float): [PagerankOutput!]!
shortest_path(source: String!, targets: [String!]!, direction: String): [ShortestPathOutput!]!
}

type GraphSchema {
Expand Down
2 changes: 1 addition & 1 deletion raphtory/src/python/packages/vectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ impl PyVectorSelection {
self_.0.expand(hops, translate_window(window))
}

/// Add the top `limit` adjacent entities with higher score for `query` to the selection
/// Adds the top `limit` adjacent entities with higher score for `query` to the selection.
///
/// The expansion algorithm is a loop with two steps on each iteration:
/// 1. All the entities 1 hop away of some of the entities included on the selection (and
Expand Down
Loading