-
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.
Remove taxonomies from config (#136)
* Only show families belonging to user org unless super * Remove debug * Placate pyright * Bump to 2.6.1 * Replace print with logging * Show all corpora if superuser * Use non-superuser user for tests * Remove old taxonomy tests and check all corpora returned for superuser * Bump to 2.6.2 * Take common query out of conditional * Remove taxonomies * Add venv support for configuring pyright
- Loading branch information
1 parent
ad1a161
commit 9b4b13e
Showing
21 changed files
with
131 additions
and
143 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,52 @@ | ||
#! /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 | ||
|
||
if [[ -z ${venv_name} ]]; then | ||
echo "Using Poetry" | ||
poetry_env_info=$(poetry env info --path) >/dev/null 2>&1 | ||
venv_path=${poetry_env_info%/*} # ABCDE | ||
venv_name=${poetry_env_info#*/} # 12345 | ||
|
||
# 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 | ||
else | ||
echo "Using Pyenv" | ||
# Check if pyenv-pyright plugin 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 [[ -n $(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}" | ||
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 | ||
echo "All done!" | ||
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
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 = "admin_backend" | ||
version = "2.6.1" | ||
version = "2.6.2" | ||
description = "" | ||
authors = ["CPR-dev-team <[email protected]>"] | ||
packages = [{ include = "app" }, { include = "tests" }] | ||
|
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
Oops, something went wrong.