-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix bootstrap * Update pyright config script * Fix entity counter bug on corpus * Bump tp 3.8.26 * Use session instead of op * Revert "Use session instead of op" This reverts commit 4a9c49f. * Revert "Fix entity counter bug on corpus" This reverts commit 7e380ab.
- Loading branch information
1 parent
654ce6a
commit 500b4f8
Showing
5 changed files
with
70 additions
and
40 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#! /usr/bin/env bash | ||
set -e | ||
|
||
# Get the name of the expected venv for this repo from the pyproject.toml file. | ||
venv_name=$(grep -m 1 venv pyproject.toml | tr -s ' ' | tr -d '"' | tr -d "'" | cut -d' ' -f3) || true | ||
|
||
# Check if pyrightconfig already exists. | ||
if [[ ! -f pyrightconfig.json ]]; then | ||
|
||
# Capture poetry environment path and check if it's empty. | ||
poetry_env_info=$(poetry env info --path 2>/dev/null || true) | ||
if [[ -z ${poetry_env_info} ]]; then | ||
# Check if pyenv is installed | ||
if ! command -v pyenv &>/dev/null; then | ||
echo "pyenv not installed. Please install pyenv..." | ||
exit 1 | ||
fi | ||
|
||
pyenv_root=$(pyenv root) | ||
dir_path="${pyenv_root}"/plugins/pyenv-pyright | ||
if [[ ! -d ${dir_path} ]]; then | ||
# trunk-ignore(shellcheck/SC2312) | ||
if [[ -z $(ls -A "${dir_path}") ]]; then | ||
git clone https://github.com/alefpereira/pyenv-pyright.git "${dir_path}" | ||
fi | ||
fi | ||
|
||
# Generate the pyrightconfig.json file. | ||
pyenv pyright "${venv_name}" | ||
pyenv local "${venv_name}" | ||
else | ||
poetry_env_info=$(poetry env info --path 2>/dev/null || true) | ||
venv_path=$(dirname "${poetry_env_info}") # Get directory path | ||
venv_name=$(basename "${poetry_env_info}") # Get base name | ||
|
||
# Generate the pyrightconfig.json file. | ||
json_string=$(jq -n \ | ||
--arg v "${venv_name}" \ | ||
--arg vp "${venv_path}" \ | ||
'{venv: $v, venvPath: $vp} ') | ||
|
||
echo "${json_string}" >pyrightconfig.json | ||
fi | ||
fi | ||
|
||
# Check whether required keys are present in pyrightconfig.json. | ||
if ! jq -r --arg venv_name "${venv_name}" '. | select((.venv != $venv_name or .venv == "") and (.venvPath == null or .venvPath == ""))' pyrightconfig.json >/dev/null 2>&1; then | ||
echo "Failed to configure pyright to use environment '${venv_name}' as interpreter. Please check pyrightconfig.json..." | ||
exit 1 | ||
fi | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "db-client" | ||
version = "3.8.25" | ||
version = "3.8.26" | ||
description = "All things to do with the datamodel and its storage. Including alembic migrations and datamodel code." | ||
authors = ["CPR-dev-team <[email protected]>"] | ||
license = "Apache-2.0" | ||
|