Skip to content

Fix conda package upload #59

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

Merged
merged 3 commits into from
May 23, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update build scripts
  • Loading branch information
mikeheddes committed May 23, 2022
commit e189ede68dbe75364d71b45ced3368ca9ad6aa0c
21 changes: 13 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:

anaconda:
runs-on: ubuntu-latest
needs: pypi
steps:
- uses: actions/checkout@v3
- name: Set up Python
Expand All @@ -43,19 +44,23 @@ jobs:
echo $CONDA/bin >> $GITHUB_PATH
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install openssl curl
conda install -y anaconda-client conda-build conda-verify
- name: Publish distribution to Anaconda
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
run: |
cd ./conda # go to build dir
mkdir ./conda-build # create the artifact dir

# Build for Linux
conda build --output-folder ./conda_build . .
# Get the version of the library
export TORCHHD_VERSION=$(python -c "with open('torchhd/version.py') as f: exec(f.read()); print(__version__)")

# Convert to other platforms: OSX, WIN
conda convert --platform all ./conda_build/linux-64/*.tar.bz2
# Calculate the HASH of the PyPi package
curl -L --output ./conda-build/torchhd.tar.gz "https://pypi.io/packages/source/t/torch-hd/torch-hd-${TORCHHD_VERSION}.tar.gz"
export TORCHHD_HASH=$(openssl sha256 ./conda-build/torchhd.tar.gz | awk '{print $2}')

anaconda upload --label main ./conda_build/osx-64/*.tar.bz2
anaconda upload --label main ./conda_build/linux-64/*.tar.bz2
anaconda upload --label main ./conda_build/win-64/*.tar.bz2
# Build for noarch platform
conda-build -c pytorch --output-folder ./conda-build ./conda

# Upload noarch version of torchhd to anaconda
anaconda upload -u torchhd --label main ./conda-build/*/*.tar.bz2
6 changes: 0 additions & 6 deletions conda/conda_build_config.yaml

This file was deleted.

24 changes: 15 additions & 9 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{% set data = load_setup_py_data() %}
{% set name = "torch-hd" %}

package:
name: torchhd
version: {{ data['version'] }}
version: {{ TORCHHD_VERSION }}

source:
path: ..
git_url: https://github.com/hyperdimensional-computing/torchhd
url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ TORCHHD_VERSION }}.tar.gz
sha256: {{ TORCHHD_HASH }}

build:
noarch: generic
number: 0
script: python setup.py install --single-version-externally-managed --record=record.txt
script: "{{ PYTHON }} -m pip install . --no-deps --ignore-installed -vv "

requirements:
host:
- pip
- python>=3.6

run:
- python>=3.6
- pytorch
Expand All @@ -26,9 +26,15 @@ requirements:
test:
imports:
- torchhd
- torchhd.functional
- torchhd.embeddings
- torchhd.structures
- torchhd.datasets

about:
home: {{ data['url'] }}
license: {{ data['license'] }}
summary: {{ data['description'] }}
home: https://github.com/hyperdimensional-computing/torchhd
license: MIT
license_file: LICENSE
summary: Torchhd is a Python library for Hyperdimensional Computing
dev_url: https://github.com/hyperdimensional-computing/torchhd
doc_url: https://torchhd.readthedocs.io
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
"""
from setuptools import setup, find_packages

# Read the version without importing any dependencies
version = {}
with open('torchhd/version.py') as f:
exec(f.read(), version)

setup(
name="torch-hd", # use torch-hd on PyPi to install torchhd, torchhd is too similar according to PyPi
version="2.2.2",
version=version["__version__"],
description="Torchhd is a Python library for Hyperdimensional Computing",
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
Expand Down
2 changes: 2 additions & 0 deletions torchhd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
permute,
)

from torchhd.version import __version__

__all__ = [
"functional",
"embeddings",
Expand Down
1 change: 1 addition & 0 deletions torchhd/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__="2.2.2"