From 78902d450bedcc312d1385c2a7bf307091bf42d0 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 30 Aug 2024 12:42:23 -0400 Subject: [PATCH 1/9] new: actions ci --- .github/workflows/analyze.yml | 69 ++++++++++++++++++++++++++++ .github/workflows/docs.yaml | 29 ++++++++++++ .github/workflows/release.yml | 86 +++++++++++++++++++++++++++++++++++ 3 files changed, 184 insertions(+) create mode 100644 .github/workflows/analyze.yml create mode 100644 .github/workflows/docs.yaml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/analyze.yml b/.github/workflows/analyze.yml new file mode 100644 index 00000000..5f0b6d9a --- /dev/null +++ b/.github/workflows/analyze.yml @@ -0,0 +1,69 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: analyze +on: + workflow_dispatch: + push: + branches: [ main ] + pull_request: + branches: [ main ] + schedule: + - cron: "00 9 1,15 * *" +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: ["python"] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] + # Learn more: + # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v3 + + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml new file mode 100644 index 00000000..70feec2c --- /dev/null +++ b/.github/workflows/docs.yaml @@ -0,0 +1,29 @@ +name: Docs + +on: + pull_request: + workflow_dispatch: + +jobs: + docs: + runs-on: ubuntu-latest + + name: Docs + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Fetch all tags and branches + run: git fetch --prune --unshallow + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Install dependencies + run: pip install .[dev] && pip install -r docs/requirements.txt + + - name: Generate Sphinx HTML + run: cd docs && make html \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..ae1eb1e3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,86 @@ +name: release +on: + workflow_dispatch: + release: + types: [published] +jobs: + release: + runs-on: ubuntu-latest + name: Release package + steps: + - uses: actions/checkout@v4 + + - name: Fetch complete history for all tags and branches + run: git fetch --prune --unshallow + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: Install release packages + run: pip install build twine + + - name: Build distribution + run: python -m build + + - name: Publish to Test PyPi + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD_TEST }} + run: twine upload --repository testpypi dist/* + + - name: Publish to PyPi + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} + run: twine upload --repository pypi dist/* + + changelog: + needs: release + runs-on: ubuntu-latest + name: Update Changelog + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Create new branch + run: git checkout -b actions/changelog + + - name: Set branch upstream + run: git push -u origin actions/changelog + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: Install release packages + run: pip install wheel gitchangelog pystache + + - name: Set variables + run: echo "VERSION=$(curl ${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/latest | python -c "import sys; import json; print(json.load(sys.stdin)['tag_name'])")" >> $GITHUB_ENV + + - name: Generate newest changelog + run: gitchangelog ${{env.VERSION}} > CHANGELOG.md + + - name: Make commit for auto-generated changelog + uses: EndBug/add-and-commit@v9 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + add: "CHANGELOG.md" + new_branch: actions/changelog + message: "!gitchangelog" + + - name: Create pull request for the auto generated changelog + run: | + echo "PR_URL=$(gh pr create \ + --title "changelog: release ${{env.VERSION}}" \ + --body "beep boop, i am a robot" \ + --label documentation)" >> $GITHUB_ENV + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From d452b922da9f323f56b0a51b1e1ea4ad8906088d Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 30 Aug 2024 12:42:31 -0400 Subject: [PATCH 2/9] new: changelog file --- CHANGELOG.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..e69de29b From 566c4b2694f8bffad10437102851aaa8bb176fde Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 30 Aug 2024 12:42:39 -0400 Subject: [PATCH 3/9] new: sphinx template --- docs/Makefile | 20 ++++++++++++++++++++ docs/conf.py | 35 +++++++++++++++++++++++++++++++++++ docs/index.rst | 1 + docs/make.bat | 35 +++++++++++++++++++++++++++++++++++ docs/requirements.txt | 1 + pyproject.toml | 2 ++ 6 files changed, 94 insertions(+) create mode 100644 docs/Makefile create mode 100644 docs/conf.py create mode 100644 docs/index.rst create mode 100644 docs/make.bat create mode 100644 docs/requirements.txt diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 00000000..d4bb2cbb --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 00000000..6f05d9a7 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,35 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +import os +import sys + +sys.path.insert(0, os.path.abspath("..")) + +project = 'nx-arangodb' +copyright = '2024, ArangoDB' +author = 'ArangoDB' + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [ + "sphinx_rtd_theme", + "sphinx.ext.autodoc", + "sphinx.ext.viewcode", +] +templates_path = ['_templates'] +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = 'sphinx_rtd_theme' +html_static_path = ['_static'] +autodoc_member_order = "bysource" \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 00000000..5e1c309d --- /dev/null +++ b/docs/index.rst @@ -0,0 +1 @@ +Hello World \ No newline at end of file diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 00000000..32bb2452 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 00000000..52b04f2e --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1 @@ +sphinx_rtd_theme \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 4fde09f5..4617f49c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,6 +54,8 @@ dev = [ "isort", "mypy", "pandas", + "sphinx", + "sphinx_rtd_theme", ] gpu = [ "nx-cugraph-cu12 @ https://pypi.nvidia.com" From 86f19384ce7ee6e63a7be6403a6ae556318f4f2b Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 30 Aug 2024 12:45:26 -0400 Subject: [PATCH 4/9] temp: move to `disabled-workflows` --- .github/{workflows => disabled-workflows}/analyze.yml | 0 .github/{workflows => disabled-workflows}/docs.yaml | 0 .github/{workflows => disabled-workflows}/release.yml | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename .github/{workflows => disabled-workflows}/analyze.yml (100%) rename .github/{workflows => disabled-workflows}/docs.yaml (100%) rename .github/{workflows => disabled-workflows}/release.yml (100%) diff --git a/.github/workflows/analyze.yml b/.github/disabled-workflows/analyze.yml similarity index 100% rename from .github/workflows/analyze.yml rename to .github/disabled-workflows/analyze.yml diff --git a/.github/workflows/docs.yaml b/.github/disabled-workflows/docs.yaml similarity index 100% rename from .github/workflows/docs.yaml rename to .github/disabled-workflows/docs.yaml diff --git a/.github/workflows/release.yml b/.github/disabled-workflows/release.yml similarity index 100% rename from .github/workflows/release.yml rename to .github/disabled-workflows/release.yml From 95a7d5f61ddec369099d054364ad0885ea633488 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 30 Aug 2024 12:46:46 -0400 Subject: [PATCH 5/9] cleanup --- .github/disabled-workflows/analyze.yml | 1 - .github/disabled-workflows/docs.yaml | 5 +---- .github/disabled-workflows/release.yml | 2 -- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/disabled-workflows/analyze.yml b/.github/disabled-workflows/analyze.yml index 5f0b6d9a..fa0e1def 100644 --- a/.github/disabled-workflows/analyze.yml +++ b/.github/disabled-workflows/analyze.yml @@ -20,7 +20,6 @@ on: - cron: "00 9 1,15 * *" jobs: analyze: - name: Analyze runs-on: ubuntu-latest permissions: actions: read diff --git a/.github/disabled-workflows/docs.yaml b/.github/disabled-workflows/docs.yaml index 70feec2c..0b19163f 100644 --- a/.github/disabled-workflows/docs.yaml +++ b/.github/disabled-workflows/docs.yaml @@ -1,4 +1,4 @@ -name: Docs +name: docs on: pull_request: @@ -7,9 +7,6 @@ on: jobs: docs: runs-on: ubuntu-latest - - name: Docs - steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/.github/disabled-workflows/release.yml b/.github/disabled-workflows/release.yml index ae1eb1e3..96a96a39 100644 --- a/.github/disabled-workflows/release.yml +++ b/.github/disabled-workflows/release.yml @@ -6,7 +6,6 @@ on: jobs: release: runs-on: ubuntu-latest - name: Release package steps: - uses: actions/checkout@v4 @@ -39,7 +38,6 @@ jobs: changelog: needs: release runs-on: ubuntu-latest - name: Update Changelog steps: - uses: actions/checkout@v4 with: From 73750dc1d94c6bc9f9e3b80f7a2be2ae9fcaf0c3 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 30 Aug 2024 13:10:24 -0400 Subject: [PATCH 6/9] cleanup --- _nx_arangodb/VERSION | 2 +- nx_arangodb/typing.py | 2 -- pyproject.toml | 2 -- run_nx_tests.sh | 12 ------------ 4 files changed, 1 insertion(+), 17 deletions(-) diff --git a/_nx_arangodb/VERSION b/_nx_arangodb/VERSION index 6c6aa7cb..afaf360d 100644 --- a/_nx_arangodb/VERSION +++ b/_nx_arangodb/VERSION @@ -1 +1 @@ -0.1.0 \ No newline at end of file +1.0.0 \ No newline at end of file diff --git a/nx_arangodb/typing.py b/nx_arangodb/typing.py index e3464973..cfdfa37b 100644 --- a/nx_arangodb/typing.py +++ b/nx_arangodb/typing.py @@ -1,5 +1,3 @@ -# Copied from nx-cugraph - from __future__ import annotations from collections.abc import Hashable diff --git a/pyproject.toml b/pyproject.toml index 4617f49c..6f930e30 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,3 @@ -# Copied from nx-cugraph - [build-system] requires = [ diff --git a/run_nx_tests.sh b/run_nx_tests.sh index 0949f09c..977e991b 100755 --- a/run_nx_tests.sh +++ b/run_nx_tests.sh @@ -1,22 +1,10 @@ -# Copied from nx-cugraph set -e -# TODO: address the following tests -# --pyargs networkx.algorithms.community.louvain \ - -DATABASE_HOST=http://localhost:8529 -DATABASE_USERNAME=root -DATABASE_PASSWOR=test -DATABASE_NAME=_system - NETWORKX_GRAPH_CONVERT=arangodb \ NETWORKX_TEST_BACKEND=arangodb \ NETWORKX_FALLBACK_TO_NX=True \ pytest \ --pyargs networkx.classes \ - --pyargs networkx.algorithms.centrality \ - --pyargs networkx.algorithms.link_analysis \ - --pyargs networkx.algorithms.shortest_paths \ --cov-config=$(dirname $0)/pyproject.toml \ --cov=nx_arangodb \ --cov-report= \ From ffa8811ad3bb3239c1ebbaffb63c403e3656d7fb Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 30 Aug 2024 13:17:48 -0400 Subject: [PATCH 7/9] more cleanup --- Makefile | 25 ------------------------- _nx_arangodb/__init__.py | 18 +----------------- 2 files changed, 1 insertion(+), 42 deletions(-) delete mode 100644 Makefile diff --git a/Makefile b/Makefile deleted file mode 100644 index 3a307d3b..00000000 --- a/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -# Copied from nx-cugraph - -SHELL= /bin/bash - -.PHONY: all -all: plugin-info lint readme - -.PHONY: lint -lint: - git ls-files | xargs pre-commit run --config lint.yaml --files || true - -.PHONY: lint-update -lint-update: - pre-commit autoupdate --config lint.yaml - -.PHONY: plugin-info -plugin-info: - python _nx_arangodb/__init__.py - -objects.inv: - wget https://networkx.org/documentation/stable/objects.inv - -.PHONY: readme -readme: objects.inv - python scripts/update_readme.py README.md objects.inv diff --git a/_nx_arangodb/__init__.py b/_nx_arangodb/__init__.py index e79e600c..0498f571 100644 --- a/_nx_arangodb/__init__.py +++ b/_nx_arangodb/__init__.py @@ -25,7 +25,7 @@ "backend_name": "arangodb", "project": "nx-arangodb", "package": "nx_arangodb", - "url": f"https://github.com/aMahanna/nx-arangodb", + "url": "https://github.com/arangodb/nx-arangodb", "short_summary": "Remote storage backend.", # "description": "TODO", "functions": { @@ -91,22 +91,6 @@ def get_info(): if __name__ == "__main__": from pathlib import Path - # This script imports nx_arangodb modules, which imports nx_arangodb runtime - # dependencies. The modules do not need the runtime deps, so stub them out - # to avoid installing them. - class Stub: - def __getattr__(self, *args, **kwargs): - return Stub() - - def __call__(self, *args, **kwargs): - return Stub() - - import sys - - sys.modules["cupy"] = Stub() - sys.modules["numpy"] = Stub() - sys.modules["python-arango"] = Stub() - from _nx_arangodb.core import main filepath = Path(__file__) From 7baa115ff0966a9663a54fe97b8351a88d255feb Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 30 Aug 2024 13:57:26 -0400 Subject: [PATCH 8/9] 0.1? --- _nx_arangodb/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_nx_arangodb/VERSION b/_nx_arangodb/VERSION index afaf360d..6c6aa7cb 100644 --- a/_nx_arangodb/VERSION +++ b/_nx_arangodb/VERSION @@ -1 +1 @@ -1.0.0 \ No newline at end of file +0.1.0 \ No newline at end of file From 472c4ee099871929708c725eb6704e4955d03c2a Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 30 Aug 2024 14:02:53 -0400 Subject: [PATCH 9/9] 1.0 --- _nx_arangodb/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_nx_arangodb/VERSION b/_nx_arangodb/VERSION index 6c6aa7cb..afaf360d 100644 --- a/_nx_arangodb/VERSION +++ b/_nx_arangodb/VERSION @@ -1 +1 @@ -0.1.0 \ No newline at end of file +1.0.0 \ No newline at end of file