diff --git a/CHANGELOG.md b/CHANGELOG.md index 92229ffbe1dc9a83a3df3f00067ca60dea429223..24d55eb803086790d5734d803a2f4ddd88fbad30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,10 @@ This changelog follows the specifications detailed in: [Keep a Changelog](https: This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), although we have not yet reached a `1.0.0` release. -## Version 0.5.17 - Unreleased +## Version 0.5.18 - Unreleased + + +## Version 0.5.17 - Released 2021-10-05 ### Changed * Moved imgaug from runtime dependencies to problematic (because of opencv) diff --git a/netharn/__init__.py b/netharn/__init__.py index 733d8f548ef2bb1feb6435a96172d0edcfd497f0..cc2d4c1340350976618e0a2ad4c8ef452815d47d 100644 --- a/netharn/__init__.py +++ b/netharn/__init__.py @@ -4,7 +4,7 @@ mkinit netharn --noattrs --dry mkinit netharn --noattrs """ -__version__ = '0.5.17' +__version__ = '0.5.18' try: # PIL 7.0.0 removed PIL_VERSION, which breaks torchvision, monkey patch it diff --git a/netharn/layers/perceptron.py b/netharn/layers/perceptron.py index 923e4b727acc1b7cd229e3f6489bf18f4cc52c53..6c48bba3357490c997a7cbcda6c00c4b14739d7a 100644 --- a/netharn/layers/perceptron.py +++ b/netharn/layers/perceptron.py @@ -119,7 +119,7 @@ class MultiLayerPerceptronNd(common.AnalyticModule): n = hidden_channels hidden_channels = np.linspace(in_channels, out_channels, n + 1, endpoint=False)[1:] - hidden_channels = hidden_channels.round().astype(np.int).tolist() + hidden_channels = hidden_channels.round().astype(int).tolist() self._hidden_channels = hidden_channels hidden = self.hidden = common.Sequential() diff --git a/netharn/schedulers/scheduler_redesign.py b/netharn/schedulers/scheduler_redesign.py index 990312dfba61eb18b6e4391417547c1ebac8dbb6..b60e21dd55d970546f93e848813545c51af6995b 100644 --- a/netharn/schedulers/scheduler_redesign.py +++ b/netharn/schedulers/scheduler_redesign.py @@ -79,12 +79,14 @@ class ListedScheduler(_Scheduler): ... states.append((self.epoch, copy.deepcopy(self._optim_attrs()))) ... self.step() >>> print('states = {}'.format(ub.repr2(states, nl=1))) + states = [ (0, {'dampening': [0], 'lr': [1], 'momentum': [2], 'nesterov': [False], 'weight_decay': [0]}), (1, {'dampening': [0], 'lr': [1], 'momentum': [2], 'nesterov': [False], 'weight_decay': [0]}), (2, {'dampening': [0], 'lr': [21], 'momentum': [22], 'nesterov': [False], 'weight_decay': [0]}), (3, {'dampening': [0], 'lr': [31], 'momentum': [32], 'nesterov': [False], 'weight_decay': [0]}), ] + >>> # Test ADAM >>> optimizer = torch.optim.Adam(model.parameters(), lr=0) >>> self = ListedScheduler(points, optimizer=optimizer, interpolation='linear') @@ -93,6 +95,7 @@ class ListedScheduler(_Scheduler): ... states.append((self.epoch, copy.deepcopy(self._optim_attrs()))) ... self.step() >>> print('states = {}'.format(ub.repr2(states, nl=1))) + states = [ (0, {'amsgrad': [False], 'betas': [(2, 0.999)], 'eps': [1e-08], 'lr': [1], 'weight_decay': [0]}), (1, {'amsgrad': [False], 'betas': [(12.0, 0.999)], 'eps': [1e-08], 'lr': [11.0], 'weight_decay': [0]}), diff --git a/publish.sh b/publish.sh index 1c9c912ec8a8267b21c30cd5b087840ed632d190..c0b1260acf0f143f61520f2524bb46b03c00d702 100755 --- a/publish.sh +++ b/publish.sh @@ -34,20 +34,9 @@ Usage: # Set your variables or load your secrets export TWINE_USERNAME= export TWINE_PASSWORD= + TWINE_REPOSITORY_URL="https://test.pypi.org/legacy/" source $(secret_loader.sh) - - MB_PYTHON_TAG=cp38-cp38m - MB_PYTHON_TAG=cp37-cp37m - MB_PYTHON_TAG=cp36-cp36m - MB_PYTHON_TAG=cp35-cp35m - MB_PYTHON_TAG=cp27-cp27mu - - echo "MB_PYTHON_TAG = $MB_PYTHON_TAG" - MB_PYTHON_TAG=$MB_PYTHON_TAG ./run_multibuild.sh - DEPLOY_REMOTE=ibeis MB_PYTHON_TAG=$MB_PYTHON_TAG ./publish.sh yes - - MB_PYTHON_TAG=py3-none-any ./publish.sh ''' check_variable(){ @@ -82,22 +71,20 @@ normalize_boolean(){ DEPLOY_REMOTE=${DEPLOY_REMOTE:=origin} NAME=${NAME:=$(python -c "import setup; print(setup.NAME)")} VERSION=$(python -c "import setup; print(setup.VERSION)") -MB_PYTHON_TAG=${MB_PYTHON_TAG:py3-none-any} # The default should change depending on the application #DEFAULT_MODE_LIST=("sdist" "universal" "bdist") -DEFAULT_MODE_LIST=("sdist" "native" "universal") +DEFAULT_MODE_LIST=("sdist" "native") #DEFAULT_MODE_LIST=("sdist" "bdist") check_variable DEPLOY_REMOTE -check_variable VERSION || exit 1 ARG_1=$1 DO_UPLOAD=${DO_UPLOAD:=$ARG_1} DO_TAG=${DO_TAG:=$ARG_1} -DO_GPG=${DO_GPG:="True"} -DO_BUILD=${DO_BUILD:="True"} +DO_GPG=${DO_GPG:="auto"} +DO_BUILD=${DO_BUILD:="auto"} DO_GPG=$(normalize_boolean "$DO_GPG") DO_BUILD=$(normalize_boolean "$DO_BUILD") @@ -107,6 +94,13 @@ DO_TAG=$(normalize_boolean "$DO_TAG") TWINE_USERNAME=${TWINE_USERNAME:=""} TWINE_PASSWORD=${TWINE_PASSWORD:=""} +if [[ "$(cat .git/HEAD)" != "ref: refs/heads/release" ]]; then + # If we are not on release, then default to the test pypi upload repo + TWINE_REPOSITORY_URL=${TWINE_REPOSITORY_URL:="https://test.pypi.org/legacy/"} +else + TWINE_REPOSITORY_URL=${TWINE_REPOSITORY_URL:="https://upload.pypi.org/legacy/"} +fi + if [[ "$(which gpg2)" != "" ]]; then GPG_EXECUTABLE=${GPG_EXECUTABLE:=gpg2} else @@ -116,13 +110,15 @@ fi GPG_KEYID=${GPG_KEYID:=$(git config --local user.signingkey)} GPG_KEYID=${GPG_KEYID:=$(git config --global user.signingkey)} +WAS_INTERACTION="False" + echo " === PYPI BUILDING SCRIPT == VERSION='$VERSION' TWINE_USERNAME='$TWINE_USERNAME' +TWINE_REPOSITORY_URL = $TWINE_REPOSITORY_URL GPG_KEYID = '$GPG_KEYID' -MB_PYTHON_TAG = '$MB_PYTHON_TAG' DO_UPLOAD=${DO_UPLOAD} DO_TAG=${DO_TAG} @@ -138,29 +134,76 @@ else if [[ "$DO_TAG" == "False" ]]; then echo "We are NOT about to tag VERSION='$VERSION'" else - read -p "Do you want to git tag version='$VERSION'? (input 'yes' to confirm)" ANS + read -p "Do you want to git tag and push version='$VERSION'? (input 'yes' to confirm)" ANS echo "ANS = $ANS" + WAS_INTERACTION="True" DO_TAG="$ANS" DO_TAG=$(normalize_boolean "$DO_TAG") + if [ "$DO_BUILD" == "auto" ]; then + DO_BUILD="" + DO_GPG="" + fi + fi +fi + + +# Verify that we want to build +if [ "$DO_BUILD" == "auto" ]; then + DO_BUILD="True" +fi +# Verify that we want to build +if [ "$DO_GPG" == "auto" ]; then + DO_GPG="True" +fi + +if [[ "$DO_BUILD" == "True" ]]; then + echo "About to build wheels" +else + if [[ "$DO_BUILD" == "False" ]]; then + echo "We are NOT about to build wheels" + else + read -p "Do you need to build wheels? (input 'yes' to confirm)" ANS + echo "ANS = $ANS" + WAS_INTERACTION="True" + DO_BUILD="$ANS" + DO_BUILD=$(normalize_boolean "$DO_BUILD") fi fi # Verify that we want to publish if [[ "$DO_UPLOAD" == "True" ]]; then - echo "About to publish VERSION='$VERSION'" + echo "About to directly publish VERSION='$VERSION'" else if [[ "$DO_UPLOAD" == "False" ]]; then - echo "We are NOT about to publish VERSION='$VERSION'" + echo "We are NOT about to directly publish VERSION='$VERSION'" else - read -p "Are you ready to publish version='$VERSION'? (input 'yes' to confirm)" ANS + read -p "Are you ready to directly publish version='$VERSION'? ('yes' will twine upload)" ANS echo "ANS = $ANS" + WAS_INTERACTION="True" DO_UPLOAD="$ANS" DO_UPLOAD=$(normalize_boolean "$DO_UPLOAD") fi fi +if [[ "$WAS_INTERACTION" == "True" ]]; then + echo " + === PYPI BUILDING SCRIPT == + VERSION='$VERSION' + TWINE_USERNAME='$TWINE_USERNAME' + TWINE_REPOSITORY_URL = $TWINE_REPOSITORY_URL + GPG_KEYID = '$GPG_KEYID' + + DO_UPLOAD=${DO_UPLOAD} + DO_TAG=${DO_TAG} + DO_GPG=${DO_GPG} + DO_BUILD=${DO_BUILD} + " + read -p "Look good? Ready? Enter any text to continue" ANS +fi + + MODE=${MODE:=all} @@ -202,7 +245,7 @@ if [ "$DO_BUILD" == "True" ]; then #WHEEL_PATHS+=($WHEEL_PATH) elif [[ "$_MODE" == "bdist" ]]; then echo "Assume wheel has already been built" - WHEEL_PATH=$(ls wheelhouse/$NAME-$VERSION-$MB_PYTHON_TAG*.whl) + WHEEL_PATH=$(ls wheelhouse/$NAME-$VERSION-*.whl) #WHEEL_PATHS+=($WHEEL_PATH) else echo "bad mode" @@ -235,7 +278,7 @@ do WHEEL_PATH=$(ls dist/$NAME-$VERSION-$UNIVERSAL_TAG*.whl) WHEEL_PATHS+=($WHEEL_PATH) elif [[ "$_MODE" == "bdist" ]]; then - WHEEL_PATH=$(ls wheelhouse/$NAME-$VERSION-$MB_PYTHON_TAG*.whl) + WHEEL_PATH=$(ls wheelhouse/$NAME-$VERSION-*.whl) WHEEL_PATHS+=($WHEEL_PATH) else echo "bad mode" @@ -291,8 +334,15 @@ fi if [[ "$DO_TAG" == "True" ]]; then - git tag $VERSION -m "tarball tag $VERSION" - git push --tags $DEPLOY_REMOTE $DEPLOY_BRANCH + TAG_NAME="v${VERSION}" + # if we messed up we can delete the tag + # git push origin :refs/tags/$TAG_NAME + # and then tag with -f + # + git tag $TAG_NAME -m "tarball tag $VERSION" + git push --tags $DEPLOY_REMOTE + echo "Should also do a: git push $DEPLOY_REMOTE main:release" + echo "For github should draft a new release: https://github.com/PyUtils/line_profiler/releases/new" else echo "Not tagging" fi @@ -305,9 +355,13 @@ if [[ "$DO_UPLOAD" == "True" ]]; then for WHEEL_PATH in "${WHEEL_PATHS[@]}" do if [ "$DO_GPG" == "True" ]; then - twine upload --username $TWINE_USERNAME --password=$TWINE_PASSWORD --sign $WHEEL_PATH.asc $WHEEL_PATH || { echo 'failed to twine upload' ; exit 1; } + twine upload --username $TWINE_USERNAME --password=$TWINE_PASSWORD \ + --repository-url $TWINE_REPOSITORY_URL \ + --sign $WHEEL_PATH.asc $WHEEL_PATH --skip-existing --verbose || { echo 'failed to twine upload' ; exit 1; } else - twine upload --username $TWINE_USERNAME --password=$TWINE_PASSWORD $WHEEL_PATH || { echo 'failed to twine upload' ; exit 1; } + twine upload --username $TWINE_USERNAME --password=$TWINE_PASSWORD \ + --repository-url $TWINE_REPOSITORY_URL \ + $WHEEL_PATH --skip-existing --verbose || { echo 'failed to twine upload' ; exit 1; } fi done echo """ diff --git a/super_setup.py b/super_setup.py index 54f95f6106af5c9a504efc74ac38f50e7bc25451..51b6b8bcab4be18c861900c4d67a26bfb741b545 100755 --- a/super_setup.py +++ b/super_setup.py @@ -846,51 +846,51 @@ def determine_code_dpath(): DEVEL_REPOS = [ # The util libs { - 'name': 'kwarray', 'branch': 'dev/0.5.20', 'remote': 'public', - 'remotes': {'public': 'git@gitlab.kitware.com:computer-vision/kwarray.git'}, + 'name': 'kwarray', 'branch': 'dev/0.5.22', 'remote': 'origin', + 'remotes': {'origin': 'git@gitlab.kitware.com:computer-vision/kwarray.git'}, }, { - 'name': 'kwimage', 'branch': 'dev/0.7.13', 'remote': 'public', - 'remotes': {'public': 'git@gitlab.kitware.com:computer-vision/kwimage.git'}, + 'name': 'kwimage', 'branch': 'dev/0.8.3', 'remote': 'origin', + 'remotes': {'origin': 'git@gitlab.kitware.com:computer-vision/kwimage.git'}, }, # TODO: # { - # 'name': 'kwannot', 'branch': 'dev/0.1.0', 'remote': 'public', - # 'remotes': {'public': 'git@gitlab.kitware.com:computer-vision/kwannot.git'}, + # 'name': 'kwannot', 'branch': 'dev/0.1.0', 'remote': 'origin', + # 'remotes': {'origin': 'git@gitlab.kitware.com:computer-vision/kwannot.git'}, # }, { - 'name': 'kwcoco', 'branch': 'dev/0.2.13', 'remote': 'public', - 'remotes': {'public': 'git@gitlab.kitware.com:computer-vision/kwcoco.git'}, + 'name': 'kwcoco', 'branch': 'dev/0.2.26', 'remote': 'origin', + 'remotes': {'origin': 'git@gitlab.kitware.com:computer-vision/kwcoco.git'}, }, { - 'name': 'kwplot', 'branch': 'dev/0.4.10', 'remote': 'public', - 'remotes': {'public': 'git@gitlab.kitware.com:computer-vision/kwplot.git'}, + 'name': 'kwplot', 'branch': 'dev/0.4.12', 'remote': 'origin', + 'remotes': {'origin': 'git@gitlab.kitware.com:computer-vision/kwplot.git'}, }, # Pytorch deployer / exporter { - 'name': 'liberator', 'branch': 'dev/0.0.2', 'remote': 'public', - 'remotes': {'public': 'git@gitlab.kitware.com:python/liberator.git'}, + 'name': 'liberator', 'branch': 'dev/0.0.2', 'remote': 'origin', + 'remotes': {'origin': 'git@gitlab.kitware.com:python/liberator.git'}, }, { - 'name': 'torch_liberator', 'branch': 'dev/0.1.1', 'remote': 'public', - 'remotes': {'public': 'git@gitlab.kitware.com:computer-vision/torch_liberator.git'}, + 'name': 'torch_liberator', 'branch': 'dev/0.1.2', 'remote': 'origin', + 'remotes': {'origin': 'git@gitlab.kitware.com:computer-vision/torch_liberator.git'}, }, # For example data and CLI { - 'name': 'scriptconfig', 'branch': 'dev/0.5.9', 'remote': 'public', - 'remotes': {'public': 'git@gitlab.kitware.com:utils/scriptconfig.git'}, + 'name': 'scriptconfig', 'branch': 'dev/0.5.9', 'remote': 'origin', + 'remotes': {'origin': 'git@gitlab.kitware.com:utils/scriptconfig.git'}, }, { - 'name': 'ndsampler', 'branch': 'dev/0.6.6', 'remote': 'public', - 'remotes': {'public': 'git@gitlab.kitware.com:computer-vision/ndsampler.git'}, + 'name': 'ndsampler', 'branch': 'dev/0.6.7', 'remote': 'origin', + 'remotes': {'origin': 'git@gitlab.kitware.com:computer-vision/ndsampler.git'}, }, # netharn - training harness { - 'name': 'netharn', 'branch': 'dev/0.5.17', 'remote': 'public', - 'remotes': {'public': 'git@gitlab.kitware.com:computer-vision/netharn.git'}, + 'name': 'netharn', 'branch': 'dev/0.5.18', 'remote': 'origin', + 'remotes': {'origin': 'git@gitlab.kitware.com:computer-vision/netharn.git'}, }, ]