【问题标题】:Converting poetry script to conda yaml for Intel Lava-nc?将诗歌脚本转换为 Intel Lava-nc 的 conda yaml?
【发布时间】:2022-07-16 14:46:47
【问题描述】:

上下文

the Linux/MacOS instructions 上的说明为英特尔的 Lava 神经形态计算框架设置您的设备提供了一些 pip 命令、一个 git clone 命令和一些诗歌说明。我习惯于能够将pip 命令集成到conda 的environment.yml 中,我认为git clone 命令也可以包含在environment.yml 文件中。但是,我还不确定如何集成诗歌命令。

问题

因此,我想问一下:如何将下面的安装脚本转换成(单个)conda环境yaml文件?

cd $HOME
pip install -U pip
pip install "poetry>=1.1.13"
git clone git@github.com:lava-nc/lava.git
cd lava
poetry config virtualenvs.in-project true
poetry install
source .venv/bin/activate
pytest

尝试

我已经能够在单个 environment.yml 中成功安装 Lava 软件,使用:

# run: conda env create --file lava_environment.yml
# include new packages: conda env update --file lava_environment.yml
name: lava
channels:
  - conda-forge
  - conda
dependencies:
- anaconda
- conda:
# Run python tests.
  - pytest=6.1.2
- pip
- pip:
# Auto generate docstrings
  - pyment
# Run pip install on .tar.gz file in GitHub repository.
  - https://github.com/lava-nc/lava/releases/download/v0.3.0/lava-nc-0.3.0.tar.gz

我已经安装了:

conda env create --file lava_environment.yml

但是,installs it from a binary 而不是来自源代码。

【问题讨论】:

    标签: conda environment python-poetry


    【解决方案1】:

    这可能会对你有所帮助:

    cd $HOME
    pip install -U pip
    pip install "poetry>=1.1.13"
    git clone git@github.com:lava-nc/lava.git
    cd lava
    poetry config virtualenvs.in-project true
    poetry install
    poetry run pytest
    

    在脚本中使用poetry 时,不手动激活venv 会更容易(原因是source 可能难以使用),而是使用poetry run <command> 执行应注意的命令venv

    【讨论】:

    • 感谢您的建议。我想我没有明确提出这个问题,因为您似乎实际上已经复制了问题中已经包含的安装说明。相反,该问题旨在将这些指令转换为environment.yml 文件。您对我如何改进我的问题有什么建议吗?
    • 不是真的,我只是注意力不集中,并假设我从对您的问题的理解中理解了您的问题。我会尝试看看我是否可以理解 environment.yml 文件是什么,我是否可以修复我的答案,或者其他人已经知道该怎么做。
    【解决方案2】:

    这个environment.yml可以用来安装和使用Lava v0.0.3框架:

    # This file is to automatically configure your environment. It allows you to
    # run the code with a single command without having to install anything
    # (extra).
    
    # First run: conda env create --file environment.yml
    # If you change this file, run: conda env update --file environment.yml
    
    # Instructions for this networkx-to-lava-nc repository only. First time usage
    # On Ubuntu (this is needed for lava-nc):
    # sudo apt upgrade
    # sudo apt full-upgrade
    # yes | sudo apt install gcc
    
    # Conda configuration settings. (Specify which modules/packages are installed.)
    name: nx2lava
    channels:
      - conda-forge
    dependencies:
    # Specify specific python version.
      - python=3.8
    # Run python tests.
      - pytest-cov
    # Generate plots.
      - matplotlib
    # Run graph software quickly.
      - networkx
      - pip
      - pip:
    # Run pip install on .tar.gz file in GitHub repository (For lava-nc only).
        - https://github.com/lava-nc/lava/releases/download/v0.3.0/lava-nc-0.3.0.tar.gz
    # Turns relative import paths into absolute import paths.
        - absolufy-imports
    # Auto format Python code to make it flake8 compliant.
        - autoflake
    # Scan Python code for security issues.
        - bandit
    # Code formatting compliance.
        - black
    # Correct code misspellings.
        - codespell
    # Verify percentage of code that has at least 1 test.
        - coverage
    # Auto formats the Python documentation written in the code.
        - docformatter
    # Auto generate docstrings.
        - flake8
    # Auto sort the import statements.
        - isort
    # Auto format Markdown files.
        - mdformat
    # Auto check static typing.
        - mypy
    # Auto generate documentation.
        - pdoc3
    # Auto check programming style aspects.
        - pylint
    # Auto generate docstrings.
        - pyment
    # Identify and remove dead code.
        - vulture
    # Include GitHub pre-commit hook.
        - pre-commit
    # Automatically upgrades Python syntax to the new Python version syntax.
        - pyupgrade
    # Another static type checker for python like mypy.
        - pyright
    

    它还包括使用pre-commit 进行质量保证的软件包。

    【讨论】:

      猜你喜欢
      • 2014-06-27
      • 2018-03-22
      • 2021-02-28
      • 2019-02-02
      • 2022-11-09
      • 2022-07-14
      • 2022-07-29
      • 2020-06-13
      • 2020-05-05
      相关资源
      最近更新 更多