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

[Feature request] Package to anaconda #179

Closed
tuanpham96 opened this issue Mar 2, 2023 · 5 comments
Closed

[Feature request] Package to anaconda #179

tuanpham96 opened this issue Mar 2, 2023 · 5 comments

Comments

@tuanpham96
Copy link

Context

It'd be great if this can be packaged on anaconda.org so folks using conda environments can easily install in their environment in a reproducible way (i.e. so that smcat can be specified in an environment.yaml file). For example, the node package prettier is also available on conda-forge channel at https://anaconda.org/conda-forge/prettier.

Proposed Behavior

I think this is how prettier integrates into conda-forge: https://github.com/conda-forge/prettier-feedstock

Current Behavior

I followed some of their recipe folder and was able to build locally with some modification, and currently only for Unix systems and may not be appropriate for Windows.

Click to view content of relevant recipe files

I only included 2 files:

  • recipe/meta.yaml file:

    {% set name = "state-machine-cat" %}
    {% set version = "v10.1.10" %}
    
    package:
      name: {{ name|lower }}
      version: {{ version|replace("-", "_")|replace("v", "") }}
    
    source:
      url: https://github.com/sverweij/state-machine-cat/archive/refs/tags/{{ version }}.tar.gz 
      sha256: 386d2578731f0899c540e5020b4627cc75af4e50fb61887505aac47bd5c9dea1
    
    build:
      number: 0
    
    requirements:
      build:
        - sysroot_linux-64 2.17  # [linux64]
        - nodejs  # [not win]
      host:
        - nodejs
        - yarn
      run:
        - nodejs
    
    test:
      commands:
        - smcat --version
        - which smcat
    
    about:
      home: https://github.com/sverweij/state-machine-cat
      license: MIT
      license_family: MIT
      license_file:
        - LICENSE
          # - ThirdPartyLicenses.txt
      summary: smcat write beautiful state charts.
  • recipe/build.sh file:

    #!/usr/bin/env bash
    
    set -euxo pipefail
    if [[ "${target_platform}" == "osx-arm64" ]]; then
        export npm_config_arch="arm64"
    fi
    
    rm $PREFIX/bin/node
    ln -s $BUILD_PREFIX/bin/node $PREFIX/bin/node
    
    yarn pack -o ${PKG_NAME}-v${PKG_VERSION}.tgz  
    # yarn licenses generate-disclaimer > ThirdPartyLicenses.txt
    NPM_CONFIG_USERCONFIG=/tmp/nonexistentrc
    
    npm install -g ${PKG_NAME}-v${PKG_VERSION}.tgz

Then I built with (with conda-build, boa installed)

conda-mambabuild -c conda-forge recipe                                                                       

Considered alternatives

An alternative is to manually install smcat inside a conda environment with nodejs already installed.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale label Mar 10, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 13, 2023
@sverweij sverweij reopened this Mar 14, 2023
@sverweij sverweij removed the stale label Mar 14, 2023
@sverweij
Copy link
Owner

Hi @tuanpham96 I hadn't heard of anaconda before, so thanks for that insight. I'm OK with having a package (declaration) for it, provided it's fully automated and hooked in as part of state-machine-cat's release process. From your example it looks like this is possible.

Not sure if I have the bandwidth to dive into it a.t.m., but a PR is welcome.

@tuanpham96
Copy link
Author

I finally got some time to get around this. Just briefly, anaconda contains many packages that usually are used for python projects, but also can contain other non-python packages like R, nodejs, C, ... And conda-forge is one of the popular channels.

I submitted a PR on conda-forge/staged-recipes#22544 for version 10.1.10. If approved, this can be added to conda-forge and the repo https://github.com/conda-forge/state-machine-cat-feedstock would be created. Feel free to browse through the PR and see what you'd like to add/modify, I use a lot of the codes from prettier-feedstock recipes to do that.

it's fully automated and hooked in as part of state-machine-cat's release process.

The only thing that would need changing is the sha256sum and version tag in the meta.yaml file, whenever there's a new release.

I'm not quite sure yet how to hook this up automatically. But once https://github.com/conda-forge/state-machine-cat-feedstock, I'll try to assess how that's possible.

@tuanpham96
Copy link
Author

It seems like PRs on conda-forge for nodejs packages are not very popular. The PR for this was marked as stale. I will close this issue for now. Thanks for the help!

@sverweij
Copy link
Owner

Hi @tuanpham96 it's sad it went that way - but agree.

You do have my admiration for your patience and tenacity with the anaconda repo though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants