From e68b69d05d495848be6e271b5424fd2168b110ec Mon Sep 17 00:00:00 2001 From: Jeremy Reizenstein Date: Thu, 11 Mar 2021 14:31:53 -0800 Subject: [PATCH] iopath ci Summary: Small changes to iopath CI -Add conda build for python 3.9 -Make both conda and pip build on every commit (for future use in automating uploads) -remove the date from the conda package name -move the version number definition to a separate file so it is easier to read programmatically. Reviewed By: sujitoc Differential Revision: D26956064 fbshipit-source-id: 556f8278e79b0ef208e317b2fe826f5429d31b7f --- .circleci/config.yml | 14 +++++++++++++- iopath/__init__.py | 7 +++---- iopath/version.py | 1 + packaging/build_all_conda.sh | 4 ++-- packaging/build_conda.sh | 6 +++--- setup.py | 17 +++-------------- 6 files changed, 25 insertions(+), 24 deletions(-) create mode 100644 iopath/version.py diff --git a/.circleci/config.yml b/.circleci/config.yml index 010b8f3..cbe1fa4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -99,7 +99,7 @@ jobs: paths: - "*" - build_conda: + build_conda_and_pip: docker: - image: continuumio/miniconda3 steps: @@ -114,11 +114,23 @@ jobs: fi conda install conda-build bash packaging/build_all_conda.sh + - run: + name: Build Pip Package + command: | + # no commits in the last 25 hours + if [[ -z $(git log --since="25 hours ago") ]]; then + echo "No commits in the last day." + exit 0 + fi + python setup.py bdist_wheel - store_artifacts: path: packaging/output_files + - store_artifacts: + path: dist workflows: version: 2 regular_test: jobs: - tests + - build_conda_and_pip diff --git a/iopath/__init__.py b/iopath/__init__.py index 70e6ded..14bddaf 100644 --- a/iopath/__init__.py +++ b/iopath/__init__.py @@ -12,6 +12,8 @@ TabularUriParser, ) +from .version import __version__ + __all__ = [ "LazyPath", "PathManager", @@ -19,8 +21,5 @@ "file_lock", "TabularPathHandler", "TabularUriParser", + __version__, ] - -# This line will be programatically read/write by setup.py. -# Leave them at the bottom of this file and don't touch them. -__version__ = "0.1.6" diff --git a/iopath/version.py b/iopath/version.py new file mode 100644 index 0000000..0a8da88 --- /dev/null +++ b/iopath/version.py @@ -0,0 +1 @@ +__version__ = "0.1.6" diff --git a/packaging/build_all_conda.sh b/packaging/build_all_conda.sh index 8ca90e5..96b0c9a 100644 --- a/packaging/build_all_conda.sh +++ b/packaging/build_all_conda.sh @@ -2,14 +2,14 @@ # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. set -ex -for PV in 3.6 3.7 3.8 +for PV in 3.6 3.7 3.8 3.9 do PYTHON_VERSION=$PV bash packaging/build_conda.sh done ls -Rl packaging -for version in 36 37 38 +for version in 36 37 38 39 do (cd packaging/out && conda convert -p win-64 linux-64/iopath-*-py$version.tar.bz2) (cd packaging/out && conda convert -p osx-64 linux-64/iopath-*-py$version.tar.bz2) diff --git a/packaging/build_conda.sh b/packaging/build_conda.sh index 0f063d3..0abf36d 100644 --- a/packaging/build_conda.sh +++ b/packaging/build_conda.sh @@ -4,10 +4,10 @@ set -ex mkdir -p packaging/out -version=$(python -c "exec(open('iopath/__init__.py').read()); print(__version__)") -build_version=$version.post$(date +%Y%m%d) +version=$(python -c "exec(open('iopath/version.py').read()); print(__version__)") +# build_version=$version.post$(date +%Y%m%d) -export BUILD_VERSION=$build_version +export BUILD_VERSION=$version if [[ "3.6" == "$PYTHON_VERSION" ]] then diff --git a/setup.py b/setup.py index 26b91ca..977e50e 100755 --- a/setup.py +++ b/setup.py @@ -2,26 +2,15 @@ # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from os import path +import runpy from setuptools import find_packages, setup - -def get_version(): - init_py_path = path.join( - path.abspath(path.dirname(__file__)), "iopath", "__init__.py" - ) - init_py = open(init_py_path, "r").readlines() - version_line = [line.strip() for line in init_py if line.startswith("__version__")][ - 0 - ] - version = version_line.split("=")[-1].strip().strip("'\"") - - return version - +version = runpy.run_path("iopath/version.py")["__version__"] setup( name="iopath", - version=get_version(), + version=version, author="FAIR", license="MIT licensed, as found in the LICENSE file", url="https://github.com/facebookresearch/iopath",