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

feat: Add configurable conda-forge URL #415

Merged
merged 4 commits into from
Sep 20, 2024
Merged

feat: Add configurable conda-forge URL #415

merged 4 commits into from
Sep 20, 2024

Conversation

yangbobo2021
Copy link
Contributor

This PR adds a configurable conda-forge URL to replace the hardcoded CONDA_FORGE_TUNA URL. It implements a new _get_conda_forge_url method to read the URL from the configuration, removes the unused CONDA_FORGE constant, and cleans up related comments.

Changes:

  • Implement _get_conda_forge_url method to read URL from config
  • Replace hardcoded CONDA_FORGE_TUNA with configurable URL
  • Remove unused CONDA_FORGE constant and comments

This change allows for more flexibility in specifying the conda-forge URL, which can be useful for different environments or configurations.

- Implement _get_conda_forge_url method to read URL from config
- Replace hardcoded CONDA_FORGE_TUNA with configurable URL
- Remove unused CONDA_FORGE constant and comments
Comment on lines 272 to 273
config_file = os.path.expanduser("~/.chat/config.yml")
default_url = "https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/"
Copy link
Contributor

@kagami-l kagami-l Sep 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

文件路径用 path.py 里的这个常量,方便统一处理
https://github.com/devchat-ai/devchat/blob/main/devchat/workflow/path.py#L8

default_url 也保留常量形式吧

return config.get("conda-forge-url", default_url)
except Exception as e:
# Log the exception if needed
print(f"An error occurred: {e}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的print都会打到聊天栏里,确定要打error信息?

这里出错不会直接导致操作失败,用logger输出到日志文件就行,等后面安装失败,会提示查看日志文件

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

按道理来说,不应该有异常发生,这里一旦发生异常,可能会是很重要的信息发生了错误。显示到聊天栏中,不影响继续执行情况下,可以让用户更加关注下。

- Add DEFAULT_CONDA_FORGE_URL constant
- Update get_conda_forge_url method to use CHAT_DIR
- Improve error handling and default URL usage
@kagami-l kagami-l merged commit 68fe040 into main Sep 20, 2024
2 checks passed
@kagami-l kagami-l deleted the config_conda_forge branch September 20, 2024 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants