diff --git a/.cargo/config.toml b/.cargo/config.toml deleted file mode 100644 index 656e08b..0000000 --- a/.cargo/config.toml +++ /dev/null @@ -1,2 +0,0 @@ -[net] -git-fetch-with-cli = true \ No newline at end of file diff --git a/.circleci/config.yml b/.circleci/config.yml index b2271a5..f056ff3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,28 +21,6 @@ workflows: parameters: db-mode: ["single", "cluster"] db-version: ["3.10", "3.11", "3.12"] - release_package: - jobs: - - publish: - context: agml-pypi - filters: - tags: - only: - - /^v.*/ - branches: - ignore: /.*/ - -commands: - setup_ssh: - steps: - - add_ssh_keys: - fingerprints: - - "SHA256:XsmQvjXDygXfd3z0ynvv6lcOEHjO4iJBGHFtZkk753Q" - - run: - name: Add GitHub to known_hosts - command: | - mkdir -p ~/.ssh - ssh-keyscan github.com >> ~/.ssh/known_hosts jobs: lint-python: @@ -50,7 +28,6 @@ jobs: - image: cimg/python:3.10 steps: - checkout - - setup_ssh - restore_cache: key: py_lint_cache - run: | @@ -77,7 +54,6 @@ jobs: - image: cimg/rust:1.75 steps: - checkout - - setup_ssh - run: name: Install clippy command: rustup component add clippy @@ -94,7 +70,6 @@ jobs: executor: generate-executor steps: - checkout - - setup_ssh - run: name: Build builder image command: docker build -t phenolrs-builder:latest -f Dockerfile-build . @@ -111,7 +86,6 @@ jobs: - image: cimg/rust:1.75 steps: - checkout - - setup_ssh - run: name: Setup lib command: | @@ -131,7 +105,6 @@ jobs: executor: generate-executor steps: - checkout - - setup_ssh - attach_workspace: at: ~/project/target - run: @@ -172,23 +145,3 @@ jobs: conda activate phenolrs export RUST_BACKTRACE=1 pytest --url http://172.28.0.1:8529 python/tests - publish: - executor: generate-executor - steps: - - checkout - - setup_ssh - - run: - name: Build builder image - command: docker build -t phenolrs-builder:latest -f Dockerfile-build . - - run: - name: Build package - command: docker run --rm -v $(pwd):/io phenolrs-builder:latest build --release --interpreter python3.10 python3.11 python3.12 --sdist - - run: - name: Install release packages - command: pip install twine - - run: - name: Setup SA - command: ./setup_sa.sh "${PYTHON_REPO_ID}" "${PYTHON_REPO_URL}" "${PYPI_ACCOUNT_USER}" "${PYPI_ACCOUNT_KEY}" "${PYTHON_INDEX_URL}" - - run: - name: Publish Package - command: twine upload --verbose --repository "${PYTHON_REPO_ID}" target/wheels/* \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8728120 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,117 @@ +name: Release Phenolrs + +on: + workflow_dispatch: + release: + types: [published] + +jobs: + release-linux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y libssl-dev + pip install build maturin twine + + - name: Build builder image + run: docker build -t phenolrs-builder:latest -f Dockerfile-build . + + - name: Build the package + run: docker run --rm -v $(pwd):/io phenolrs-builder:latest build --out dist --release --sdist --interpreter python3.10 python3.11 python3.12 + + - name: ls + run: ls dist/* + + - name: Publish to Test PyPi + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD_TEST }} + run: twine upload --verbose --repository testpypi dist/*.whl + + - name: Publish to PyPi + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} + run: twine upload --verbose --repository pypi dist/*.whl + + release-windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: Install dependencies + run: pip install build maturin twine + + - name: Build the package + run: maturin build --out dist --release --sdist --interpreter python3.10 python3.11 python3.12 + + - name: ls + run: ls dist/* + + - name: Publish to Test PyPi + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD_TEST }} + run: twine upload --verbose --repository testpypi dist\*.whl + + - name: Publish to PyPi + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} + run: twine upload --verbose --repository pypi dist\*.whl + + release-macos: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, macos-13] + + steps: + - uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: Install dependencies + run: | + brew install openssl + pip install build maturin twine + + - name: Build the package + run: | + if [[ "${{ matrix.os }}" == "macos-13" ]]; then + maturin build --out dist --release --sdist --target x86_64-apple-darwin --interpreter python3.10 python3.11 python3.12 + elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then + maturin build --out dist --release --sdist --target aarch64-apple-darwin --interpreter python3.10 python3.11 python3.12 + fi + + - name: ls + run: ls dist/* + + - name: Publish to Test PyPi + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD_TEST }} + run: twine upload --verbose --repository testpypi dist/*.whl + + - name: Publish to PyPi + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} + run: twine upload --verbose --repository pypi dist/*.whl diff --git a/Cargo.lock b/Cargo.lock index 497a8aa..71def35 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -823,7 +823,7 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "phenolrs" -version = "0.4.2" +version = "0.5.4" dependencies = [ "anyhow", "arangors-graph-exporter", diff --git a/Cargo.toml b/Cargo.toml index 0389495..7c04e6e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "phenolrs" -version = "0.4.2" +version = "0.5.4" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index a12ceda..0000000 --- a/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM python:3.10 - -RUN pip install -f https://data.pyg.org/whl/torch-2.1.0+cpu.html \ - torch-scatter==2.1.2 \ - torch-sparse==0.6.18 \ - torch-geometric==2.4.0 \ - pyg_lib==0.3.1 -RUN pip install --extra-index-url https://download.pytorch.org/whl/cpu torch==2.1.0+cpu - -ADD ./target/wheels/ ./target/wheels -RUN pip install phenolrs --find-links ./target/wheels - -ADD benchmarks/local.py ./local.py - -CMD ["python", "local.py", "--host", "http://host.docker.internal:8529", "test"] diff --git a/benchmarks/adb_cloud.py b/benchmarks/adb_cloud.py deleted file mode 100644 index 816af41..0000000 --- a/benchmarks/adb_cloud.py +++ /dev/null @@ -1,38 +0,0 @@ -import argparse -import time - -from phenolrs.pyg import PygLoader - - -def load_abide(host: str, password: str, cert_path: str) -> None: - data = PygLoader.load_into_pyg_heterodata( - "abide", - [{"name": "Subjects", "fields": ["label", "brain_fmri_features"]}], - [{"name": "medical_affinity_graph"}], - [host], - username="root", - password=password, - tls_cert=cert_path, - parallelism=10, - batch_size=400000, - ) - assert data["Subjects"]["brain_fmri_features"].shape == (871, 2000) - - -def main() -> None: - parser = argparse.ArgumentParser() - parser.add_argument("host", type=str) - parser.add_argument("password", type=str) - parser.add_argument("certpath", type=str) - parser.add_argument("--trials", type=int, default=4) - args = parser.parse_args() - - for _ in range(args.trials): - start = time.perf_counter() - load_abide(args.host, args.password, args.certpath) - end = time.perf_counter() - print(f"Total execution time: {end - start} seconds") - - -if __name__ == "__main__": - main() diff --git a/benchmarks/local.py b/benchmarks/local.py deleted file mode 100644 index aa448bc..0000000 --- a/benchmarks/local.py +++ /dev/null @@ -1,36 +0,0 @@ -import argparse -import time - -from phenolrs.pyg import PygLoader - - -def load_abide(host: str, password: str) -> None: - data = PygLoader.load_into_pyg_heterodata( - "abide", - [{"name": "Subjects", "fields": ["label", "brain_fmri_features"]}], - [{"name": "medical_affinity_graph"}], - [host], - username="root", - password=password, - parallelism=10, - batch_size=400000, - ) - assert data["Subjects"]["brain_fmri_features"].shape == (871, 2000) - - -def main() -> None: - parser = argparse.ArgumentParser() - parser.add_argument("password", type=str) - parser.add_argument("--host", type=str, default="http://localhost:8529") - parser.add_argument("--trials", type=int, default=4) - args = parser.parse_args() - - for _ in range(args.trials): - start = time.perf_counter() - load_abide(args.host, args.password) - end = time.perf_counter() - print(f"Total execution time: {end - start} seconds") - - -if __name__ == "__main__": - main() diff --git a/pyproject.toml b/pyproject.toml index 28c5895..41b312e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,11 +4,16 @@ build-backend = "maturin" [project] name = "phenolrs" -requires-python = ">=3.8" +version = "0.5.4" +requires-python = ">=3.10" classifiers = [ "Programming Language :: Rust", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Typing :: Typed", ] dependencies = [ "numpy~=1.26", diff --git a/setup_sa.sh b/setup_sa.sh deleted file mode 100755 index af97e92..0000000 --- a/setup_sa.sh +++ /dev/null @@ -1,23 +0,0 @@ -#/bin/bash -pypirc=$(cat << EOF -[distutils] -index-servers = $1 - -[$1] -repository = $2 -username: $3 -password: $4 -EOF -) - -pipconf=$(cat << EOF -[global] -index-url = https://pypi.org/simple -extra-index-url = https://$3:$4@$5 -EOF -) - -echo "$pypirc" > ~/.pypirc - -mkdir -p ~/.config/pip/ -echo "$pipconf" > ~/.config/pip/pip.conf