Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

H-1469: Move Python libraries from hashintel/hash into labs #3647

Merged
Merged
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
10 changes: 0 additions & 10 deletions .github/actions/warm-up-repo/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@ runs:
node-version: 18 ## aligned with Node version on Vercel
# cache: yarn ## Currently disabled because of frequent timeouts

- name: Install poetry
run: pipx install poetry
shell: bash

- name: Set up Python 3.11
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: "^3.11"
cache: poetry

- name: yarn install
uses: nick-fields/retry@14672906e672a08bd6eeb15720e9ed3ce869cdd4 # v2.9.0
with:
Expand Down
11 changes: 0 additions & 11 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@
"commitMessageTopic": "npm package `{{depName}}`",
"additionalBranchPrefix": "js/"
},
{
"matchManagers": ["poetry"],
"commitMessageTopic": "Python package `{{depName}}`",
"additionalBranchPrefix": "py/",
"reviewers": ["team:Python"]
},
{
"matchManagers": ["cargo"],
"commitMessageTopic": "Rust crate `{{depName}}`",
Expand Down Expand Up @@ -146,11 +140,6 @@
"matchManagers": ["npm"],
"matchPackagePatterns": ["^@signia/"]
},
{
"groupName": "Pydantic Python packages",
"matchManagers": ["poetry"],
"matchPackagePatterns": ["^pydantic"]
},
{
"matchManagers": ["regex"],
"matchDepNames": ["rust"],
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: ["javascript", "python"]
language: ["javascript"]
# 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
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/dispatch-fix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ jobs:
- name: Warm up repo
uses: ./.github/actions/warm-up-repo

- name: Setup python
run: yarn poetry:install

- name: Fix
run: yarn fix

Expand Down
60 changes: 0 additions & 60 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,30 +75,6 @@ jobs:
| jq '[.tasks[] | select(.task == "codegen" and .command != "<NONEXISTENT>")] != []' || echo 'false')
echo "codegen=$CODEGEN" >> $GITHUB_OUTPUT

HAS_PYTHON=$(test -f "${{ matrix.directory }}/pyproject.toml" && echo 'true' || echo 'false')
echo "has-python=$HAS_PYTHON" >> $GITHUB_OUTPUT
if [[ $HAS_PYTHON = 'true' ]]; then
echo "python-version=$(cat "${{ matrix.directory }}/pyproject.toml" | yq -p toml '.tool.poetry.dependencies.python')" >> $GITHUB_OUTPUT
else
echo "python-version=^3.11" >> $GITHUB_OUTPUT
fi

HAS_POETRY_DEPS=$(turbo run poetry:install --filter '${{ matrix.package }}...' --dry-run=json \
| jq '[.tasks[] | select(.task == "poetry:install" and .command != "<NONEXISTENT>")] != []' || echo 'false')
echo "has-poetry-deps=$HAS_POETRY_DEPS" >> $GITHUB_OUTPUT

BLACK=$(turbo run lint:black --filter '${{ matrix.package }}' --dry-run=json \
| jq '[.tasks[] | select(.task == "lint:black" and .command != "<NONEXISTENT>")] != []' || echo 'false')
echo "black=$BLACK" >> $GITHUB_OUTPUT

RUFF=$(turbo run lint:ruff --filter '${{ matrix.package }}' --dry-run=json \
| jq '[.tasks[] | select(.task == "lint:ruff" and .command != "<NONEXISTENT>")] != []' || echo 'false')
echo "ruff=$RUFF" >> $GITHUB_OUTPUT

MYPY=$(turbo run lint:mypy --filter '${{ matrix.package }}' --dry-run=json \
| jq '[.tasks[] | select(.task == "lint:mypy" and .command != "<NONEXISTENT>")] != []' || echo 'false')
echo "mypy=$MYPY" >> $GITHUB_OUTPUT

HAS_RUST=$(test -f "${{ matrix.directory }}/rust-toolchain.toml" && echo 'true' || echo 'false')
echo "has-rust=$HAS_RUST" >> $GITHUB_OUTPUT
if [[ $HAS_RUST = 'true' ]]; then
Expand Down Expand Up @@ -142,22 +118,6 @@ jobs:
workspaces: ${{ matrix.directory }}
save-if: ${{ !startsWith(github.ref, 'refs/heads/gh-readonly-queue') }}

- name: Install poetry
if: always() && steps.lints.outputs.has-poetry-deps == 'true'
run: pipx install poetry

- name: Set up Python
if: always() && steps.lints.outputs.has-poetry-deps == 'true'
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: ${{ steps.lints.outputs.python-version }}
cache: poetry

- name: Install Python dependencies
if: always() && steps.lints.outputs.has-poetry-deps == 'true'
continue-on-error: true
run: turbo run poetry:install

- name: Show disk usage
run: df -h

Expand Down Expand Up @@ -240,26 +200,6 @@ jobs:
RUSTDOCFLAGS: "--check -Z unstable-options -D warnings"
run: just doc --document-private-items

- name: Check poetry
if: always() && steps.lints.outputs.has-python == 'true'
working-directory: ${{ matrix.directory }}
run: poetry check

- name: Run black
if: always() && steps.lints.outputs.black == 'true'
continue-on-error: true
run: turbo run lint:black --filter "${{ matrix.package }}"

- name: Run ruff
if: always() && steps.lints.outputs.ruff == 'true'
continue-on-error: true
run: turbo run lint:ruff --filter "${{ matrix.package }}"

- name: Run MyPy
if: always() && steps.lints.outputs.mypy == 'true'
continue-on-error: true
run: turbo run lint:mypy --filter "${{ matrix.package }}"

- name: Show disk usage
run: df -h

Expand Down
70 changes: 0 additions & 70 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,25 +137,6 @@ jobs:
echo "has-miri=$(yq '.toolchain.components | contains(["miri"])' ${{ matrix.directory }}/rust-toolchain.toml)" >> $GITHUB_OUTPUT
fi

HAS_PYTHON=$(test -f "${{ matrix.directory }}/pyproject.toml" && echo 'true' || echo 'false')
echo "has-python=$HAS_PYTHON" >> $GITHUB_OUTPUT
if [[ $HAS_PYTHON = 'true' ]]; then
echo "python-version=$(cat "${{ matrix.directory }}/pyproject.toml" | yq -p toml '.tool.poetry.dependencies.python')" >> $GITHUB_OUTPUT
else
echo "python-version=^3.11" >> $GITHUB_OUTPUT
fi

HAS_POETRY_DEPS=$(turbo run poetry:install --filter '${{ matrix.package }}...' --dry-run=json \
| jq '[.tasks[] | select(.task == "poetry:install" and .command != "<NONEXISTENT>")] != []' || echo 'false')
echo "has-poetry-deps=$HAS_POETRY_DEPS" >> $GITHUB_OUTPUT

# If this is a python package we allow CI to fail
if [[ $HAS_PYTHON = 'true' ]]; then
echo "allow-failure=true" >> $GITHUB_OUTPUT
else
echo "allow-failure=false" >> $GITHUB_OUTPUT
fi

- name: Prune repository
uses: ./.github/actions/prune-repository
with:
Expand Down Expand Up @@ -191,22 +172,6 @@ jobs:
workspaces: ${{ matrix.directory }}
save-if: ${{ !startsWith(github.ref, 'refs/heads/gh-readonly-queue') }}

- name: Install poetry
if: always() && steps.tests.outputs.has-poetry-deps == 'true'
run: pipx install poetry

- name: Set up Python
if: always() && steps.tests.outputs.has-poetry-deps == 'true'
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: ${{ steps.tests.outputs.python-version }}
cache: poetry

- name: Install Python dependencies
if: always() && steps.tests.outputs.has-poetry-deps == 'true'
continue-on-error: true
run: turbo run poetry:install

- name: Show disk usage
run: df -h

Expand Down Expand Up @@ -294,18 +259,6 @@ jobs:
REQUIRES_AI_WORKER_TS=$(echo "$TEST_TASKS" | jq -s '[.[] | select(.package == "@apps/hash-ai-worker-ts" and .task == "build")] != []')
REQUIRES_INTEGRATION_WORKER=$(echo "$TEST_TASKS" | jq -s '[.[] | select(.package == "@apps/hash-worker-integration" and .task == "build")] != []')

HAS_PYTHON=$(test -f "${{ matrix.directory }}/pyproject.toml" && echo 'true' || echo 'false')
echo "has-python=$HAS_PYTHON" >> $GITHUB_OUTPUT
if [[ $HAS_PYTHON = 'true' ]]; then
echo "python-version=$(cat "${{ matrix.directory }}/pyproject.toml" | yq -p toml '.tool.poetry.dependencies.python')" >> $GITHUB_OUTPUT
else
echo "python-version=^3.11" >> $GITHUB_OUTPUT
fi

HAS_POETRY_DEPS=$(turbo run poetry:install --filter '${{ matrix.package }}...' --dry-run=json \
| jq '[.tasks[] | select(.task == "poetry:install" and .command != "<NONEXISTENT>")] != []' || echo 'false')
echo "has-poetry-deps=$HAS_POETRY_DEPS" >> $GITHUB_OUTPUT

echo "has-rust=$HAS_RUST" >> $GITHUB_OUTPUT
if [[ $HAS_RUST = 'true' ]]; then
echo "rust-toolchain=$(yq '.toolchain.channel' ${{ matrix.directory }}/rust-toolchain.toml)" >> $GITHUB_OUTPUT
Expand All @@ -316,13 +269,6 @@ jobs:
echo "external-service-ai-worker-ts=$REQUIRES_AI_WORKER_TS" >> $GITHUB_OUTPUT
echo "external-service-worker-integration=$REQUIRES_INTEGRATION_WORKER" >> $GITHUB_OUTPUT

# If this is a python package we allow CI to fail
if [[ $HAS_PYTHON = 'true' ]]; then
echo "allow-failure=true" >> $GITHUB_OUTPUT
else
echo "allow-failure=false" >> $GITHUB_OUTPUT
fi

- name: Install Rust toolchain
if: always() && steps.tests.outputs.has-rust == 'true'
uses: ./.github/actions/install-rust-toolchain
Expand All @@ -343,22 +289,6 @@ jobs:
workspaces: ${{ matrix.directory }}
save-if: ${{ !startsWith(github.ref, 'refs/heads/gh-readonly-queue') }}

- name: Install poetry
if: always() && steps.tests.outputs.has-poetry-deps == 'true'
run: pipx install poetry

- name: Set up Python
if: always() && steps.tests.outputs.has-poetry-deps == 'true'
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: ${{ steps.tests.outputs.python-version }}
cache: poetry

- name: Install Python dependencies
if: always() && steps.tests.outputs.has-poetry-deps == 'true'
continue-on-error: true
run: turbo run poetry:install

- name: Show disk usage
run: df -h

Expand Down
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
# Skip autogenerated files
/apps/hash-graph/openapi/**
/libs/@local/hash-graph-client/typescript/*.ts
/libs/@local/hash-graph-client/python/scripts/openapi.bundle.json

########################
## Same as in .gitignore
Expand Down
1 change: 0 additions & 1 deletion apps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ The application depends on a suite of constituent services, which are briefly de

| Subdirectory | Description |
| -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| |
| [`hash-ai-worker-ts`](hash-ai-worker-ts) | A TypeScript-based [Temporal](temporal.io) worker, tasked with executing AI-powered workflows |
| [`hash-api`](hash-api) | The main entrypoint for the Node.js server that serves the core of the backend API of HASH. |
| [`hash-external-services`](hash-external-services) | Defines the running configurations of external (not internally-developed) services that HASH depends on, such as Postgres, Ory Kratos, and Temporal. _(pending refactoring)_ |
Expand Down
17 changes: 0 additions & 17 deletions apps/hash-frontend/vercel-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,6 @@ yum install -y wget tar gzip
echo "Installing eget"
curl https://zyedidia.github.io/eget.sh | sh

# Install Python and Poetry

### Python is not needed, currently, but this can be used to install it if needed again
#echo "Installing python"
#mkdir tmp
#cd tmp
#
#../eget indygreg/python-build-standalone -t 20230116 -a 3.11 -a x86_64-unknown-linux-gnu-install_only --download-only
#tar -axf cpython-* -C /usr/local
#
#cd ..
#rm -r tmp
#
#echo "Installing pipx and poetry"
#python3.11 -m pip install pipx
#python3.11 -m pipx install poetry

# Setup TurboRepo and get a pruned src folder and lockfile

echo "Installing turbo"
Expand Down
3 changes: 0 additions & 3 deletions apps/hash-graph/.justfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ run *arguments:
# Generates the OpenAPI specifications and the clients
generate-openapi-specs:
just run server --write-openapi-specs
just yarn codegen --filter @local/hash-graph-client-py
just yarn workspace @local/hash-graph-sdk-py codegen:filter
just yarn workspace @local/hash-graph-sdk-py codegen:blocking

[private]
test *arguments:
Expand Down
12 changes: 1 addition & 11 deletions apps/hash/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ See the [respective section in the parent README](../README.md#hash) for descrip

To run HASH locally, please follow these steps:

1. Make sure you have, [Git](https://git-scm.com), [Node LTS](https://nodejs.org), [Yarn Classic](https://classic.yarnpkg.com), [Docker](https://docs.docker.com/get-docker/), [Python](https://www.python.org/downloads/), [Poetry](https://python-poetry.org/docs/) and [Java](https://www.java.com/download/ie_manual.jsp). Building the Docker containers requires [Docker Buildx](https://docs.docker.com/build/install-buildx/).
1. Make sure you have, [Git](https://git-scm.com), [Node LTS](https://nodejs.org), [Yarn Classic](https://classic.yarnpkg.com), [Docker](https://docs.docker.com/get-docker/), and [Java](https://www.java.com/download/ie_manual.jsp). Building the Docker containers requires [Docker Buildx](https://docs.docker.com/build/install-buildx/).
Run each of these version commands and make sure the output is expected:

```sh
Expand All @@ -71,12 +71,6 @@ To run HASH locally, please follow these steps:

java --version
## β‰₯ 8

python --version
## β‰₯ 3.11

poetry --version
## β‰₯ 1.4.2
```

If you have difficulties with `git --version` on macOS you may need to install Xcode Command Line Tools first: `xcode-select --install`.
Expand Down Expand Up @@ -289,10 +283,6 @@ We use [Yarn Workspaces](https://classic.yarnpkg.com/en/docs/workspaces) to work

## Troubleshooting

### Command not found: ruff

Run `yarn poetry:install` before running `yarn lint` or `yarn fix` for the first time.

### eslint `parserOptions.project`

There is a mismatch between VSCode's eslint plugin and the eslint cli tool. Specifically the option
Expand Down
10 changes: 5 additions & 5 deletions infra/terraform/hash/hash_application/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ resource "aws_lb_target_group" "app_tg" {
unhealthy_threshold = 3
}
slow_start = 30
# Time between demoting state from 'draining' to 'unused'.
# Time between demoting state from 'draining' to 'unused'.
# The default, 300s, makes it so we have multiple services running for 5 whole minutes.
deregistration_delay = 30
# @todo: can we enable preserve_client_ip? (may not be supported by Fargate)
Expand Down Expand Up @@ -189,7 +189,7 @@ resource "aws_lb_target_group" "kratos_tg" {
unhealthy_threshold = 3
}
slow_start = 30
# Time between demoting state from 'draining' to 'unused'.
# Time between demoting state from 'draining' to 'unused'.
# The default, 300s, makes it so we have multiple services running for 5 whole minutes.
deregistration_delay = 30
# @todo: can we enable preserve_client_ip? (may not be supported by Fargate)
Expand All @@ -211,17 +211,17 @@ resource "aws_lb_listener" "kratos_http" {
}
}

#
#
data "aws_acm_certificate" "hash_wildcard_cert" {
domain = "*.hash.ai"
statuses = ["ISSUED"]
}


# The load balancer will allow HTTPS connections that come through
# this is only when the SSL Certificate ARN is defined when applying the
# this is only when the SSL Certificate ARN is defined when applying the
# Terraform scripts. The target group is the same for HTTPS
#
#
# The load balancer will terminate SSL.
resource "aws_lb_listener" "app_https" {
depends_on = [aws_lb_target_group.app_tg]
Expand Down
1 change: 0 additions & 1 deletion libs/@local/hash-graph-client/python/.gitattributes

This file was deleted.

1 change: 0 additions & 1 deletion libs/@local/hash-graph-client/python/.gitignore

This file was deleted.

Loading
Loading