From 2ecad81e5b80dea6e44b90669f1002ad50aae2fe Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 29 Jan 2023 00:06:43 -0500 Subject: [PATCH 01/23] Remove old python2 code --- README.rst | 2 + requirements/runtime.txt | 17 +- vtool_ibeis/__init__.py | 3 - vtool_ibeis/_old_matching.py | 262 ----------------------------- vtool_ibeis/_rhomb_dist.py | 2 - vtool_ibeis/blend.py | 4 - vtool_ibeis/chip.py | 7 +- vtool_ibeis/clustering2.py | 4 - vtool_ibeis/confusion.py | 2 - vtool_ibeis/coverage_grid.py | 3 - vtool_ibeis/coverage_kpts.py | 4 +- vtool_ibeis/demodata.py | 2 - vtool_ibeis/distance.py | 19 +-- vtool_ibeis/ellipse.py | 5 +- vtool_ibeis/exif.py | 9 +- vtool_ibeis/features.py | 2 - vtool_ibeis/fontdemo.py | 3 - vtool_ibeis/geometry.py | 6 +- vtool_ibeis/histogram.py | 3 - vtool_ibeis/image.py | 4 - vtool_ibeis/image_filters.py | 7 +- vtool_ibeis/image_shared.py | 3 - vtool_ibeis/inspect_matches.py | 2 - vtool_ibeis/linalg.py | 1 - vtool_ibeis/matching.py | 2 - vtool_ibeis/nearest_neighbors.py | 1 - vtool_ibeis/numpy_utils.py | 8 +- vtool_ibeis/other.py | 4 - vtool_ibeis/patch.py | 12 -- vtool_ibeis/quality_classifier.py | 1 - vtool_ibeis/score_normalization.py | 2 - vtool_ibeis/segmentation.py | 2 - vtool_ibeis/symbolic.py | 2 - vtool_ibeis/trig.py | 1 - vtool_ibeis/util_math.py | 9 +- 35 files changed, 35 insertions(+), 385 deletions(-) delete mode 100644 vtool_ibeis/_old_matching.py diff --git a/README.rst b/README.rst index 0130a24f..8bb9c6f8 100644 --- a/README.rst +++ b/README.rst @@ -16,6 +16,8 @@ Repos relevant to the ibeis project: * https://github.com/Erotemic/vtool_ibeis +* https://github.com/Erotemic/vtool_ibeis_ext + * https://github.com/Erotemic/pyflann_ibeis * https://github.com/Erotemic/pyhesaff diff --git a/requirements/runtime.txt b/requirements/runtime.txt index bee6795c..34e1276c 100644 --- a/requirements/runtime.txt +++ b/requirements/runtime.txt @@ -10,7 +10,8 @@ networkx>=2.5 ; python_version < '3.7' and python_version >= '3.6' # Py networkx>=2.3 ; python_version < '3.6' and python_version >= '3.5' # Python 3.5 networkx>=1.11 ; python_version < '3.5' and python_version >= '2.7' # Python 2.7 -Pillow>=9.1.0 ; python_version >= '3.10' # Python 3.10+ +Pillow>=9.2.0 ; python_version < '4.0' and python_version >= '3.11' # Python 3.11+ +Pillow>=9.1.0 ; python_version < '3.11' and python_version >= '3.10' # Python 3.10 Pillow>=8.3.2 ; python_version < '3.10' and python_version >= '3.9' # Python 3.9 Pillow>=8.3.2 ; python_version < '3.9' and python_version >= '3.8' # Python 3.8 Pillow>=9.0.0 ; python_version < '3.8' and python_version >= '3.7' # Python 3.7 @@ -28,7 +29,13 @@ scipy>=1.8.0 ; python_version < '3.9' and python_version >= '3.8' # Pytho scipy>=1.6.0 ; python_version < '3.8' and python_version >= '3.7' # Python 3.7 six >= 1.10.0 -scikit-image + +scikit-image>=0.19.3 ; python_version < '4.0' and python_version >= '3.11' # Python 3.11+ +scikit-image>=0.19.0 ; python_version < '3.11' and python_version >= '3.10' # Python 3.10 +scikit-image>=0.18.0 ; python_version < '3.10' and python_version >= '3.9' # Python 3.9 +scikit-image>=0.17.2 ; python_version < '3.9' and python_version >= '3.8' # Python 3.8 +scikit-image>=0.17.2 ; python_version < '3.8' and python_version >= '3.7' # Python 3.7 +scikit-image>=0.17.2 ; python_version < '3.7' and python_version >= '3.6' # Python 3.6 scikit-learn>=1.0.2 ; python_version >= '3.10' # Python 3.10+ scikit-learn>=1.0.2 ; python_version < '3.10' and python_version >= '3.9' # Python 3.9 @@ -41,8 +48,8 @@ statsmodels>=0.13.1 ; python_version < '3.10' and python_version >= '3.9' statsmodels>=0.13.1 ; python_version < '3.9' and python_version >= '3.8' # Python 3.8 statsmodels>=0.9.0 ; python_version < '3.8' and python_version >= '3.7' # Python 3.7 -ubelt >= 0.9.0 -utool >= 2.1.5 +ubelt >= 1.2.3 +utool >= 2.1.7 -delorean +delorean >= 1.0.0 # python ~/local/tools/supported_python_versions_pip.py delorean diff --git a/vtool_ibeis/__init__.py b/vtool_ibeis/__init__.py index 0bcf2a3f..1ffdd61e 100755 --- a/vtool_ibeis/__init__.py +++ b/vtool_ibeis/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ VTool - Computer vision tools @@ -6,8 +5,6 @@ mkinit vtool_ibeis -i """ # flake8: noqa -from __future__ import absolute_import, division, print_function - __version__ = '2.2.0' __author__ = 'Jon Crall, Avi Weinstock, Chuck Stewart, Hendrik Weideman, Jason Parham, Zackary Rutfield' __author_email__ = 'erotemic@gmail.com' diff --git a/vtool_ibeis/_old_matching.py b/vtool_ibeis/_old_matching.py deleted file mode 100644 index 59986671..00000000 --- a/vtool_ibeis/_old_matching.py +++ /dev/null @@ -1,262 +0,0 @@ -# def vsone_matching(metadata, cfgdict={}, verbose=None): -# """ -# DEPRICATE in favor of PairwiseMatch - -# Metadata is a dictionary that contains either computed information -# necessary for matching or the dependenceis of those computations. - -# Args: -# metadata (utool.LazyDict): -# cfgdict (dict): (default = {}) -# verbose (bool): verbosity flag(default = None) - -# Returns: -# tuple: (matches, metadata) -# """ -# # import vtool_ibeis as vt -# #assert isinstance(metadata, ut.LazyDict), 'type(metadata)=%r' % (type(metadata),) - -# annot1 = metadata['annot1'] -# annot2 = metadata['annot2'] - -# ensure_metadata_feats(annot1, cfgdict=cfgdict) -# ensure_metadata_feats(annot2, cfgdict=cfgdict) -# ensure_metadata_dlen_sqrd(annot2) - -# # Exceute relevant dependencies -# kpts1 = annot1['kpts'] -# vecs1 = annot1['vecs'] -# kpts2 = annot2['kpts'] -# vecs2 = annot2['vecs'] -# dlen_sqrd2 = annot2['dlen_sqrd'] -# flann1 = annot1.get('flann', None) -# flann2 = annot2.get('flann', None) - -# matches, output_metdata = vsone_feature_matching( -# kpts1, vecs1, kpts2, vecs2, dlen_sqrd2, cfgdict=cfgdict, -# flann1=flann1, flann2=flann2, verbose=verbose) -# metadata.update(output_metdata) -# match = SingleMatch(matches, metadata) -# return match - - -# def vsone_feature_matching(kpts1, vecs1, kpts2, vecs2, dlen_sqrd2, cfgdict={}, -# flann1=None, flann2=None, verbose=None): -# r""" -# DEPRICATE - -# logic for matching - -# Args: -# vecs1 (ndarray[uint8_t, ndim=2]): SIFT descriptors -# vecs2 (ndarray[uint8_t, ndim=2]): SIFT descriptors -# kpts1 (ndarray[float32_t, ndim=2]): keypoints -# kpts2 (ndarray[float32_t, ndim=2]): keypoints - -# Ignore: -# >>> from vtool_ibeis.matching import * # NOQA -# >>> ut.qtensure() -# >>> import plottool_ibeis as pt -# >>> pt.imshow(rchip1) -# >>> pt.draw_kpts2(kpts1) -# >>> pt.show_chipmatch2(rchip1, rchip2, kpts1, kpts2, fm=fm, fs=fs) -# >>> pt.show_chipmatch2(rchip1, rchip2, kpts1, kpts2, fm=fm, fs=fs) -# """ -# import vtool_ibeis as vt -# #import vtool_ibeis as vt -# sv_on = cfgdict.get('sv_on', True) -# sver_xy_thresh = cfgdict.get('sver_xy_thresh', .01) -# ratio_thresh = cfgdict.get('ratio_thresh', .625) -# refine_method = cfgdict.get('refine_method', 'homog') -# symmetric = cfgdict.get('symmetric', False) -# K = cfgdict.get('K', 1) -# Knorm = cfgdict.get('Knorm', 1) -# checks = cfgdict.get('checks', 800) -# if verbose is None: -# verbose = True - -# flann_params = {'algorithm': 'kdtree', 'trees': 8} -# if flann1 is None: -# flann1 = vt.flann_cache(vecs1, flann_params=flann_params, -# verbose=verbose) -# if symmetric: -# if flann2 is None: -# flann2 = vt.flann_cache(vecs2, flann_params=flann_params, -# verbose=verbose) -# try: -# num_neighbors = K + Knorm -# # Search for nearest neighbors -# fx2_to_fx1, fx2_to_dist = normalized_nearest_neighbors( -# flann1, vecs2, num_neighbors, checks) -# if symmetric: -# fx1_to_fx2, fx1_to_dist = normalized_nearest_neighbors( -# flann2, vecs1, K, checks) - -# if symmetric: -# valid_flags = flag_symmetric_matches(fx2_to_fx1, fx1_to_fx2, K) -# else: -# valid_flags = np.ones((len(fx2_to_fx1), K), dtype=np.bool) - -# # Assign matches -# assigntup = assign_unconstrained_matches(fx2_to_fx1, fx2_to_dist, K, -# Knorm, valid_flags) -# fm, match_dist, fx1_norm, norm_dist = assigntup -# fs = 1 - np.divide(match_dist, norm_dist) - -# fm_ORIG = fm -# fs_ORIG = fs - -# ratio_on = sv_on -# if ratio_on: -# # APPLY RATIO TEST -# fm, fs, fm_norm = ratio_test(fm_ORIG, fx1_norm, match_dist, norm_dist, -# ratio_thresh) -# fm_RAT, fs_RAT, fm_norm_RAT = (fm, fs, fm_norm) - -# if sv_on: -# fm, fs, fm_norm, H_RAT = match_spatial_verification( -# kpts1, kpts2, fm, fs, fm_norm, sver_xy_thresh, dlen_sqrd2, -# refine_method) -# fm_RAT_SV, fs_RAT_SV, fm_norm_RAT_SV = (fm, fs, fm_norm) - -# #top_percent = .5 -# #top_idx = ut.take_percentile(match_dist.T[0].argsort(), top_percent) -# #fm_TOP = fm_ORIG.take(top_idx, axis=0) -# #fs_TOP = match_dist.T[0].take(top_idx) -# #match_weights = 1 - fs_TOP -# #svtup = sver.spatially_verify_kpts(kpts1, kpts2, fm_TOP, sver_xy_thresh, -# # dlen_sqrd2, match_weights=match_weights, -# # refine_method=refine_method) -# #if svtup is not None: -# # (homog_inliers, homog_errors, H_TOP) = svtup[0:3] -# # np.sqrt(homog_errors[0] / dlen_sqrd2) -# #else: -# # H_TOP = np.eye(3) -# # homog_inliers = [] -# #fm_TOP_SV = fm_TOP.take(homog_inliers, axis=0) -# #fs_TOP_SV = fs_TOP.take(homog_inliers, axis=0) - -# matches = { -# 'ORIG' : MatchTup2(fm_ORIG, fs_ORIG), -# } -# output_metdata = {} -# if ratio_on: -# matches['RAT'] = MatchTup3(fm_RAT, fs_RAT, fm_norm_RAT) -# if sv_on: -# matches['RAT+SV'] = MatchTup3(fm_RAT_SV, fs_RAT_SV, fm_norm_RAT_SV) -# output_metdata['H_RAT'] = H_RAT -# #output_metdata['H_TOP'] = H_TOP -# #'TOP' : MatchTup2(fm_TOP, fs_TOP), -# #'TOP+SV' : MatchTup2(fm_TOP_SV, fs_TOP_SV), - -# except MatchingError: -# fm_ERR = np.empty((0, 2), dtype=np.int32) -# fs_ERR = np.empty((0, 1), dtype=np.float32) -# H_ERR = np.eye(3) -# matches = { -# 'ORIG' : MatchTup2(fm_ERR, fs_ERR), -# 'RAT' : MatchTup3(fm_ERR, fs_ERR, fm_ERR), -# 'RAT+SV' : MatchTup3(fm_ERR, fs_ERR, fm_ERR), -# #'TOP' : MatchTup2(fm_ERR, fs_ERR), -# #'TOP+SV' : MatchTup2(fm_ERR, fs_ERR), -# } -# output_metdata = { -# 'H_RAT': H_ERR, -# #'H_TOP': H_ERR, -# } - -# return matches, output_metdata - - -# def match_spatial_verification(kpts1, kpts2, fm, fs, fm_norm, sver_xy_thresh, -# dlen_sqrd2, refine_method): -# from vtool_ibeis import spatial_verification as sver -# # SPATIAL VERIFICATION FILTER -# match_weights = np.ones(len(fm)) -# svtup = sver.spatially_verify_kpts(kpts1, kpts2, fm, -# xy_thresh=sver_xy_thresh, -# ori_thresh=ori_thresh, -# dlen_sqrd2=dlen_sqrd2, -# match_weights=match_weights, -# refine_method=refine_method) -# if svtup is not None: -# (homog_inliers, homog_errors, H_RAT) = svtup[0:3] -# else: -# H_RAT = np.eye(3) -# homog_inliers = [] -# fm_SV = fm.take(homog_inliers, axis=0) -# fs_SV = fs.take(homog_inliers, axis=0) -# fm_norm_SV = fm_norm[homog_inliers] -# return fm_SV, fs_SV, fm_norm_SV, H_RAT - -# class SingleMatch(ut.NiceRepr): -# """ -# DEPRICATE in favor of PairwiseMatch -# """ - -# def __init__(self, matches, metadata): -# self.matches = matches -# self.metadata = metadata - -# def show(self, *args, **kwargs): -# from vtool_ibeis import inspect_matches -# inspect_matches.show_matching_dict( -# self.matches, self.metadata, *args, **kwargs) - -# def make_interaction(self, *args, **kwargs): -# from vtool_ibeis import inspect_matches -# return inspect_matches.make_match_interaction( -# self.matches, self.metadata, *args, **kwargs) - -# def __nice__(self): -# parts = [key + '=%d' % (len(m.fm)) for key, m in self.matches.items()] -# return ' ' + ', '.join(parts) - -# def __getstate__(self): -# state_dict = self.__dict__ -# return state_dict - -# def __setstate__(self, state_dict): -# self.__dict__.update(state_dict) - - -# def vsone_image_fpath_matching(rchip_fpath1, rchip_fpath2, cfgdict={}, metadata_=None): -# r""" -# Args: -# rchip_fpath1 (str): -# rchip_fpath2 (str): -# cfgdict (dict): (default = {}) - -# CommandLine: -# python -m vtool_ibeis --tf vsone_image_fpath_matching --show -# python -m vtool_ibeis --tf vsone_image_fpath_matching --show --helpx -# python -m vtool_ibeis --tf vsone_image_fpath_matching --show --feat-type=hesaff+siam128 -# python -m vtool_ibeis --tf vsone_image_fpath_matching --show --feat-type=hesaff+siam128 --ratio-thresh=.9 -# python -m vtool_ibeis --tf vsone_image_fpath_matching --show --feat-type=hesaff+sift --ratio-thresh=.8 -# python -m vtool_ibeis --tf vsone_image_fpath_matching --show --feat-type=hesaff+sift --ratio-thresh=.8 - -# Example: -# >>> # ENABLE_DOCTEST -# >>> from vtool_ibeis.matching import * # NOQA -# >>> import vtool_ibeis as vt -# >>> rchip_fpath1 = ut.grab_test_imgpath('easy1.png') -# >>> rchip_fpath2 = ut.grab_test_imgpath('easy2.png') -# >>> import pyhesaff -# >>> metadata_ = None -# >>> default_cfgdict = dict(feat_type='hesaff+sift', ratio_thresh=.625, -# >>> **pyhesaff.get_hesaff_default_params()) -# >>> cfgdict = ut.parse_dict_from_argv(default_cfgdict) -# >>> match = vsone_image_fpath_matching(rchip_fpath1, rchip_fpath2, cfgdict) -# >>> # xdoctest: +REQUIRES(--show) -# >>> match.show(mode=1) -# >>> ut.show_if_requested() -# """ -# metadata = ut.LazyDict() -# annot1 = metadata['annot1'] = ut.LazyDict() -# annot2 = metadata['annot2'] = ut.LazyDict() -# if metadata_ is not None: -# metadata.update(metadata_) -# annot1['rchip_fpath'] = rchip_fpath1 -# annot2['rchip_fpath'] = rchip_fpath2 -# match = vsone_matching(metadata, cfgdict) -# return match diff --git a/vtool_ibeis/_rhomb_dist.py b/vtool_ibeis/_rhomb_dist.py index e8a29dec..2e165209 100644 --- a/vtool_ibeis/_rhomb_dist.py +++ b/vtool_ibeis/_rhomb_dist.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import, division, print_function, unicode_literals import numpy as np import collections diff --git a/vtool_ibeis/blend.py b/vtool_ibeis/blend.py index 67704e93..aa8a1401 100644 --- a/vtool_ibeis/blend.py +++ b/vtool_ibeis/blend.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- -# LICENCE: Apache2 -from __future__ import absolute_import, division, print_function -from six.moves import zip, map, range # NOQA import numpy as np import utool as ut import ubelt as ub diff --git a/vtool_ibeis/chip.py b/vtool_ibeis/chip.py index 189fa384..cb85c8af 100755 --- a/vtool_ibeis/chip.py +++ b/vtool_ibeis/chip.py @@ -1,5 +1,3 @@ -# LICENCE -from __future__ import absolute_import, division, print_function import numpy as np import numpy.linalg as npl from vtool_ibeis import linalg as ltool @@ -7,10 +5,9 @@ import utool as ut try: import cv2 -except ImportError as ex: +except ImportError: print('ERROR: import cv2 is failing!') - cv2 = ut.DynStruct() - cv2.INTER_LANCZOS4 = None + raise def get_image_to_chip_transform(bbox, chipsz, theta): diff --git a/vtool_ibeis/clustering2.py b/vtool_ibeis/clustering2.py index efe58282..43f3be9d 100755 --- a/vtool_ibeis/clustering2.py +++ b/vtool_ibeis/clustering2.py @@ -1,12 +1,8 @@ -# -*- coding: utf-8 -*- -# LICENCE """ TODO: Does HDBSCAN work on 128 dim vectors? http://nbviewer.jupyter.org/github/lmcinnes/hdbscan/blob/master/notebooks/Comparing%20Clustering%20Algorithms.ipynb """ -from __future__ import absolute_import, division, print_function, unicode_literals -from six.moves import zip, map # NOQA import ubelt as ub import numpy as np import utool as ut diff --git a/vtool_ibeis/confusion.py b/vtool_ibeis/confusion.py index 0193ec65..8cb38640 100644 --- a/vtool_ibeis/confusion.py +++ b/vtool_ibeis/confusion.py @@ -1,11 +1,9 @@ -# -*- coding: utf-8 -*- """ Module for -- Confusion matrix, contingency, error matrix, References: http://en.wikipedia.org/wiki/Confusion_matrix """ -from __future__ import absolute_import, division, print_function import utool as ut import ubelt as ub import numpy as np diff --git a/vtool_ibeis/coverage_grid.py b/vtool_ibeis/coverage_grid.py index 986d5ab3..04556573 100644 --- a/vtool_ibeis/coverage_grid.py +++ b/vtool_ibeis/coverage_grid.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import, division, print_function, unicode_literals -from six.moves import zip, range, map # NOQA import numpy as np import utool as ut import ubelt as ub diff --git a/vtool_ibeis/coverage_kpts.py b/vtool_ibeis/coverage_kpts.py index 06857c24..96691551 100755 --- a/vtool_ibeis/coverage_kpts.py +++ b/vtool_ibeis/coverage_kpts.py @@ -1,6 +1,4 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import, division, print_function, unicode_literals -from six.moves import zip, range, map, reduce # NOQA +from functools import reduce import cv2 import numpy as np import utool as ut diff --git a/vtool_ibeis/demodata.py b/vtool_ibeis/demodata.py index 6a69d015..7329742b 100755 --- a/vtool_ibeis/demodata.py +++ b/vtool_ibeis/demodata.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import, division, print_function, unicode_literals from vtool_ibeis import keypoint as ktool import vtool_ibeis.util_math as mtool import numpy as np diff --git a/vtool_ibeis/distance.py b/vtool_ibeis/distance.py index 0810e44d..e2b48c76 100644 --- a/vtool_ibeis/distance.py +++ b/vtool_ibeis/distance.py @@ -1,10 +1,6 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import, division, print_function, unicode_literals import numpy as np -import utool as ut import ubelt as ub import itertools -from six.moves import range, zip from collections import OrderedDict import scipy.spatial.distance as spdist from .util_math import TAU @@ -129,8 +125,8 @@ def func_orig(): func_orig() ''' >>> ).split('\n') - >>> ut.util_dev.rrr() - >>> ut.util_dev.timeit_compare(stmt_list, setup, int(1E3)) + >>> # ut.util_dev.rrr() + >>> # ut.util_dev.timeit_compare(stmt_list, setup, int(1E3)) CommandLine: python -m vtool_ibeis.distance --test-ori_distance @@ -258,7 +254,7 @@ def L2_sqrd(hist1, hist2, dtype=TEMP_VEC_DTYPE): >>> # ENABLE_DOCTEST >>> from vtool_ibeis.distance import * # NOQA >>> import numpy - >>> ut.exec_funckw(L2_sqrd, globals()) + >>> #ut.exec_funckw(L2_sqrd, globals()) >>> rng = np.random.RandomState(53) >>> hist1 = rng.rand(5, 2) >>> hist2 = rng.rand(5, 2) @@ -634,7 +630,6 @@ def nearest_point(x, y, pts, conflict_mode='next', __next_counter=[0]): TODO: depricate """ - #with ut.embed_on_exception_context: dists = (pts.T[0] - x) ** 2 + (pts.T[1] - y) ** 2 fx = dists.argmin() mindist = dists[fx] @@ -713,7 +708,7 @@ def haversine(latlon1, latlon2): >>> dist_vector_list = list(map(haversin_pdist, gpsarr_track_list_)) >>> dist_matrix_list = list(map(spdist.squareform, dist_vector_list)) >>> #xdoctest: +IGNORE_WHITESPACE - >>> result = ('dist_matrix_list = %s' % (ut.repr3(dist_matrix_list, precision=2, with_dtype=True),)) + >>> result = ('dist_matrix_list = %s' % (ub.repr2(dist_matrix_list, precision=2, with_dtype=True),)) >>> print(result) """ # FIXME; lat, lon should be different columns not different rows @@ -787,10 +782,10 @@ def pdist_argsort(x): sortx_2d = [(r, c) for r, c in zip(sortx_row, sortx_col) if (c > r)] else: num_rows = len(x) // 2 - compare_idxs = ut.flatten([[(r, c) for c in range(r + 1, num_rows)] - for r in range(num_rows)]) + compare_idxs = list(ub.flatten([[(r, c) for c in range(r + 1, num_rows)] + for r in range(num_rows)])) sortx = x.argsort() - sortx_2d = ut.take(compare_idxs, sortx) + sortx_2d = list(ub.take(compare_idxs, sortx)) return sortx_2d diff --git a/vtool_ibeis/ellipse.py b/vtool_ibeis/ellipse.py index bc9b2c37..0b24c444 100755 --- a/vtool_ibeis/ellipse.py +++ b/vtool_ibeis/ellipse.py @@ -3,20 +3,17 @@ This module should handle all things elliptical """ -from __future__ import absolute_import, division, print_function -from six.moves import zip, range # from numpy.core.umath_tests import matrix_multiply import operator as op import scipy.signal as spsignal import numpy as np from vtool_ibeis import keypoint as ktool from vtool_ibeis import image as gtool -import utool as ut try: import cv2 except ImportError: print('ERROR: import cv2 is failing!') - cv2 = ut.DynStruct() + cv2 = object() def adaptive_scale(img_fpath, kpts, nScales=4, low=-.5, high=.5, nSamples=16): diff --git a/vtool_ibeis/exif.py b/vtool_ibeis/exif.py index f3565081..8015b560 100755 --- a/vtool_ibeis/exif.py +++ b/vtool_ibeis/exif.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- -# LICENCE """ References: http://www.exiv2.org/tags.html @@ -7,9 +5,6 @@ TODO: https://github.com/recurser/exif-orientation-examples """ -from __future__ import absolute_import, division, print_function -from six.moves import zip, range -import six from PIL.ExifTags import TAGS, GPSTAGS import PIL.ExifTags # NOQA from PIL import Image @@ -20,8 +15,8 @@ # Inverse of PIL.ExifTags.TAGS -EXIF_TAG_TO_TAGID = {val: key for (key, val) in six.iteritems(TAGS)} -GPS_TAG_TO_GPSID = {val: key for (key, val) in six.iteritems(GPSTAGS)} +EXIF_TAG_TO_TAGID = {val: key for (key, val) in TAGS.items()} +GPS_TAG_TO_GPSID = {val: key for (key, val) in GPSTAGS.items()} # Relevant EXIF Tags #'GPSInfo': 34853 diff --git a/vtool_ibeis/features.py b/vtool_ibeis/features.py index d1c8464f..e6067c0e 100755 --- a/vtool_ibeis/features.py +++ b/vtool_ibeis/features.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import, print_function, division import utool as ut import ubelt as ub import six diff --git a/vtool_ibeis/fontdemo.py b/vtool_ibeis/fontdemo.py index 97890e90..2b6f32fc 100644 --- a/vtool_ibeis/fontdemo.py +++ b/vtool_ibeis/fontdemo.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- # Needs freetype-py>=1.0 # The MIT License (MIT) # @@ -27,7 +25,6 @@ https://dbader.org/blog/monochrome-font-rendering-with-freetype-and-python https://gist.github.com/dbader/5488053#file-fontdemo-py-L244 """ -from __future__ import absolute_import, division, print_function, unicode_literals class Bitmap(object): diff --git a/vtool_ibeis/geometry.py b/vtool_ibeis/geometry.py index d5e74f79..bd011c9c 100755 --- a/vtool_ibeis/geometry.py +++ b/vtool_ibeis/geometry.py @@ -1,10 +1,6 @@ -# -*- coding: utf-8 -*- -# LICENCE -from __future__ import absolute_import, division, print_function, unicode_literals -from six.moves import zip import numpy as np import utool as ut -import ubelt as ub +import ubelt as ub # NOQA import cv2 diff --git a/vtool_ibeis/histogram.py b/vtool_ibeis/histogram.py index 2f33e8e3..2c5b600d 100755 --- a/vtool_ibeis/histogram.py +++ b/vtool_ibeis/histogram.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import, division, print_function, unicode_literals -from six.moves import zip import warnings import scipy.signal import numpy as np diff --git a/vtool_ibeis/image.py b/vtool_ibeis/image.py index d1a43dac..57341543 100755 --- a/vtool_ibeis/image.py +++ b/vtool_ibeis/image.py @@ -1,11 +1,7 @@ -# -*- coding: utf-8 -*- -# LICENCE -from __future__ import absolute_import, division, print_function, unicode_literals import six import os from os.path import exists, join # NOQA from os.path import splitext -from six.moves import zip, map, range # NOQA import numpy as np from PIL import Image import cv2 diff --git a/vtool_ibeis/image_filters.py b/vtool_ibeis/image_filters.py index 574d580f..d9da556f 100755 --- a/vtool_ibeis/image_filters.py +++ b/vtool_ibeis/image_filters.py @@ -1,9 +1,6 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import, division, print_function -from six.moves import range import numpy as np -import utool as ut -import ubelt as ub +import utool as ut # NOQA +import ubelt as ub # NOQA import cv2 diff --git a/vtool_ibeis/image_shared.py b/vtool_ibeis/image_shared.py index 018e8016..4a3769d1 100755 --- a/vtool_ibeis/image_shared.py +++ b/vtool_ibeis/image_shared.py @@ -1,7 +1,4 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import, division, print_function, unicode_literals from PIL import Image -import cv2 import utool as ut diff --git a/vtool_ibeis/inspect_matches.py b/vtool_ibeis/inspect_matches.py index fc279e71..89894a2e 100644 --- a/vtool_ibeis/inspect_matches.py +++ b/vtool_ibeis/inspect_matches.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import, division, print_function import utool as ut import ubelt as ub try: diff --git a/vtool_ibeis/linalg.py b/vtool_ibeis/linalg.py index cf8848fb..500e893c 100755 --- a/vtool_ibeis/linalg.py +++ b/vtool_ibeis/linalg.py @@ -33,7 +33,6 @@ # >>> print(xdev.align('\\\\\n'.join(sympy.latex(R).split(r'\\')).replace('{matrix}', '{matrix}\n'), '&') """ -from __future__ import absolute_import, division, print_function import cv2 import numpy as np import numpy.linalg as npl diff --git a/vtool_ibeis/matching.py b/vtool_ibeis/matching.py index 3ce9efa4..6311b315 100644 --- a/vtool_ibeis/matching.py +++ b/vtool_ibeis/matching.py @@ -1,10 +1,8 @@ -# -*- coding: utf-8 -*- """ vt python -m utool.util_inspect check_module_usage --pat="matching.py" """ -from __future__ import absolute_import, division, print_function from vtool_ibeis import _rhomb_dist import six import warnings diff --git a/vtool_ibeis/nearest_neighbors.py b/vtool_ibeis/nearest_neighbors.py index 0d0cadd2..7c74a609 100755 --- a/vtool_ibeis/nearest_neighbors.py +++ b/vtool_ibeis/nearest_neighbors.py @@ -3,7 +3,6 @@ python -c "import vtool_ibeis, doctest; print(doctest.testmod(vtool_ibeis.nearest_neighbors))" """ -from __future__ import absolute_import, division, print_function from os.path import exists, normpath, join import utool as ut import ubelt as ub diff --git a/vtool_ibeis/numpy_utils.py b/vtool_ibeis/numpy_utils.py index 687dec7b..f2090dfc 100644 --- a/vtool_ibeis/numpy_utils.py +++ b/vtool_ibeis/numpy_utils.py @@ -1,13 +1,9 @@ -# -*- coding: utf-8 -* """ These functions might be PR quality for numpy. """ -from __future__ import absolute_import, division, print_function, unicode_literals import numpy as np -import utool as ut -import ubelt as ub -from six import next -from six.moves import zip, range +import utool as ut # NOQA +import ubelt as ub # NOQA def atleast_nd(arr, n, tofront=False): diff --git a/vtool_ibeis/other.py b/vtool_ibeis/other.py index 1739c862..f08df426 100644 --- a/vtool_ibeis/other.py +++ b/vtool_ibeis/other.py @@ -1,11 +1,7 @@ -# -*- coding: utf-8 -* -from __future__ import absolute_import, division, print_function, unicode_literals import numpy as np import utool as ut import ubelt as ub import functools # NOQA -from six import next -from six.moves import zip, range def safe_vstack(tup, default_shape=(0,), default_dtype=float): diff --git a/vtool_ibeis/patch.py b/vtool_ibeis/patch.py index 4d9d41f6..0f434cc8 100755 --- a/vtool_ibeis/patch.py +++ b/vtool_ibeis/patch.py @@ -1,8 +1,3 @@ -# -*- coding: utf-8 -*- -# LICENCE -from __future__ import absolute_import, division, print_function, unicode_literals -import six # NOQA -from six.moves import zip import numpy as np from vtool_ibeis import histogram as htool from vtool_ibeis import keypoint as ktool @@ -1075,7 +1070,6 @@ def draw_kp_ori_steps(): # build test data import utool as ut import plottool_ibeis as pt - from six.moves import input import vtool_ibeis as vt if True: @@ -1127,12 +1121,6 @@ def exec_internals_find_patch_dominant_orientations(patch, bins, maxima_thresh, internal_tup = ut.exec_func_src(find_patch_dominant_orientations, globals_, locals_, key_list=keys, update=True) submax_ori_offsets = globals_['submax_ori_offsets'] new_oris = (old_ori + (submax_ori_offsets - ktool.GRAVITY_THETA)) % TAU - # sourcecode = ut.get_func_sourcecode(find_patch_dominant_orientations, stripdef=True, stripret=True) - # six.exec_(sourcecode, globals_, locals_) - # submax_ori_offsets = locals_['submax_ori_offsets'] - # new_oris = (old_ori + (submax_ori_offsets - ktool.GRAVITY_THETA)) % TAU - # keys = 'patch, gradx, grady, gmag, gori, hist, centers, gori_weights'.split(', ') - # internal_tup = ut.dict_take(locals_, keys) return new_oris, internal_tup # diff --git a/vtool_ibeis/quality_classifier.py b/vtool_ibeis/quality_classifier.py index 58bd8221..c12419d5 100644 --- a/vtool_ibeis/quality_classifier.py +++ b/vtool_ibeis/quality_classifier.py @@ -4,7 +4,6 @@ % Single-image noise level estimation for blind denoising. % http://www.ok.ctrl.titech.ac.jp/res/NLE/TIP2013-noise-level-estimation06607209.pdfhttp://www.ok.ctrl.titech.ac.jp/res/NLE/TIP2013-noise-level-estimation06607209.pdf """ -from __future__ import absolute_import, division, print_function, unicode_literals import utool as ut import ubelt as ub import numpy as np diff --git a/vtool_ibeis/score_normalization.py b/vtool_ibeis/score_normalization.py index ab440bce..5bc1aecb 100644 --- a/vtool_ibeis/score_normalization.py +++ b/vtool_ibeis/score_normalization.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import, division, print_function, unicode_literals import numpy as np import utool as ut import ubelt as ub diff --git a/vtool_ibeis/segmentation.py b/vtool_ibeis/segmentation.py index 1c6bcccb..996ab6ef 100755 --- a/vtool_ibeis/segmentation.py +++ b/vtool_ibeis/segmentation.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, division, print_function -from six.moves import range, zip # NOQA import numpy as np import cv2 import utool as ut diff --git a/vtool_ibeis/symbolic.py b/vtool_ibeis/symbolic.py index 3be215c6..63ce48b2 100644 --- a/vtool_ibeis/symbolic.py +++ b/vtool_ibeis/symbolic.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -*- """ Sympy helpers """ -from __future__ import absolute_import, division, print_function import numpy as np import six import utool as ut diff --git a/vtool_ibeis/trig.py b/vtool_ibeis/trig.py index f3c3fe26..3281a4a8 100755 --- a/vtool_ibeis/trig.py +++ b/vtool_ibeis/trig.py @@ -1,5 +1,4 @@ # LICENCE -from __future__ import absolute_import, division, print_function import numpy as np from .util_math import TAU diff --git a/vtool_ibeis/util_math.py b/vtool_ibeis/util_math.py index d58b4ad1..d5526140 100755 --- a/vtool_ibeis/util_math.py +++ b/vtool_ibeis/util_math.py @@ -1,14 +1,11 @@ -# -*- coding: utf-8 -*- """ # LICENCE Apache 2 or whatever FIXME: monotization functions need more hueristics """ -from __future__ import absolute_import, division, print_function, unicode_literals import numpy as np -import utool as ut -import ubelt as ub -from six.moves import range, zip +import utool as ut # NOQA +import ubelt as ub # NOQA TAU = np.pi * 2 # References: tauday.com @@ -484,7 +481,7 @@ def test_language_modulus(): http://en.wikipedia.org/wiki/Modulo_operation """ import math - import utool as ut + import utool as ut # NOQA TAU = math.pi * 2 num_list = [-8, -1, 0, 1, 2, 6, 7, 29] modop_result_list = [] From ad00e0b6ac20572553e7baf7913ef625d8a1315c Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 29 Jan 2023 01:01:11 -0500 Subject: [PATCH 02/23] wip --- vtool_ibeis/exif.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vtool_ibeis/exif.py b/vtool_ibeis/exif.py index 8015b560..d0f914d8 100755 --- a/vtool_ibeis/exif.py +++ b/vtool_ibeis/exif.py @@ -110,7 +110,7 @@ def get_exif_dict2(pil_img): def make_exif_dict_human_readable(exif_dict): exif_dict2 = {TAGS.get(key, key): val - for (key, val) in six.iteritems(exif_dict)} + for (key, val) in exif_dict.items()} return exif_dict2 @@ -118,7 +118,7 @@ def check_exif_keys(pil_img): info_ = pil_img._getexif() valid_keys = [] invalid_keys = [] - for key, val in six.iteritems(info_): + for key, val in info_.items(): try: exif_keyval = TAGS[key] valid_keys.append((key, exif_keyval)) @@ -132,7 +132,7 @@ def read_all_exif_tags(pil_img): info_ = pil_img._getexif() exif = {} if info_ is None else { TAGS.get(key, key): val - for key, val in six.iteritems(info_) + for key, val in info_.items() } return exif From 3b6d3d8dbe7f49629033e75eff6ba0cc64ec64ef Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 29 Jan 2023 01:03:14 -0500 Subject: [PATCH 03/23] wip --- CHANGELOG.md | 10 ++++++++++ dev/unstable/nn.py | 2 +- vtool_ibeis/clustering2.py | 8 ++++---- vtool_ibeis/confusion.py | 2 +- vtool_ibeis/demodata.py | 4 ++-- vtool_ibeis/distance.py | 4 ++-- vtool_ibeis/ellipse.py | 2 +- vtool_ibeis/geometry.py | 8 ++++---- vtool_ibeis/histogram.py | 10 +++++----- vtool_ibeis/image.py | 12 ++++++------ vtool_ibeis/image_filters.py | 4 ++-- vtool_ibeis/matching.py | 12 ++++++------ vtool_ibeis/nearest_neighbors.py | 4 ++-- vtool_ibeis/numpy_utils.py | 8 ++++---- vtool_ibeis/other.py | 14 +++++++------- vtool_ibeis/patch.py | 4 ++-- vtool_ibeis/score_normalization.py | 6 +++--- vtool_ibeis/segmentation.py | 12 ++++++------ vtool_ibeis/spatial_verification.py | 2 +- 19 files changed, 69 insertions(+), 59 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eaf17023..9fddf2b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ We are currently working on porting this changelog to the specifications in [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +### [Version 2.2.1] + +### Fixed: +* numpy bool / int / float issue + + +### Changed +* removed Python2 cruft + + ## [Version 2.2.0] ### Added diff --git a/dev/unstable/nn.py b/dev/unstable/nn.py index d30884f9..1356aecf 100644 --- a/dev/unstable/nn.py +++ b/dev/unstable/nn.py @@ -436,7 +436,7 @@ def akmeans_plusplus_init(data, K, num_samples=None, flann_params=None, # # # Create a mask denoting all unused elements # # num_unused = len(data) # # num_used = 0 - # # is_unused = np.ones(len(data), dtype=np.bool) + # # is_unused = np.ones(len(data), dtype=bool) # # unused_didxs = list(range(len(data))) # # used_didxs = [] diff --git a/vtool_ibeis/clustering2.py b/vtool_ibeis/clustering2.py index 43f3be9d..4e61b709 100755 --- a/vtool_ibeis/clustering2.py +++ b/vtool_ibeis/clustering2.py @@ -167,7 +167,7 @@ def group_indices(idx2_groupid, assume_sorted=False): >>> (keys, groupxs) = group_indices(idx2_groupid) >>> result = ut.repr2((keys, groupxs), nl=2, nobr=True, with_dtype=True) >>> print(result) - np.array([False, True], dtype=np.bool), + np.array([False, True], dtype=bool), [ np.array([2, 4, 5], dtype=np.int64), np.array([0, 1, 3, 6], dtype=np.int64), @@ -289,10 +289,10 @@ def find_duplicate_items(item_arr): sortx = item_arr.argsort() groupids_sorted = item_arr.take(sortx) - #duplicate_idxs = np.flatnonzero(~np.diff(groupids_sorted).astype(np.bool)) + #duplicate_idxs = np.flatnonzero(~np.diff(groupids_sorted).astype(bool)) diff = np.diff(groupids_sorted) - #notdiff = np.bitwise_not(diff.astype(np.bool)) - edges = np.flatnonzero(diff.astype(np.bool)) + 1 + #notdiff = np.bitwise_not(diff.astype(bool)) + edges = np.flatnonzero(diff.astype(bool)) + 1 duplicate_items = [group[0] for group in np.split(groupids_sorted, edges) if group.shape[0] > 1] #duplicate_items = groupids_sorted.take(duplicate_idxs) diff --git a/vtool_ibeis/confusion.py b/vtool_ibeis/confusion.py index 8cb38640..f53529ed 100644 --- a/vtool_ibeis/confusion.py +++ b/vtool_ibeis/confusion.py @@ -371,7 +371,7 @@ def fit(self, scores, labels, verbose=False): scores = np.asarray(scores) labels = np.asarray(labels) # must be binary - labels = labels.astype(np.bool) + labels = labels.astype(bool) if verbose: print('[confusion] building confusion metrics.') print('[confusion] * scores.shape=%r, scores.dtype=%r' % diff --git a/vtool_ibeis/demodata.py b/vtool_ibeis/demodata.py index 7329742b..5145f97c 100755 --- a/vtool_ibeis/demodata.py +++ b/vtool_ibeis/demodata.py @@ -312,7 +312,7 @@ def testdata_binary_scores(): -0.6 , 5.76, -0.79, 13.99, 9.82, 30.6 , -1.13, -2.05, 21.3 , -1.87, 17.61, -1.25, 8.64, -2.06, 4.48, 19.48, -0.64, 15.85, 4.54, -1.57, -1.28, 12.3 , -1.39, -0.04, 12.81, -0.09, 4.83, - 6.42, 4.26, 7.65, -0.43, -0.23, -1.98], dtype=np.float) + 6.42, 4.26, 7.65, -0.43, -0.23, -1.98], dtype=float) y = np.array([ 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, @@ -356,7 +356,7 @@ def testdata_binary_scores(): 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, - 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1], dtype=np.bool) + 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1], dtype=bool) return X, y diff --git a/vtool_ibeis/distance.py b/vtool_ibeis/distance.py index e2b48c76..9e6af397 100644 --- a/vtool_ibeis/distance.py +++ b/vtool_ibeis/distance.py @@ -618,10 +618,10 @@ def emd(hist1, hist2, cost_matrix='sift'): if len(hist1.shape) == 2: dist = np.array([ - pyemd.emd(hist1_.astype(np.float), hist2_.astype(np.float), cost_matrix) + pyemd.emd(hist1_.astype(float), hist2_.astype(float), cost_matrix) for hist1_, hist2_ in zip(hist1, hist2)]) else: - dist = pyemd.emd(hist1.astype(np.float), hist2.astype(np.float), cost_matrix) + dist = pyemd.emd(hist1.astype(float), hist2.astype(float), cost_matrix) return dist diff --git a/vtool_ibeis/ellipse.py b/vtool_ibeis/ellipse.py index 0b24c444..36167809 100755 --- a/vtool_ibeis/ellipse.py +++ b/vtool_ibeis/ellipse.py @@ -57,7 +57,7 @@ def check_kpts_in_bounds(kpts_, width, height): minx = np.array([pts[0].min() for pts in bbox_pts]) > 0 maxy = np.array([pts[1].max() for pts in bbox_pts]) < height miny = np.array([pts[1].min() for pts in bbox_pts]) > 0 - isvalid = np.array(maxx * minx * maxy * miny, dtype=np.bool) + isvalid = np.array(maxx * minx * maxy * miny, dtype=bool) return isvalid diff --git a/vtool_ibeis/geometry.py b/vtool_ibeis/geometry.py index bd011c9c..b7a7bdf1 100755 --- a/vtool_ibeis/geometry.py +++ b/vtool_ibeis/geometry.py @@ -201,7 +201,7 @@ def closest_point_on_line_segment(p, e1, e2): >>> # ENABLE_DOCTEST >>> from vtool_ibeis.geometry import * # NOQA >>> import vtool_ibeis as vt - >>> #bbox = np.array([10, 10, 10, 10], dtype=np.float) + >>> #bbox = np.array([10, 10, 10, 10], dtype=float) >>> #verts_ = np.array(vt.verts_from_bbox(bbox, close=True)) >>> #R = vt.rotation_around_bbox_mat3x3(vt.TAU / 3, bbox) >>> #verts = vt.transform_points_with_homography(R, verts_.T).T @@ -321,8 +321,8 @@ def closest_point_on_bbox(p, bbox): Example1: >>> # ENABLE_DOCTEST >>> from vtool_ibeis.geometry import * # NOQA - >>> p_list = np.array([[19, 7], [7, 14], [14, 11], [8, 7], [23, 21]], dtype=np.float) - >>> bbox = np.array([10, 10, 10, 10], dtype=np.float) + >>> p_list = np.array([[19, 7], [7, 14], [14, 11], [8, 7], [23, 21]], dtype=float) + >>> bbox = np.array([10, 10, 10, 10], dtype=float) >>> [closest_point_on_bbox(p, bbox) for p in p_list] """ import vtool_ibeis as vt @@ -553,7 +553,7 @@ def point_inside_bbox(point, bbox): >>> ]).T >>> bbox = (3, 2, 5, 7) >>> flag = point_inside_bbox(point, bbox) - >>> flag = flag.astype(np.int) + >>> flag = flag.astype(int) >>> result = ('flag = %s' % (ub.repr2(flag),)) >>> print(result) >>> # xdoctest: +REQUIRES(--show) diff --git a/vtool_ibeis/histogram.py b/vtool_ibeis/histogram.py index 2c5b600d..9158fcaf 100755 --- a/vtool_ibeis/histogram.py +++ b/vtool_ibeis/histogram.py @@ -238,7 +238,7 @@ def argsubextrema2(op, ydata, xdata=None, thresh_factor=None, normalize_x=True, if thresh_factor is None: thresh_value = None - flags = np.ones(len(ydata), dtype=np.bool) + flags = np.ones(len(ydata), dtype=bool) else: # Find relative and flat extrema thresh_value = factor_op(abs_extreme_y, thresh_factor) @@ -317,7 +317,7 @@ def argsubextrema2(op, ydata, xdata=None, thresh_factor=None, normalize_x=True, # Any non-flat mid extrema can be sublocalized other_argextrema = np.hstack([boundary_argextrema, flat_argextrema]) - other_argextrema = other_argextrema.astype(np.int) + other_argextrema = other_argextrema.astype(int) other_subextrema_y = ydata[other_argextrema] if xdata is None: other_subextrema_x = other_argextrema @@ -393,8 +393,8 @@ def linear_interpolation(arr, subindices): >>> assert np.allclose(subindices, subvalues) >>> assert np.allclose(2.3, linear_interpolation(arr, 2.3)) """ - idx1 = np.floor(subindices).astype(np.int) - idx2 = np.floor(subindices + 1).astype(np.int) + idx1 = np.floor(subindices).astype(int) + idx2 = np.floor(subindices + 1).astype(int) idx2 = np.minimum(idx2, len(arr) - 1) alpha = idx2 - subindices subvalues = arr[idx1] * (alpha) + arr[idx2] * (1 - alpha) @@ -466,7 +466,7 @@ def hist_argmaxima2(hist, maxima_thresh=.8): # FIXME: Not handling general cases # [0] index because argrelmaxima returns a tuple if len(hist) == 0: - return np.empty(dtype=np.int) + return np.empty(dtype=int) comperetor = np.greater argmaxima_ = scipy.signal.argrelextrema(hist, comperetor)[0] if len(argmaxima_) == 0: diff --git a/vtool_ibeis/image.py b/vtool_ibeis/image.py index 57341543..b77ecf45 100755 --- a/vtool_ibeis/image.py +++ b/vtool_ibeis/image.py @@ -173,11 +173,11 @@ def montage(img_list, dsize, rng=np.random, method='random', return_debug=False) if use_placement_prob: # TODO: place images in places that other images have not been placed yet - place_img = np.ones(shape[0:2], dtype=np.float) + place_img = np.ones(shape[0:2], dtype=float) #place_img[ #place_img = vt.gaussian_patch(shape[0:2], np.array(shape[0:2]) * .1) #place_img = vt.gaussian_patch(shape[0:2], np.array(shape[0:2]) * .3) - temp_img = np.ones(shape[0:2], dtype=np.float) + temp_img = np.ones(shape[0:2], dtype=float) # Enumerate valid 2d locations xy_locs_ = np.meshgrid(np.arange(place_img.shape[1]), np.arange(place_img.shape[0])) @@ -1592,16 +1592,16 @@ def embed_in_square_image(img, target_size, img_origin=(.5, .5), ## Find start slice in the target image target_diff = np.floor(target_origin_abs - img_origin_abs) - target_rc_start = np.maximum(target_diff, 0).astype(np.int) + target_rc_start = np.maximum(target_diff, 0).astype(int) - img_rc_start = (-(target_diff - target_rc_start)).astype(np.int) + img_rc_start = (-(target_diff - target_rc_start)).astype(int) img_clip_rc_low = img_rc - img_rc_start end_hang = np.maximum((target_rc_start + img_clip_rc_low) - target_rc, 0) img_clip_rc = img_clip_rc_low - end_hang - img_rc_end = (img_rc_start + img_clip_rc).astype(np.int) - target_rc_end = (target_rc_start + img_clip_rc).astype(np.int) + img_rc_end = (img_rc_start + img_clip_rc).astype(int) + target_rc_end = (target_rc_start + img_clip_rc).astype(int) img_rc_slice = [slice(b, e) for (b, e) in zip(img_rc_start, img_rc_end)] target_rc_slice = [slice(b, e) for (b, e) in zip(target_rc_start, target_rc_end)] diff --git a/vtool_ibeis/image_filters.py b/vtool_ibeis/image_filters.py index d9da556f..f7f2f863 100755 --- a/vtool_ibeis/image_filters.py +++ b/vtool_ibeis/image_filters.py @@ -189,10 +189,10 @@ def grabcut_fn(chipBGR): chip_mask = np.where(is_forground, 255, 0).astype('uint8') # Crop chip_mask = clean_mask(chip_mask) - chip_mask = np.array(chip_mask, np.float) / 255.0 + chip_mask = np.array(chip_mask, float) / 255.0 # Mask value component of HSV space chipHSV = cv2.cvtColor(chipRGB, cv2.COLOR_RGB2HSV) - chipHSV = np.array(chipHSV, dtype=np.float) / 255.0 + chipHSV = np.array(chipHSV, dtype=float) / 255.0 chipHSV[:, :, 2] *= chip_mask chipHSV = np.array(np.round(chipHSV * 255.0), dtype=np.uint8) seg_chipBGR = cv2.cvtColor(chipHSV, cv2.COLOR_HSV2BGR) diff --git a/vtool_ibeis/matching.py b/vtool_ibeis/matching.py index 6311b315..943d4b51 100644 --- a/vtool_ibeis/matching.py +++ b/vtool_ibeis/matching.py @@ -574,7 +574,7 @@ def _run_sver(kpts1, kpts2, fm, match_weights, **sver_kw): ori_err = np.full(n_fm, fill_value=np.inf) agg_errors = (xy_err, scale_err, ori_err) - agg_inlier_flags = np.zeros(n_fm, dtype=np.bool) + agg_inlier_flags = np.zeros(n_fm, dtype=bool) agg_H_12 = None prev_best = 50 @@ -1634,7 +1634,7 @@ def asymmetric_correspondence(annot1, annot2, K, Knorm, checks, allow_shrink=Tru fx2_to_fx1, fx2_to_dist = normalized_nearest_neighbors( annot1['flann'], annot2['vecs'], num_neighbors, checks) - fx2_to_flags = np.ones((len(fx2_to_fx1), K), dtype=np.bool) + fx2_to_flags = np.ones((len(fx2_to_fx1), K), dtype=bool) # Assign correspondences assigntup = assign_unconstrained_matches(fx2_to_fx1, fx2_to_dist, K, Knorm, fx2_to_flags) @@ -1704,8 +1704,8 @@ def assign_symmetric_matches(fx2_to_fx1, fx2_to_dist, fx1_to_fx2, fx1_to_dist, fx12.columns.name = 'K' fx12.index.name = 'fx2' - fx12 = fx12.T[0:K].T.astype(np.float) - fx21 = fx21.T[0:K].T.astype(np.float) + fx12 = fx12.T[0:K].T.astype(float) + fx21 = fx21.T[0:K].T.astype(float) fx12.values[~fx1_to_flags] = np.nan fx21.values[~fx2_to_flags] = np.nan @@ -1865,7 +1865,7 @@ def assign_unconstrained_matches(fx2_to_fx1, fx2_to_dist, K, Knorm=None, # make everything valid flat_validx = np.arange(len(fx2_to_fx1) * K, dtype=index_dtype) else: - #fx2_to_flags = np.ones((len(fx2_to_fx1), K), dtype=np.bool) + #fx2_to_flags = np.ones((len(fx2_to_fx1), K), dtype=bool) flat_validx = np.flatnonzero(fx2_to_flags) match_fx2 = np.floor_divide(flat_validx, K, dtype=index_dtype) @@ -1910,7 +1910,7 @@ def flag_sym_slow(fx1_to_fx2, fx2_to_fx1, K): fx2_m = fx1_to_fx2[fx1, :K] # Find img2 features that have fx1 in their top K reverse_m = fx2_to_fx1[fx2_m, :K] - is_recip = (reverse_m == fx1).sum(axis=1).astype(np.bool) + is_recip = (reverse_m == fx1).sum(axis=1).astype(bool) fx1_to_flags.append(is_recip) fx1_to_flags = np.array(fx1_to_flags) return fx1_to_flags diff --git a/vtool_ibeis/nearest_neighbors.py b/vtool_ibeis/nearest_neighbors.py index 7c74a609..ec982a32 100755 --- a/vtool_ibeis/nearest_neighbors.py +++ b/vtool_ibeis/nearest_neighbors.py @@ -38,8 +38,8 @@ def build_index(self, dvecs, **kwargs): def nn_index(self, qvecs, num_neighbs, checks=None): if checks is None: checks = self.params['checks'] - idxs = np.empty((len(qvecs), num_neighbs), dtype=np.int) - dists = np.empty((len(qvecs), num_neighbs), dtype=np.float) + idxs = np.empty((len(qvecs), num_neighbs), dtype=int) + dists = np.empty((len(qvecs), num_neighbs), dtype=float) for i, qvec in enumerate(qvecs): idxs[i], dists[i] = self.ann.get_nns_by_vector( qvec, n=num_neighbs, search_k=checks, include_distances=True) diff --git a/vtool_ibeis/numpy_utils.py b/vtool_ibeis/numpy_utils.py index f2090dfc..bfc3099b 100644 --- a/vtool_ibeis/numpy_utils.py +++ b/vtool_ibeis/numpy_utils.py @@ -117,7 +117,7 @@ def fromiter_nd(iter_, shape, dtype): Example: >>> # ENABLE_DOCTEST >>> from vtool_ibeis.numpy_utils import * # NOQA - >>> dtype = np.float + >>> dtype = float >>> total = 11 >>> rng = np.random.RandomState(0) >>> iter_ = (rng.rand(5, 7, 3) for _ in range(total)) @@ -128,7 +128,7 @@ def fromiter_nd(iter_, shape, dtype): Example: >>> # ENABLE_DOCTEST >>> from vtool_ibeis.numpy_utils import * # NOQA - >>> dtype = np.int + >>> dtype = int >>> qfxs = np.array([1, 2, 3]) >>> dfxs = np.array([4, 5, 6]) >>> iter_ = (np.array(x) for x in ut.product(qfxs, dfxs)) @@ -144,7 +144,7 @@ def fromiter_nd(iter_, shape, dtype): >>> sigma = 500 >>> n_data = 1000 >>> rng = np.random.RandomState(42) - >>> n_feat_list = np.clip(rng.randn(n_data) * sigma + mu, 0, np.inf).astype(np.int) + >>> n_feat_list = np.clip(rng.randn(n_data) * sigma + mu, 0, np.inf).astype(int) >>> # Make a large list of vectors of various sizes >>> print('Making random vectors') >>> vecs_list = [(rng.rand(num, feat_dim) * 255).astype(dtype) for num in n_feat_list] @@ -225,7 +225,7 @@ def index_to_boolmask(index_list, maxval=None, isflat=True): #assert index_list.min() >= 0 if maxval is None: maxval = index_list.max() - mask = np.zeros(maxval, dtype=np.bool) + mask = np.zeros(maxval, dtype=bool) if not isflat: # assumes non-flat mask.__setitem__(tuple(index_list.T), True) diff --git a/vtool_ibeis/other.py b/vtool_ibeis/other.py index f08df426..1d20d6af 100644 --- a/vtool_ibeis/other.py +++ b/vtool_ibeis/other.py @@ -1139,8 +1139,8 @@ def flag_intersection(arr1, arr2): """ import vtool_ibeis as vt if arr1.size == 0 or arr2.size == 0: - flags = np.full(arr1.shape[0], False, dtype=np.bool) - #return np.empty((0,), dtype=np.bool) + flags = np.full(arr1.shape[0], False, dtype=bool) + #return np.empty((0,), dtype=bool) else: # flags = np.logical_or.reduce([arr1 == row for row in arr2]).T[0] flags = vt.iter_reduce_ufunc(np.logical_or, (arr1 == row_ for row_ in arr2)).ravel() @@ -1368,13 +1368,13 @@ def get_uncovered_mask(covered_array, covering_array): """ import vtool_ibeis as vt if len(covering_array) == 0: - return np.ones(np.shape(covered_array), dtype=np.bool) + return np.ones(np.shape(covered_array), dtype=bool) else: flags_iter = (np.not_equal(covered_array, item) for item in covering_array) mask_array = vt.iter_reduce_ufunc(np.logical_and, flags_iter) return mask_array #if len(covering_array) == 0: - # return np.ones(np.shape(covered_array), dtype=np.bool) + # return np.ones(np.shape(covered_array), dtype=bool) #else: # flags_list = (np.not_equal(covered_array, item) for item in covering_array) # mask_array = and_lists(*flags_list) @@ -1383,7 +1383,7 @@ def get_uncovered_mask(covered_array, covering_array): #def get_uncovered_mask2(covered_array, covering_array): # if len(covering_array) == 0: -# return np.ones(np.shape(covered_array), dtype=np.bool) +# return np.ones(np.shape(covered_array), dtype=bool) # else: # flags_iter = (np.not_equal(covered_array, item) for item in covering_array) # mask_array = vt.iter_reduce_ufunc(np.logical_and, flags_iter) @@ -2415,7 +2415,7 @@ def fromiter_nd(iter_, shape, dtype): Example: >>> # ENABLE_DOCTEST >>> from vtool_ibeis.other import * # NOQA - >>> dtype = np.int + >>> dtype = int >>> qfxs = np.array([1, 2, 3]) >>> dfxs = np.array([4, 5, 6]) >>> iter_ = (np.array(x) for x in ut.product(qfxs, dfxs)) @@ -2492,7 +2492,7 @@ def take_col_per_row(arr, colx_list): num_cols = 4 arr = np.arange(10 * 4).reshape(10, 4) - colx_list = (np.random.rand(10) * 4).astype(np.int) + colx_list = (np.random.rand(10) * 4).astype(int) %timeit np.array([row[cx] for (row, cx) in zip(arr, colx_list)]) %timeit arr.ravel().take(np.ravel_multi_index((np.arange(len(colx_list)), colx_list), arr.shape)) diff --git a/vtool_ibeis/patch.py b/vtool_ibeis/patch.py index 0f434cc8..7fc4e106 100755 --- a/vtool_ibeis/patch.py +++ b/vtool_ibeis/patch.py @@ -727,7 +727,7 @@ def matmul_hold(other, hold=True): X = ltool.translation_mat3x3(half_patch_size, half_patch_size) # Translate back to patch-image coordinates M = X.dot(S).dot(R).dot(V).dot(T) # Prepare to warp - dsize = np.ceil([patch_size, patch_size]).astype(np.int) + dsize = np.ceil([patch_size, patch_size]).astype(int) # Warp #warped_patch = gtool.warpAffine(img, M, dsize) warped_patch = cv2.warpAffine(img, M[0:2], tuple(dsize), **cv2_warp_kwargs) @@ -776,7 +776,7 @@ def patch_gaussian_weighted_average_intensities(probchip, kpts_): import vtool_ibeis as vt patch_size = 41 M_iter = vt.generate_to_patch_transforms(kpts_, patch_size) - dsize = np.ceil([patch_size, patch_size]).astype(np.int) + dsize = np.ceil([patch_size, patch_size]).astype(int) # Preallocate patch patch = np.empty(dsize[::-1], dtype=np.uint8) weighted_patch = np.empty(dsize[::-1], dtype=np.float64) diff --git a/vtool_ibeis/score_normalization.py b/vtool_ibeis/score_normalization.py index 5bc1aecb..3019c32e 100644 --- a/vtool_ibeis/score_normalization.py +++ b/vtool_ibeis/score_normalization.py @@ -811,7 +811,7 @@ def partition_scores(X, y, attrs=None): >>> from vtool_ibeis.score_normalization import * # NOQA >>> X = np.array([5, 6, 6, 7, 1, 2, 2]) >>> attrs = {'qaid': np.array([21, 24, 25, 26, 11, 14, 15])} - >>> y = np.array([1, 1, 1, 1, 0, 0, 0], dtype=np.bool) + >>> y = np.array([1, 1, 1, 1, 0, 0, 0], dtype=bool) >>> tup = partition_scores(X, y, attrs) >>> resdict = ut.odict(zip( >>> ['tp_scores', 'tn_scores', 'part_attrs'], tup)) @@ -877,7 +877,7 @@ def flatten_scores(tp_scores, tn_scores, part_attrs=None): >>> tup = flatten_scores( ... tp_scores, tn_scores, part_attrs) >>> (X, y, attrs) = tup - >>> y = y.astype(np.int) + >>> y = y.astype(int) >>> resdict = ut.odict(zip(['X', 'y', 'attrs'], [X, y, attrs])) >>> result = ub.repr2(resdict, nobraces=True, with_dtype=False, >>> explicit=1, nl=1) @@ -888,7 +888,7 @@ def flatten_scores(tp_scores, tn_scores, part_attrs=None): attrs={'qaid': np.array([21, 24, 25, 26, 11, 14, 15])}, """ scores = np.hstack([tp_scores, tn_scores]) - labels = np.zeros(scores.size, dtype=np.bool) + labels = np.zeros(scores.size, dtype=bool) labels[0:len(tp_scores)] = True if part_attrs is None: return scores, labels diff --git a/vtool_ibeis/segmentation.py b/vtool_ibeis/segmentation.py index 996ab6ef..b86146e4 100755 --- a/vtool_ibeis/segmentation.py +++ b/vtool_ibeis/segmentation.py @@ -140,7 +140,7 @@ def demo_grabcut(bgr_img): with ut.Timer('grabcut'): post_mask = grabcut(bgr_img, prior_mask) if post_mask.dtype == np.uint8: - post_mask = post_mask.astype(np.float) / 255.0 + post_mask = post_mask.astype(float) / 255.0 seg_chip = mask_colored_img(bgr_img, post_mask, 'bgr') print('finished running grabcut') pt.imshow(post_mask * 255, pnum=(1, 2, 1)) @@ -186,12 +186,12 @@ def grabcut(bgr_img, prior_mask, binary=True): def mask_colored_img(img_rgb, mask, encoding='bgr'): if mask.dtype == np.uint8: - mask = mask.astype(np.float) / 255.0 + mask = mask.astype(float) / 255.0 into_hsv_flag = into_hsv_flags[encoding] from_hsv_flag = from_hsv_flags[encoding] # Mask out value component img_hsv = cv2.cvtColor(img_rgb, into_hsv_flag) - img_hsv = np.array(img_hsv, dtype=np.float) / 255.0 + img_hsv = np.array(img_hsv, dtype=float) / 255.0 VAL_INDEX = 2 img_hsv[:, :, VAL_INDEX] *= mask img_hsv = np.array(np.round(img_hsv * 255.0), dtype=np.uint8) @@ -226,7 +226,7 @@ def grabcut2(rgb_chip): chip_mask = np.where(is_forground, 255, 0).astype('uint8') # Crop chip_mask = clean_mask(chip_mask) - chip_mask = np.array(chip_mask, np.float) / 255.0 + chip_mask = np.array(chip_mask, float) / 255.0 # Mask value component of HSV space seg_chip = mask_colored_img(rgb_chip, chip_mask, 'rgb') return seg_chip @@ -264,10 +264,10 @@ def segment(img_fpath, bbox_, new_size=None): chip = img_resz[y1:y2, x1:x2] chip_mask = img_mask[y1:y2, x1:x2] chip_mask = clean_mask(chip_mask) - chip_mask = np.array(chip_mask, np.float) / 255.0 + chip_mask = np.array(chip_mask, float) / 255.0 # Mask the value of HSV chip_hsv = cv2.cvtColor(chip, cv2.COLOR_RGB2HSV) - chip_hsv = np.array(chip_hsv, dtype=np.float) / 255.0 + chip_hsv = np.array(chip_hsv, dtype=float) / 255.0 chip_hsv[:, :, 2] *= chip_mask chip_hsv = np.array(np.round(chip_hsv * 255.0), dtype=np.uint8) seg_chip = cv2.cvtColor(chip_hsv, cv2.COLOR_HSV2RGB) diff --git a/vtool_ibeis/spatial_verification.py b/vtool_ibeis/spatial_verification.py index dc6a8f58..0c1049ed 100755 --- a/vtool_ibeis/spatial_verification.py +++ b/vtool_ibeis/spatial_verification.py @@ -461,7 +461,7 @@ def _test_hypothesis_inliers(Aff, invVR1s_m, xy2_m, det2_m, ori2_m, ori_inliers_flag = np.less(ori_err, ori_thresh) #np.logical_and(xy_inliers_flag, scale_inliers_flag) # TODO Add uniqueness of matches constraint - #hypo_inliers_flag = np.empty(xy_inliers_flag.size, dtype=np.bool) + #hypo_inliers_flag = np.empty(xy_inliers_flag.size, dtype=bool) hypo_inliers_flag = xy_inliers_flag # Try to re-use memory np.logical_and(hypo_inliers_flag, ori_inliers_flag, out=hypo_inliers_flag) np.logical_and(hypo_inliers_flag, scale_inliers_flag, out=hypo_inliers_flag) From 859aab1d7bd99a77fe0dae0c96d53314e6a382af Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 29 Jan 2023 01:06:40 -0500 Subject: [PATCH 04/23] wip --- vtool_ibeis/image.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/vtool_ibeis/image.py b/vtool_ibeis/image.py index b77ecf45..4cd92f33 100755 --- a/vtool_ibeis/image.py +++ b/vtool_ibeis/image.py @@ -300,7 +300,7 @@ def imread(img_fpath, grayscale=False, orient=False, flags=None, >>> ut.show_if_requested() Example: - >>> # ENABLE_DOCTEST + >>> # DISABLE_DOCTEST >>> from vtool_ibeis.image import * # NOQA >>> img_url = 'http://images.summitpost.org/original/769474.JPG' >>> img_fpath = ut.grab_file_url(img_url) @@ -311,17 +311,20 @@ def imread(img_fpath, grayscale=False, orient=False, flags=None, >>> print('imgBGR2.shape = %r' % (imgBGR2.shape,)) >>> result = str(imgBGR1.shape) >>> diff_pxls = imgBGR1 != imgBGR2 + >>> # Very strange that this fails >>> num_diff_pxls = diff_pxls.sum() >>> print(result) >>> print('num_diff_pxls=%r/%r' % (num_diff_pxls, diff_pxls.size)) >>> assert num_diff_pxls == 0 >>> # xdoctest: +REQUIRES(--show) + >>> import kwplot + >>> kwplot.autompl() >>> import plottool_ibeis as pt >>> diffMag = np.linalg.norm(imgBGR2 / 255. - imgBGR1 / 255., axis=2) - >>> pt.imshow(imgBGR1, pnum=(1, 3, 1)) - >>> pt.imshow(diffMag / diffMag.max(), pnum=(1, 3, 2)) - >>> pt.imshow(imgBGR2, pnum=(1, 3, 3)) - >>> ut.show_if_requested() + >>> kwplot.imshow(imgBGR1, pnum=(1, 3, 1)) + >>> kwplot.imshow(diffMag / diffMag.max(), pnum=(1, 3, 2)) + >>> kwplot.imshow(imgBGR2, pnum=(1, 3, 3)) + >>> kwplot.show_if_requested() (2736, 3648, 3) Example: From 2b143124086ba31f33e977c408e38ba6f399f30c Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 29 Jan 2023 01:12:29 -0500 Subject: [PATCH 05/23] wip --- vtool_ibeis/score_normalization.py | 1 - 1 file changed, 1 deletion(-) diff --git a/vtool_ibeis/score_normalization.py b/vtool_ibeis/score_normalization.py index 3019c32e..d1b3887f 100644 --- a/vtool_ibeis/score_normalization.py +++ b/vtool_ibeis/score_normalization.py @@ -825,7 +825,6 @@ def partition_scores(X, y, attrs=None): False: {'qaid': np.array([11, 14, 15])}, True: {'qaid': np.array([21, 24, 25, 26])}, }, - """ import vtool_ibeis as vt import operator From 351cf12e65c6c5c16d0555ce508822d70b400c9c Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 29 Jan 2023 01:14:45 -0500 Subject: [PATCH 06/23] correct version --- vtool_ibeis/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vtool_ibeis/__init__.py b/vtool_ibeis/__init__.py index 1ffdd61e..8711b22a 100755 --- a/vtool_ibeis/__init__.py +++ b/vtool_ibeis/__init__.py @@ -5,7 +5,7 @@ mkinit vtool_ibeis -i """ # flake8: noqa -__version__ = '2.2.0' +__version__ = '2.2.1' __author__ = 'Jon Crall, Avi Weinstock, Chuck Stewart, Hendrik Weideman, Jason Parham, Zackary Rutfield' __author_email__ = 'erotemic@gmail.com' __url__ = 'https://github.com/Erotemic/vtool_ibeis' From ed09735899c7b38c13bfcc0432c65c73f5f91c42 Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 29 Jan 2023 01:23:06 -0500 Subject: [PATCH 07/23] wip --- vtool_ibeis/keypoint.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/vtool_ibeis/keypoint.py b/vtool_ibeis/keypoint.py index b8e88fb4..b948ac28 100755 --- a/vtool_ibeis/keypoint.py +++ b/vtool_ibeis/keypoint.py @@ -524,7 +524,6 @@ def get_invVR_mats3x3(kpts): ... [30, 40, 1, 2, 3, TAU / 4.0], ... ]) >>> invVR_mats3x3 = get_invVR_mats3x3(kpts) - >>> # verify results >>> result = kpts_repr(invVR_mats3x3) >>> print(result) array([[[ 1., 0., 10.], @@ -537,20 +536,6 @@ def get_invVR_mats3x3(kpts): #nKpts = len(kpts) invVR_mats2x2 = get_invVR_mats2x2(kpts) invVR_mats3x3 = augment_2x2_with_translation(kpts, invVR_mats2x2) - # Unpack shape components - #_iv11s = invVR_mats2x2.T[0, 0] - #_iv12s = invVR_mats2x2.T[1, 0] - #_iv21s = invVR_mats2x2.T[0, 1] - #_iv22s = invVR_mats2x2.T[1, 1] - ## Get translation components - #_iv13s, _iv23s = get_xys(kpts) - ## Use homogenous coordinates - #_zeros = np.zeros(nKpts) - #_ones = np.ones(nKpts) - #invVR_arrs = np.array([[_iv11s, _iv12s, _iv13s], - # [_iv21s, _iv22s, _iv23s], - # [_zeros, _zeros, _ones]]) # R x C x N - #invVR_mats = np.rollaxis(invVR_arrs, 2) # N x R x C return invVR_mats3x3 From 500298df849d6b1efd2739e19f978d0fff322047 Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 29 Jan 2023 01:28:00 -0500 Subject: [PATCH 08/23] Disable failing test that is probably not used very much --- vtool_ibeis/keypoint.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vtool_ibeis/keypoint.py b/vtool_ibeis/keypoint.py index b948ac28..c30058bc 100755 --- a/vtool_ibeis/keypoint.py +++ b/vtool_ibeis/keypoint.py @@ -2154,10 +2154,11 @@ def get_even_point_sample(kpts): pyhesaff.tests.test_ellipse Example: - >>> # ENABLE_DOCTEST + >>> # DISABLE_DOCTEST >>> from vtool_ibeis.keypoint import * # NOQA >>> import vtool_ibeis as vt >>> kpts = vt.demodata.get_dummy_kpts()[0:2] + >>> # not sure why this is failing >>> ell_border_pts_list = get_even_point_sample(kpts) >>> # xdoctest: +REQUIRES(--show) >>> import plottool_ibeis as pt From 8b5d2e678f68b4b48df6e9337e6cf28a04607471 Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 29 Jan 2023 01:45:16 -0500 Subject: [PATCH 09/23] wip --- .github/workflows/tests.yml | 602 +++++++++++++++--------------- .readthedocs.yml | 26 +- dev/ci_public_gpg_key.pgp.enc | 84 +++-- dev/ci_secret_gpg_subkeys.pgp.enc | 61 +-- dev/gpg_owner_trust.enc | 21 +- dev/secrets_configuration.sh | 8 +- dev/setup_secrets.sh | 90 ++++- publish.sh | 4 - run_doctests.sh | 4 +- run_tests.py | 4 +- 10 files changed, 488 insertions(+), 416 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 344ce981..c6f55f8d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,8 +1,9 @@ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions # Based on ~/code/xcookie/xcookie/rc/tests.yml.in +# Now based on ~/code/xcookie/xcookie/builders/github_actions.py -name: Tests +name: PurePyCI on: push: @@ -10,237 +11,286 @@ on: branches: [ main ] jobs: - - lint: + lint_job: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 + - name: Checkout source + uses: actions/checkout@v3 - name: Set up Python 3.8 - uses: actions/setup-python@v4 + uses: actions/setup-python@v4.5.0 with: python-version: 3.8 - name: Install dependencies - run: | + run: |- python -m pip install --upgrade pip python -m pip install flake8 - name: Lint with flake8 - run: | + run: |- # stop the build if there are Python syntax errors or undefined names flake8 ./vtool_ibeis --count --select=E9,F63,F7,F82 --show-source --statistics - # # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - # flake8 . --count --exit-zero --max-complexity=20 --max-line-length=127 --statistics - + - name: Typecheck with mypy + run: |- + python -m pip install mypy + mypy --install-types --non-interactive ./vtool_ibeis + mypy ./vtool_ibeis build_and_test_sdist: name: Test sdist Python 3.8 runs-on: ubuntu-latest - #needs: [lint] steps: - - uses: actions/checkout@v3 + - name: Checkout source + uses: actions/checkout@v3 - name: Set up Python 3.8 - uses: actions/setup-python@v4 + uses: actions/setup-python@v4.5.0 with: python-version: 3.8 - - name: Upgrade pip - run: | + - name: Upgrade pip + run: |- python -m pip install --upgrade pip - python -m pip install build python -m pip install -r requirements/tests.txt python -m pip install -r requirements/runtime.txt - python -m pip install -r requirements/headless.txt # xcookie: +UNCOMMENT_IF(cv2) + python -m pip install -r requirements/headless.txt - name: Build sdist - run: | - python -m pip install setuptools>=0.8 wheel pip -U - python -m pip install build -U || true - python -m build --sdist --outdir wheelhouse . || python setup.py sdist - #python -m build --wheel --outdir wheelhouse . - mkdir -p dist - mkdir -p wheelhouse - mv dist/* wheelhouse || true - - #python setup.py sdist - #mkdir -p dist - #mkdir -p wheelhouse - #mv dist/* wheelhouse - ##python -m build --sdist --outdir wheelhouse + shell: bash + run: |- + python -m pip install pip -U + python -m pip install setuptools>=0.8 wheel build + python -m build --sdist --outdir wheelhouse - name: Install sdist - run: | + run: |- ls -al ./wheelhouse - #pip install wheelhouse/vtool_ibeis*.tar.gz -v - pip install vtool_ibeis[headless,tests] --find-links wheelhouse - - name: Test minimal sdist - run: | + pip install wheelhouse/vtool_ibeis*.tar.gz -v + - name: Test minimal loose sdist + run: |- pwd ls -al + # Run in a sandboxed directory + WORKSPACE_DNAME="testsrcdir_minimal_${CI_PYTHON_VERSION}_${GITHUB_RUN_ID}_${RUNNER_OS}" + mkdir -p $WORKSPACE_DNAME + cd $WORKSPACE_DNAME # Run the tests # Get path to installed package - mkdir -p ./_test_env - cd ./_test_env - pip install ubelt - MOD_DPATH=$(python -c "import ubelt; print(ubelt.modname_to_modpath('vtool_ibeis'))") - #MOD_DPATH=$(python -c "import vtool_ibeis, os; print(os.path.dirname(vtool_ibeis.__file__))") - TEST_DPATH=./../tests + MOD_DPATH=$(python -c "import vtool_ibeis, os; print(os.path.dirname(vtool_ibeis.__file__))") echo "MOD_DPATH = $MOD_DPATH" - python -m pytest -p pytester -p no:doctest --xdoctest --cov=vtool_ibeis "$MOD_DPATH" "$TEST_DPATH" + python -m pytest --cov={self.mod_name} $MOD_DPATH ../tests cd .. - - - name: Test full sdist - run: | + - name: Test full loose sdist + run: |- pwd ls -al - pip install vtool_ibeis[headless,tests,optional] --find-links wheelhouse - python -m pip install -r requirements/optional.txt - python -m pip install -r requirements/headless.txt # xcookie: +UNCOMMENT_IF(cv2) + python -m pip install --prefer-binary -r requirements/headless.txt + # Run in a sandboxed directory + WORKSPACE_DNAME="testsrcdir_full_${CI_PYTHON_VERSION}_${GITHUB_RUN_ID}_${RUNNER_OS}" + mkdir -p $WORKSPACE_DNAME + cd $WORKSPACE_DNAME # Run the tests # Get path to installed package - pip install ubelt - MOD_DPATH=$(python -c "import ubelt; print(ubelt.modname_to_modpath('vtool_ibeis'))") + MOD_DPATH=$(python -c "import vtool_ibeis, os; print(os.path.dirname(vtool_ibeis.__file__))") echo "MOD_DPATH = $MOD_DPATH" - python -m pytest -p pytester -p no:doctest --xdoctest $MOD_DPATH ./tests - - + python -m pytest --cov={self.mod_name} $MOD_DPATH ../tests + cd .. - name: Upload sdist artifact uses: actions/upload-artifact@v3 with: name: wheels path: ./wheelhouse/*.tar.gz - - build_and_test_wheels: - # TODO: handle different python versions: https://github.com/actions/setup-python - name: ${{ matrix.python-version }} on ${{ matrix.os }}, arch=${{ matrix.arch }} + build_purepy_wheels: + name: ${{ matrix.python-version }} on ${{ matrix.os }}, arch=${{ matrix.arch }} with ${{ matrix.install-extras }} runs-on: ${{ matrix.os }} - #needs: [lint] strategy: matrix: - os: [ - ubuntu-latest, - #windows-latest, macOS-latest - ] - python-version: - - '3.7' - - '3.8' - - '3.9' - - '3.10' - arch: [auto] - #cibw_build: [cp3*-*] - #cibw_skip: ["*-win32"] - # Add additional workers to reduce overall build time - #include: - # - os: windows-latest - # cibw_build: cp3*-win32 - # arch: auto - # cibw_skip: "" - # - os: ubuntu-latest - # arch: aarch64 - # cibw_build: cp35-* - # - os: ubuntu-latest - # arch: aarch64 - # cibw_build: cp36-* - # - os: ubuntu-latest - # arch: aarch64 - # cibw_build: cp37-* - # - os: ubuntu-latest - # arch: aarch64 - # cibw_build: cp38-* - # - os: ubuntu-latest - # arch: aarch64 - # cibw_build: cp39-* - - + os: + - ubuntu-latest + python-version: + - '3.11' + arch: + - auto steps: - name: Checkout source uses: actions/checkout@v3 - - # Configure compilers for Windows 64bit. - - name: Enable MSVC 64bit - if: matrix.os == 'windows-latest' && matrix.cibw_build != 'cp3*-win32' - uses: ilammy/msvc-dev-cmd@v1 - - # Configure compilers for Windows 32bit. - - name: Enable MSVC 32bit - if: matrix.os == 'windows-latest' && matrix.cibw_build == 'cp3*-win32' - uses: ilammy/msvc-dev-cmd@v1 - with: - arch: x86 - - # Emulate aarch64 ppc64le s390x under linux - name: Set up QEMU - if: runner.os == 'Linux' && matrix.arch != 'auto' uses: docker/setup-qemu-action@v2 + if: runner.os == 'Linux' && matrix.arch != 'auto' with: platforms: all - - - # See: https://github.com/pypa/cibuildwheel/blob/main/action.yml - #- name: Build wheels - # uses: pypa/cibuildwheel@v1.11.0 - # with: - # output-dir: wheelhouse - # # to supply options, put them in 'env', like: - # env: - # CIBW_SKIP: ${{ matrix.cibw_skip }} - # CIBW_BUILD: ${{ matrix.cibw_build }} - # CIBW_TEST_REQUIRES: -r requirements/tests.txt - # CIBW_TEST_COMMAND: python {project}/run_tests.py - # # configure cibuildwheel to build native archs ('auto'), or emulated ones - # CIBW_ARCHS_LINUX: ${{ matrix.arch }} - - # Setup Python environemtn for a pure wheel - - uses: actions/setup-python@v4 + - name: Setup Python + uses: actions/setup-python@v4.5.0 with: python-version: ${{ matrix.python-version }} - - name: Build pure wheel shell: bash - run: | - python -m pip install setuptools>=0.8 wheel pip -U - python -m pip install build -U || true - python -m build --wheel --outdir wheelhouse . || python -m pip wheel --wheel-dir wheelhouse . - #python -m build --wheel --outdir wheelhouse . - mkdir -p dist - mkdir -p wheelhouse - mv dist/* wheelhouse || true - - - name: Test pure wheel + run: |- + python -m pip install pip -U + python -m pip install setuptools>=0.8 build + python -m build --wheel --outdir wheelhouse + - name: Show built files + shell: bash + run: ls -la wheelhouse + - uses: actions/upload-artifact@v3 + name: Upload wheels artifact + with: + name: wheels + path: ./wheelhouse/vtool_ibeis*.whl + test_purepy_wheels: + name: ${{ matrix.python-version }} on ${{ matrix.os }}, arch=${{ matrix.arch }} with ${{ matrix.install-extras }} + runs-on: ${{ matrix.os }} + needs: + - build_purepy_wheels + strategy: + matrix: + include: + - python-version: '3.7' + os: ubuntu-latest + install-extras: tests-strict,runtime-strict,headless-strict + arch: auto + - python-version: '3.7' + os: macOS-latest + install-extras: tests-strict,runtime-strict,headless-strict + arch: auto + - python-version: '3.7' + os: windows-latest + install-extras: tests-strict,runtime-strict,headless-strict + arch: auto + - python-version: '3.11' + os: ubuntu-latest + install-extras: tests-strict,runtime-strict,optional-strict,headless-strict + arch: auto + - python-version: '3.11' + os: macOS-latest + install-extras: tests-strict,runtime-strict,optional-strict,headless-strict + arch: auto + - python-version: '3.11' + os: windows-latest + install-extras: tests-strict,runtime-strict,optional-strict,headless-strict + arch: auto + - python-version: '3.11' + os: macOS-latest + install-extras: tests,headless + arch: auto + - python-version: '3.11' + os: windows-latest + install-extras: tests,headless + arch: auto + - python-version: '3.7' + os: ubuntu-latest + install-extras: tests,optional,headless + arch: auto + - python-version: '3.8' + os: ubuntu-latest + install-extras: tests,optional,headless + arch: auto + - python-version: '3.9' + os: ubuntu-latest + install-extras: tests,optional,headless + arch: auto + - python-version: '3.10' + os: ubuntu-latest + install-extras: tests,optional,headless + arch: auto + - python-version: '3.11' + os: ubuntu-latest + install-extras: tests,optional,headless + arch: auto + - python-version: '3.7' + os: macOS-latest + install-extras: tests,optional,headless + arch: auto + - python-version: '3.8' + os: macOS-latest + install-extras: tests,optional,headless + arch: auto + - python-version: '3.9' + os: macOS-latest + install-extras: tests,optional,headless + arch: auto + - python-version: '3.10' + os: macOS-latest + install-extras: tests,optional,headless + arch: auto + - python-version: '3.11' + os: macOS-latest + install-extras: tests,optional,headless + arch: auto + - python-version: '3.7' + os: windows-latest + install-extras: tests,optional,headless + arch: auto + - python-version: '3.8' + os: windows-latest + install-extras: tests,optional,headless + arch: auto + - python-version: '3.9' + os: windows-latest + install-extras: tests,optional,headless + arch: auto + - python-version: '3.10' + os: windows-latest + install-extras: tests,optional,headless + arch: auto + - python-version: '3.11' + os: windows-latest + install-extras: tests,optional,headless + arch: auto + - python-version: pypy-3.7 + os: ubuntu-latest + install-extras: tests,optional,headless + arch: auto + - python-version: pypy-3.7 + os: macOS-latest + install-extras: tests,optional,headless + arch: auto + - python-version: pypy-3.7 + os: windows-latest + install-extras: tests,optional,headless + arch: auto + steps: + - name: Checkout source + uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + if: runner.os == 'Linux' && matrix.arch != 'auto' + with: + platforms: all + - name: Setup Python + uses: actions/setup-python@v4.5.0 + with: + python-version: ${{ matrix.python-version }} + - uses: actions/download-artifact@v3 + name: Download wheels and sdist + with: + name: wheels + path: wheelhouse + - name: Test wheel with ${{ matrix.install-extras }} shell: bash env: + INSTALL_EXTRAS: ${{ matrix.install-extras }} CI_PYTHON_VERSION: py${{ matrix.python-version }} - #OS_NAME: ${{ matrix.os }} - run: | - # Remove source directory (ensure it doesn't conflict) - #mv vtool_ibeis ignore_src_vtool_ibeis - #rm pytest.ini - # Install the wheel - #python -m pip install -r requirements/tests.txt - #python -m pip install -r requirements/headless.txt # xcookie: +UNCOMMENT_IF(cv2) - #python -m pip install wheelhouse/vtool_ibeis*.whl - python -m pip install vtool_ibeis[headless,tests] --find-links wheelhouse - # Run in a sandboxed directory + run: |- + # Find the path to the wheel + ls wheelhouse + pip install tomli pkginfo + MOD_NAME=vtool_ibeis + echo "MOD_NAME=$MOD_NAME" + WHEEL_FPATH=$(python -c "import pathlib; print(str(sorted(pathlib.Path('wheelhouse').glob('$MOD_NAME*.whl'))[-1]).replace(chr(92), chr(47)))") + echo "WHEEL_FPATH=$WHEEL_FPATH" + MOD_VERSION=$(python -c "from pkginfo import Wheel; print(Wheel('$WHEEL_FPATH').version)") + echo "MOD_VERSION=$MOD_VERSION" + # Install the wheel (ensure we are using the version we just built) + # NOTE: THE VERSION MUST BE NEWER THAN AN EXISTING PYPI VERSION OR THIS MAY FAIL + pip install --prefer-binary "$MOD_NAME[$INSTALL_EXTRAS]==$MOD_VERSION" -f wheelhouse + # Create a sandboxed directory WORKSPACE_DNAME="testdir_${CI_PYTHON_VERSION}_${GITHUB_RUN_ID}_${RUNNER_OS}" mkdir -p $WORKSPACE_DNAME cd $WORKSPACE_DNAME - # Run the tests - # Get path to installed package - pip install ubelt - MOD_DPATH=$(python -c "import ubelt; print(ubelt.modname_to_modpath('vtool_ibeis'))") - python -m pytest -p pytester -p no:doctest --xdoctest --cov-config ../pyproject.toml --cov-report term --cov=vtool_ibeis $MOD_DPATH ../tests + # Get the path to the installed package and run the tests + MOD_DPATH=$(python -c "import vtool_ibeis, os; print(os.path.dirname(vtool_ibeis.__file__))") + echo "MOD_DPATH = $MOD_DPATH" + python -m pytest -p pytester -p no:doctest --xdoctest --cov-config ../pyproject.toml --cov-report term --cov="$MOD_NAME" "$MOD_DPATH" ../tests + # Move coverage file to a new name mv .coverage "../.coverage.$WORKSPACE_DNAME" cd .. - # Move coverage file to a new name - - - name: Show built files - shell: bash - run: ls -la wheelhouse - - - name: Set up Python 3.8 to combine coverage Linux - if: runner.os == 'Linux' - uses: actions/setup-python@v4 - with: - python-version: 3.8 - - name: Combine coverage Linux if: runner.os == 'Linux' - run: | + run: |- echo '############ PWD' pwd ls -al @@ -252,146 +302,110 @@ jobs: echo '############ FIND' find . -name .coverage.* find . -name coverage.xml - - - name: Codecov Upload - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v3 + name: Codecov Upload with: file: ./tests/coverage.xml - - - name: Upload wheels artifact - uses: actions/upload-artifact@v3 - with: - name: wheels - path: ./wheelhouse/vtool_ibeis*.whl - - deploy: - # Publish on the real PyPI - name: Uploading to PyPi + test_deploy: + name: Uploading Test to PyPi runs-on: ubuntu-latest - if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') - needs: [build_and_test_wheels, build_and_test_sdist] + if: github.event_name == 'push' && ! startsWith(github.event.ref, 'refs/tags') && ! startsWith(github.event.ref, 'refs/heads/release') + needs: + - build_and_test_sdist + - build_purepy_wheels + - test_purepy_wheels steps: - - name: Checkout source - uses: actions/checkout@v3 - - - name: Download wheels and sdist - uses: actions/download-artifact@v3 - with: - name: wheels - path: wheelhouse - - - name: Show files to upload - shell: bash - run: ls -la wheelhouse - - # Note: - # See ../../dev/setup_secrets.sh for details on how secrets are deployed securely - - name: Sign and Publish - env: - TWINE_REPOSITORY_URL: https://upload.pypi.org/legacy/ - TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} - TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} - EROTEMIC_CI_SECRET: ${{ secrets.EROTEMIC_CI_SECRET }} - run: | - ls -al - GPG_EXECUTABLE=gpg - $GPG_EXECUTABLE --version - openssl version - $GPG_EXECUTABLE --list-keys - echo "Decrypting Keys" - GLKWS=$EROTEMIC_CI_SECRET openssl enc -aes-256-cbc -pbkdf2 -md SHA512 -pass env:GLKWS -d -a -in dev/ci_public_gpg_key.pgp.enc | $GPG_EXECUTABLE --import - GLKWS=$EROTEMIC_CI_SECRET openssl enc -aes-256-cbc -pbkdf2 -md SHA512 -pass env:GLKWS -d -a -in dev/gpg_owner_trust.enc | $GPG_EXECUTABLE --import-ownertrust - GLKWS=$EROTEMIC_CI_SECRET openssl enc -aes-256-cbc -pbkdf2 -md SHA512 -pass env:GLKWS -d -a -in dev/ci_secret_gpg_subkeys.pgp.enc | $GPG_EXECUTABLE --import - echo "Finish Decrypt Keys" - $GPG_EXECUTABLE --list-keys || true - $GPG_EXECUTABLE --list-keys || echo "first invocation of gpg creates directories and returns 1" - $GPG_EXECUTABLE --list-keys - VERSION=$(python -c "import setup; print(setup.VERSION)") - pip install twine - pip install six pyopenssl ndg-httpsclient pyasn1 -U --user - pip install requests[security] twine --user - GPG_KEYID=$(cat dev/public_gpg_key) - echo "GPG_KEYID = '$GPG_KEYID'" - DO_GPG=True GPG_KEYID=$GPG_KEYID \ - TWINE_REPOSITORY_URL=${TWINE_REPOSITORY_URL} \ - TWINE_PASSWORD=$TWINE_PASSWORD \ - TWINE_USERNAME=$TWINE_USERNAME \ - GPG_EXECUTABLE=$GPG_EXECUTABLE \ - DO_UPLOAD=True \ - DO_TAG=False ./publish.sh - - test_deploy: - # Publish on the test PyPI - name: Uploading to Test PyPi + - name: Checkout source + uses: actions/checkout@v3 + - uses: actions/download-artifact@v3 + name: Download wheels and sdist + with: + name: wheels + path: wheelhouse + - name: Show files to upload + shell: bash + run: ls -la wheelhouse + - name: Sign and Publish + env: + TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/ + TWINE_USERNAME: ${{ secrets.TEST_TWINE_USERNAME }} + TWINE_PASSWORD: ${{ secrets.TEST_TWINE_PASSWORD }} + CI_SECRET: ${{ secrets.CI_SECRET }} + run: |- + GPG_EXECUTABLE=gpg + $GPG_EXECUTABLE --version + openssl version + $GPG_EXECUTABLE --list-keys + echo "Decrypting Keys" + openssl enc -aes-256-cbc -pbkdf2 -md SHA512 -pass env:CI_SECRET -d -a -in dev/ci_public_gpg_key.pgp.enc | $GPG_EXECUTABLE --import + openssl enc -aes-256-cbc -pbkdf2 -md SHA512 -pass env:CI_SECRET -d -a -in dev/gpg_owner_trust.enc | $GPG_EXECUTABLE --import-ownertrust + openssl enc -aes-256-cbc -pbkdf2 -md SHA512 -pass env:CI_SECRET -d -a -in dev/ci_secret_gpg_subkeys.pgp.enc | $GPG_EXECUTABLE --import + echo "Finish Decrypt Keys" + $GPG_EXECUTABLE --list-keys || true + $GPG_EXECUTABLE --list-keys || echo "first invocation of gpg creates directories and returns 1" + $GPG_EXECUTABLE --list-keys + VERSION=$(python -c "import setup; print(setup.VERSION)") + pip install twine + pip install urllib3 requests[security] twine + GPG_KEYID=$(cat dev/public_gpg_key) + echo "GPG_KEYID = '$GPG_KEYID'" + DO_GPG=True GPG_KEYID=$GPG_KEYID TWINE_REPOSITORY_URL=${TWINE_REPOSITORY_URL} TWINE_PASSWORD=$TWINE_PASSWORD TWINE_USERNAME=$TWINE_USERNAME GPG_EXECUTABLE=$GPG_EXECUTABLE DO_UPLOAD=True DO_TAG=False ./publish.sh + live_deploy: + name: Uploading Live to PyPi runs-on: ubuntu-latest - if: github.event_name == 'push' && (startsWith(github.event.ref, 'refs/heads/main')) - #if: github.event_name == 'push' && !startsWith(github.event.ref, 'refs/tags') - needs: [build_and_test_wheels, build_and_test_sdist] + if: github.event_name == 'push' && (startsWith(github.event.ref, 'refs/tags') || startsWith(github.event.ref, 'refs/heads/release')) + needs: + - build_and_test_sdist + - build_purepy_wheels + - test_purepy_wheels steps: - - name: Checkout source - uses: actions/checkout@v3 - - - name: Download wheels and sdist - uses: actions/download-artifact@v3 - with: - name: wheels - path: wheelhouse + - name: Checkout source + uses: actions/checkout@v3 + - uses: actions/download-artifact@v3 + name: Download wheels and sdist + with: + name: wheels + path: wheelhouse + - name: Show files to upload + shell: bash + run: ls -la wheelhouse + - name: Sign and Publish + env: + TWINE_REPOSITORY_URL: https://upload.pypi.org/legacy/ + TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} + TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} + CI_SECRET: ${{ secrets.CI_SECRET }} + run: |- + GPG_EXECUTABLE=gpg + $GPG_EXECUTABLE --version + openssl version + $GPG_EXECUTABLE --list-keys + echo "Decrypting Keys" + openssl enc -aes-256-cbc -pbkdf2 -md SHA512 -pass env:CI_SECRET -d -a -in dev/ci_public_gpg_key.pgp.enc | $GPG_EXECUTABLE --import + openssl enc -aes-256-cbc -pbkdf2 -md SHA512 -pass env:CI_SECRET -d -a -in dev/gpg_owner_trust.enc | $GPG_EXECUTABLE --import-ownertrust + openssl enc -aes-256-cbc -pbkdf2 -md SHA512 -pass env:CI_SECRET -d -a -in dev/ci_secret_gpg_subkeys.pgp.enc | $GPG_EXECUTABLE --import + echo "Finish Decrypt Keys" + $GPG_EXECUTABLE --list-keys || true + $GPG_EXECUTABLE --list-keys || echo "first invocation of gpg creates directories and returns 1" + $GPG_EXECUTABLE --list-keys + VERSION=$(python -c "import setup; print(setup.VERSION)") + pip install twine + pip install urllib3 requests[security] twine + GPG_KEYID=$(cat dev/public_gpg_key) + echo "GPG_KEYID = '$GPG_KEYID'" + DO_GPG=True GPG_KEYID=$GPG_KEYID TWINE_REPOSITORY_URL=${TWINE_REPOSITORY_URL} TWINE_PASSWORD=$TWINE_PASSWORD TWINE_USERNAME=$TWINE_USERNAME GPG_EXECUTABLE=$GPG_EXECUTABLE DO_UPLOAD=True DO_TAG=False ./publish.sh - - name: Show files to upload - shell: bash - run: ls -la wheelhouse - - name: Sign and Publish - env: - TEST_TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/ - #TEST_TWINE_USERNAME: ${{ secrets.TEST_TWINE_USERNAME }} - #TEST_TWINE_PASSWORD: ${{ secrets.TEST_TWINE_PASSWORD }} - #export TEST_TWINE_USERNAME=${{ secrets.EROTEMIC_TEST_TWINE_USERNAME }} - #export TEST_TWINE_PASSWORD=${{ secrets.EROTEMIC_TEST_TWINE_PASSWORD }} - #PYUTILS_CI_SECRET: ${{ secrets.PYUTILS_CI_SECRET }} - TEST_TWINE_USERNAME: ${{ secrets.TEST_TWINE_USERNAME }} - TEST_TWINE_PASSWORD: ${{ secrets.TEST_TWINE_PASSWORD }} - EROTEMIC_CI_SECRET: ${{ secrets.EROTEMIC_CI_SECRET }} - run: | - ls -al - GPG_EXECUTABLE=gpg - $GPG_EXECUTABLE --version - openssl version - $GPG_EXECUTABLE --list-keys - echo "Decrypting Keys" - GLKWS=$EROTEMIC_CI_SECRET openssl enc -aes-256-cbc -pbkdf2 -md SHA512 -pass env:GLKWS -d -a -in dev/ci_public_gpg_key.pgp.enc | $GPG_EXECUTABLE --import - GLKWS=$EROTEMIC_CI_SECRET openssl enc -aes-256-cbc -pbkdf2 -md SHA512 -pass env:GLKWS -d -a -in dev/gpg_owner_trust.enc | $GPG_EXECUTABLE --import-ownertrust - GLKWS=$EROTEMIC_CI_SECRET openssl enc -aes-256-cbc -pbkdf2 -md SHA512 -pass env:GLKWS -d -a -in dev/ci_secret_gpg_subkeys.pgp.enc | $GPG_EXECUTABLE --import - echo "Finish Decrypt Keys" - $GPG_EXECUTABLE --list-keys || echo "first invocation of gpg creates directories and returns 1" - $GPG_EXECUTABLE --list-keys - VERSION=$(python -c "import setup; print(setup.VERSION)") - pip install twine - pip install six pyopenssl ndg-httpsclient pyasn1 -U --user - pip install requests[security] twine --user - GPG_KEYID=$(cat dev/public_gpg_key) - echo "GPG_KEYID = '$GPG_KEYID'" - DO_GPG=True GPG_KEYID=$GPG_KEYID \ - TWINE_REPOSITORY_URL=${TEST_TWINE_REPOSITORY_URL} \ - TWINE_USERNAME=${TEST_TWINE_USERNAME} \ - TWINE_PASSWORD=${TEST_TWINE_PASSWORD} \ - GPG_EXECUTABLE=$GPG_EXECUTABLE \ - DO_UPLOAD=True \ - DO_TAG=False ./publish.sh - ### # Unfortunately we cant (yet) use the yaml docstring trick here # https://github.community/t/allow-unused-keys-in-workflow-yaml-files/172120 #__doc__: | # # How to run locally # # https://packaging.python.org/guides/using-testpypi/ -# cd $HOME/code # git clone https://github.com/nektos/act.git $HOME/code/act -# cd $HOME/code/act -# chmod +x install.sh -# ./install.sh -b $HOME/.local/opt/act -# cd $HOME/code/vtool_ibeis - +# chmod +x $HOME/code/act/install.sh +# (cd $HOME/code/act && ./install.sh -b $HOME/.local/opt/act) +# # load_secrets # unset GITHUB_TOKEN # $HOME/.local/opt/act/act \ @@ -399,4 +413,4 @@ jobs: # --secret=EROTEMIC_TWINE_USERNAME=$EROTEMIC_TWINE_USERNAME \ # --secret=EROTEMIC_CI_SECRET=$EROTEMIC_CI_SECRET \ # --secret=EROTEMIC_TEST_TWINE_USERNAME=$EROTEMIC_TEST_TWINE_USERNAME \ -# --secret=EROTEMIC_TEST_TWINE_PASSWORD=$EROTEMIC_TEST_TWINE_PASSWORD +# --secret=EROTEMIC_TEST_TWINE_PASSWORD=$EROTEMIC_TEST_TWINE_PASSWORD \ No newline at end of file diff --git a/.readthedocs.yml b/.readthedocs.yml index 16143814..a785ad3f 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,33 +1,19 @@ # .readthedocs.yml # Read the Docs configuration file # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details -# +# # See Also: -# https://readthedocs.org/dashboard/xcookie/advanced/ +# https://readthedocs.org/dashboard/vtool_ibeis/advanced/ # Required version: 2 - -# Build documentation in the docs/ directory with Sphinx sphinx: configuration: docs/source/conf.py - -# Build documentation with MkDocs -#mkdocs: -# configuration: mkdocs.yml - -# Optionally build your docs in additional formats such as PDF and ePub formats: all - -# Optionally set the version of Python and requirements required to build your docs python: version: 3.7 install: - - requirements: requirements/docs.txt - - method: pip - path: . - #extra_requirements: - # - docs - -#conda: -# environment: environment.yml + - requirements: requirements/headless.txt + - requirements: requirements/docs.txt + - method: pip + path: . diff --git a/dev/ci_public_gpg_key.pgp.enc b/dev/ci_public_gpg_key.pgp.enc index 414accf4..da0c9129 100644 --- a/dev/ci_public_gpg_key.pgp.enc +++ b/dev/ci_public_gpg_key.pgp.enc @@ -1,35 +1,49 @@ -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 -HO5wsUn4QLNP5BW5ueHzJg== +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 +D+qAOgL0BLGgDDkNiJgEWg== diff --git a/dev/ci_secret_gpg_subkeys.pgp.enc b/dev/ci_secret_gpg_subkeys.pgp.enc index 5fbf7a09..416a914e 100644 --- a/dev/ci_secret_gpg_subkeys.pgp.enc +++ b/dev/ci_secret_gpg_subkeys.pgp.enc @@ -1,27 +1,34 @@ -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 diff --git a/dev/gpg_owner_trust.enc b/dev/gpg_owner_trust.enc index d33daf20..36629da7 100644 --- a/dev/gpg_owner_trust.enc +++ b/dev/gpg_owner_trust.enc @@ -1,10 +1,11 @@ -U2FsdGVkX18NPRzkZUdu6aFSHyiKa/QAiCeG/X3OJLNKjLVCK7wrEJE3sA/Q/sFh -l3MbGLsoVRxNEg5t5PMOu+Iz2hWhf5HwkwkycrmxA1QkbSGt2QUpN03Fm+Qz181r -QnEupW+29OCKMduaZs4D4LDoNi1GOIbuzB0OvfPm47dnn0q1pzk016+0VVgIgRg0 -Fu5LwzOn4Brrqn0tJ0FuDOBE+f53R6FcugxSueCtRQ/rpHzQ8Jmprbg7N3stx4MJ -V1luYEeJawoQJb8zPTW1U/g55TrGcytD2z+wcxd/BXxnq0GohA+AUbdz+z4qnSNH -ZxcLaWRhaIMlWuQ/kuaPTnIXxxRluLheqnr0WMlVgH+c+OKu6CzDJk1kaypHpGo4 -sigeChEgQD1YAFAQZ7hr52it2pSwfIFSXViyE7W/lnek4dFYKGOk5c90AePGGWaw -zmH/ODvh2xPHKAjYS41GNg4ZyojOEPZ19NR5Mhg7BMdn5r0h4T7E80QfHWWxKQEb -Mx8nsqk9a+xluBCXi7Cs65CeqazaC3/QZsGUeO5kGoamSuFW9xRobxCsOgvp50sY -IMFLDq+HjJmdADS358P07w== +U2FsdGVkX18yBxdXn/WEsxApENo5QAn/0GfUrFo2ak5yobTZSNes4SZ9w+wYc6q7 +veu+beozOcFzdTyAqJLirKuQ611E1plRaDziK+kuEzq0EMgs4xJcNSf7fKyxaXah +mnM9bels46ctMft4mYEVyUK++4vQimYWA6d0P5p8enKKr/5xZ6MjXLzhKDR0AaFf +7T7o5KZo37ZABHrPYh+w70dtHy1SmUymOJiMbGnfFJmyrFPXC5+aF0mZ6VsWK/e9 +Q9HbxmxleWTA8Mdl4A63byFp5UmK4ZZUlUGK+9uDK/Tdji4x0q4aFCHmb/9FBRPT +KgHYZ0yzt8sJF9hXfspuikWDAgonMEXNLPc7XUW/asdOUxMRYwnmy8JzIYfJfUTC +CkyvGtBWn3IuG5H6/gMhPAxBd1uW6zDQTY6YshAEuUuNv815+9NjRCmE7w5951Tw +40DnDbpR5+6WjkPZn8ZXSPEf+Abtz05swuV9/JG9vS/mwyq8tSneSxJzJUJyUidz +YgIdvwwKGYqYwZIE+3ZG0GcFfQ8XgiCVOx9mxPB7Y6ZUfjgYyRTMyXRS2Q4Ay/WO +0M3Yz1x/M17ruIhYbLNcDGOBAORxjYwLysPW+PJCgzf0A452ROiYYTnV7krU+HMD +C5Z5YdrOy8qKFtNOM1mcuQ== diff --git a/dev/secrets_configuration.sh b/dev/secrets_configuration.sh index 4ed4ba47..e97bcf64 100644 --- a/dev/secrets_configuration.sh +++ b/dev/secrets_configuration.sh @@ -1,6 +1,6 @@ export VARNAME_CI_SECRET="EROTEMIC_CI_SECRET" -export VARNAME_TWINE_USERNAME="TWINE_USERNAME" -export VARNAME_TWINE_PASSWORD="TWINE_PASSWORD" -export VARNAME_TEST_TWINE_USERNAME="TEST_TWINE_USERNAME" -export VARNAME_TEST_TWINE_PASSWORD="TEST_TWINE_PASSWORD" +export VARNAME_TWINE_PASSWORD="EROTEMIC_PYPI_MASTER_TOKEN" +export VARNAME_TEST_TWINE_PASSWORD="EROTEMIC_TEST_PYPI_MASTER_TOKEN" +export VARNAME_TWINE_USERNAME="EROTEMIC_PYPI_MASTER_TOKEN_USERNAME" +export VARNAME_TEST_TWINE_USERNAME="EROTEMIC_TEST_PYPI_MASTER_TOKEN_USERNAME" export GPG_IDENTIFIER="=Erotemic-CI " diff --git a/dev/setup_secrets.sh b/dev/setup_secrets.sh index 67f96f43..1ead971d 100644 --- a/dev/setup_secrets.sh +++ b/dev/setup_secrets.sh @@ -123,11 +123,11 @@ setup_package_environs(){ setup_package_environs_gitlab_kitware(){ echo ' export VARNAME_CI_SECRET="CI_KITWARE_SECRET" - export VARNAME_TWINE_USERNAME="TWINE_USERNAME" - export VARNAME_TWINE_PASSWORD="TWINE_PASSWORD" - export VARNAME_TEST_TWINE_USERNAME="TEST_TWINE_USERNAME" - export VARNAME_TEST_TWINE_PASSWORD="TEST_TWINE_PASSWORD" + export VARNAME_TWINE_PASSWORD="EROTEMIC_PYPI_MASTER_TOKEN" + export VARNAME_TEST_TWINE_PASSWORD="EROTEMIC_TEST_PYPI_MASTER_TOKEN" export VARNAME_PUSH_TOKEN="GITLAB_KITWARE_TOKEN" + export VARNAME_TWINE_USERNAME="EROTEMIC_PYPI_MASTER_TOKEN_USERNAME" + export VARNAME_TEST_TWINE_USERNAME="EROTEMIC_TEST_PYPI_MASTER_TOKEN_USERNAME" export GPG_IDENTIFIER="=Erotemic-CI " ' | python -c "import sys; from textwrap import dedent; print(dedent(sys.stdin.read()).strip(chr(10)))" > dev/secrets_configuration.sh git add dev/secrets_configuration.sh @@ -136,10 +136,10 @@ setup_package_environs_gitlab_kitware(){ setup_package_environs_github_erotemic(){ echo ' export VARNAME_CI_SECRET="EROTEMIC_CI_SECRET" - export VARNAME_TWINE_USERNAME="TWINE_USERNAME" - export VARNAME_TWINE_PASSWORD="TWINE_PASSWORD" - export VARNAME_TEST_TWINE_USERNAME="TEST_TWINE_USERNAME" - export VARNAME_TEST_TWINE_PASSWORD="TEST_TWINE_PASSWORD" + export VARNAME_TWINE_PASSWORD="EROTEMIC_PYPI_MASTER_TOKEN" + export VARNAME_TEST_TWINE_PASSWORD="EROTEMIC_TEST_PYPI_MASTER_TOKEN" + export VARNAME_TWINE_USERNAME="EROTEMIC_PYPI_MASTER_TOKEN_USERNAME" + export VARNAME_TEST_TWINE_USERNAME="EROTEMIC_TEST_PYPI_MASTER_TOKEN_USERNAME" export GPG_IDENTIFIER="=Erotemic-CI " ' | python -c "import sys; from textwrap import dedent; print(dedent(sys.stdin.read()).strip(chr(10)))" > dev/secrets_configuration.sh git add dev/secrets_configuration.sh @@ -148,9 +148,11 @@ setup_package_environs_github_erotemic(){ setup_package_environs_github_pyutils(){ echo ' export VARNAME_CI_SECRET="PYUTILS_CI_SECRET" + export VARNAME_TWINE_PASSWORD="PYUTILS_PYPI_MASTER_TOKEN" + export VARNAME_TEST_TWINE_PASSWORD="PYUTILS_TEST_PYPI_MASTER_TOKEN" + export VARNAME_TWINE_USERNAME="PYUTILS_PYPI_MASTER_TOKEN_USERNAME" + export VARNAME_TEST_TWINE_USERNAME="PYUTILS_TEST_PYPI_MASTER_TOKEN_USERNAME" export GPG_IDENTIFIER="=PyUtils-CI " - export VARNAME_TWINE_PASSWORD="PYUTILS_TWINE_PASSWORD" - export VARNAME_TWINE_PASSWORD="PYUTILS_TWINE_PASSWORD" ' | python -c "import sys; from textwrap import dedent; print(dedent(sys.stdin.read()).strip(chr(10)))" > dev/secrets_configuration.sh git add dev/secrets_configuration.sh @@ -163,14 +165,40 @@ setup_package_environs_github_pyutils(){ upload_github_secrets(){ load_secrets unset GITHUB_TOKEN - gh auth login + #printf "%s" "$GITHUB_TOKEN" | gh auth login --hostname Github.com --with-token + gh auth login source dev/secrets_configuration.sh - gh secret set "$VARNAME_CI_SECRET" -b"${!VARNAME_CI_SECRET}" - gh secret set "$VARNAME_TWINE_USERNAME" -b"${!VARNAME_TWINE_USERNAME}" - gh secret set "$VARNAME_TWINE_PASSWORD" -b"${!VARNAME_TWINE_PASSWORD}" - gh secret set "$VARNAME_TEST_TWINE_PASSWORD" -b"${!VARNAME_TEST_TWINE_PASSWORD}" - gh secret set "$VARNAME_TEST_TWINE_USERNAME" -b"${!VARNAME_TEST_TWINE_USERNAME}" + gh secret set "TWINE_USERNAME" -b"${!VARNAME_TWINE_USERNAME}" + gh secret set "TEST_TWINE_USERNAME" -b"${!VARNAME_TEST_TWINE_USERNAME}" + toggle_setx_enter + gh secret set "CI_SECRET" -b"${!VARNAME_CI_SECRET}" + gh secret set "TWINE_PASSWORD" -b"${!VARNAME_TWINE_PASSWORD}" + gh secret set "TEST_TWINE_PASSWORD" -b"${!VARNAME_TEST_TWINE_PASSWORD}" + toggle_setx_exit +} + + +toggle_setx_enter(){ + # Can we do something like a try/finally? + # https://stackoverflow.com/questions/15656492/writing-try-catch-finally-in-shell + echo "Enter sensitive area" + if [[ -n "${-//[^x]/}" ]]; then + __context_1_toggle_setx=1 + else + __context_1_toggle_setx=0 + fi + if [[ "$__context_1_toggle_setx" == "1" ]]; then + echo "Setx was on, disable temporarilly" + set +x + fi +} +toggle_setx_exit(){ + echo "Exit sensitive area" + # Can we guarentee this will happen? + if [[ "$__context_1_toggle_setx" == "1" ]]; then + set -x + fi } @@ -210,7 +238,7 @@ upload_gitlab_group_secrets(){ fi source dev/secrets_configuration.sh - SECRET_VARNAME_ARR=(VARNAME_CI_SECRET VARNAME_TWINE_USERNAME VARNAME_TWINE_PASSWORD VARNAME_TEST_TWINE_PASSWORD VARNAME_TEST_TWINE_USERNAME VARNAME_PUSH_TOKEN) + SECRET_VARNAME_ARR=(VARNAME_CI_SECRET VARNAME_TWINE_PASSWORD VARNAME_TEST_TWINE_PASSWORD VARNAME_TWINE_USERNAME VARNAME_TEST_TWINE_USERNAME VARNAME_PUSH_TOKEN) for SECRET_VARNAME_PTR in "${SECRET_VARNAME_ARR[@]}"; do SECRET_VARNAME=${!SECRET_VARNAME_PTR} echo "" @@ -228,6 +256,8 @@ upload_gitlab_group_secrets(){ if [[ "$REMOTE_VALUE" == "" ]]; then # New variable echo "Remove variable does not exist, posting" + + toggle_setx_enter curl --request POST --header "PRIVATE-TOKEN: $PRIVATE_GITLAB_TOKEN" "$HOST/api/v4/groups/$GROUP_ID/variables" \ --form "key=${SECRET_VARNAME}" \ --form "value=${LOCAL_VALUE}" \ @@ -235,11 +265,14 @@ upload_gitlab_group_secrets(){ --form "masked=true" \ --form "environment_scope=*" \ --form "variable_type=env_var" + toggle_setx_exit elif [[ "$REMOTE_VALUE" != "$LOCAL_VALUE" ]]; then echo "Remove variable does not agree, putting" # Update variable value + toggle_setx_enter curl --request PUT --header "PRIVATE-TOKEN: $PRIVATE_GITLAB_TOKEN" "$HOST/api/v4/groups/$GROUP_ID/variables/$SECRET_VARNAME" \ --form "value=${LOCAL_VALUE}" + toggle_setx_exit else echo "Remote value agrees with local" fi @@ -269,18 +302,25 @@ upload_gitlab_repo_secrets(){ fi TMP_DIR=$(mktemp -d -t ci-XXXXXXXXXX) + toggle_setx_enter curl --header "PRIVATE-TOKEN: $PRIVATE_GITLAB_TOKEN" "$HOST/api/v4/groups" > "$TMP_DIR/all_group_info" + toggle_setx_exit GROUP_ID=$(cat "$TMP_DIR/all_group_info" | jq ". | map(select(.path==\"$GROUP_NAME\")) | .[0].id") echo "GROUP_ID = $GROUP_ID" + toggle_setx_enter curl --header "PRIVATE-TOKEN: $PRIVATE_GITLAB_TOKEN" "$HOST/api/v4/groups/$GROUP_ID" > "$TMP_DIR/group_info" + toggle_setx_exit + GROUP_ID=$(cat "$TMP_DIR/all_group_info" | jq ". | map(select(.path==\"$GROUP_NAME\")) | .[0].id") cat "$TMP_DIR/group_info" | jq PROJECT_ID=$(cat "$TMP_DIR/group_info" | jq ".projects | map(select(.path==\"$PROJECT_NAME\")) | .[0].id") echo "PROJECT_ID = $PROJECT_ID" # Get group-level secret variables + toggle_setx_enter curl --header "PRIVATE-TOKEN: $PRIVATE_GITLAB_TOKEN" "$HOST/api/v4/projects/$PROJECT_ID/variables" > "$TMP_DIR/project_vars" + toggle_setx_exit cat "$TMP_DIR/project_vars" | jq '.[] | .key' if [[ "$?" != "0" ]]; then echo "Failed to access project level variables. Probably a permission issue" @@ -288,7 +328,7 @@ upload_gitlab_repo_secrets(){ LIVE_MODE=1 source dev/secrets_configuration.sh - SECRET_VARNAME_ARR=(VARNAME_CI_SECRET VARNAME_TWINE_USERNAME VARNAME_TWINE_PASSWORD VARNAME_TEST_TWINE_PASSWORD VARNAME_TEST_TWINE_USERNAME VARNAME_PUSH_TOKEN) + SECRET_VARNAME_ARR=(VARNAME_CI_SECRET VARNAME_TWINE_PASSWORD VARNAME_TEST_TWINE_PASSWORD VARNAME_TWINE_USERNAME VARNAME_TEST_TWINE_USERNAME VARNAME_PUSH_TOKEN) for SECRET_VARNAME_PTR in "${SECRET_VARNAME_ARR[@]}"; do SECRET_VARNAME=${!SECRET_VARNAME_PTR} echo "" @@ -353,6 +393,15 @@ export_encrypted_code_signing_keys(){ MAIN_GPG_KEYID=$(gpg --list-keys --keyid-format LONG "$GPG_IDENTIFIER" | head -n 2 | tail -n 1 | awk '{print $1}') GPG_SIGN_SUBKEY=$(gpg --list-keys --with-subkey-fingerprints "$GPG_IDENTIFIER" | grep "\[S\]" -A 1 | tail -n 1 | awk '{print $1}') + # Careful, if you don't have a subkey, requesting it will export more than you want. + # Export the main key instead (its better to have subkeys, but this is a lesser evil) + if [[ "$GPG_SIGN_SUBKEY" == "" ]]; then + # NOTE: if you get here this probably means your subkeys expired (and + # wont even be visible), so we probably should check for that here and + # thrown an error instead of using this hack, which likely wont work + # anyway. + GPG_SIGN_SUBKEY=$(gpg --list-keys --with-subkey-fingerprints "$GPG_IDENTIFIER" | grep "\[C\]" -A 1 | tail -n 1 | awk '{print $1}') + fi echo "MAIN_GPG_KEYID = $MAIN_GPG_KEYID" echo "GPG_SIGN_SUBKEY = $GPG_SIGN_SUBKEY" @@ -388,6 +437,11 @@ export_encrypted_code_signing_keys(){ } +# See the xcookie module gitlab python API +#gitlab_set_protected_branches(){ +#} + + _test_gnu(){ # shellcheck disable=SC2155 export GNUPGHOME=$(mktemp -d -t) diff --git a/publish.sh b/publish.sh index 97e60bc0..cee2385a 100755 --- a/publish.sh +++ b/publish.sh @@ -405,13 +405,9 @@ WHEEL_PATHS_STR=$(printf '"%s" ' "${WHEEL_PATHS[@]}") echo "WHEEL_PATHS_STR = $WHEEL_PATHS_STR" echo " - -GLOBED ------- MODE=$MODE VERSION='$VERSION' WHEEL_PATHS='$WHEEL_PATHS_STR' - " diff --git a/run_doctests.sh b/run_doctests.sh index f591cde9..269b7c88 100755 --- a/run_doctests.sh +++ b/run_doctests.sh @@ -1,2 +1,2 @@ -#!/bin/bash -xdoctest vtool_ibeis --style=google all +#!/usr/bin/env bash +xdoctest vtool_ibeis --style=google all "$@" \ No newline at end of file diff --git a/run_tests.py b/run_tests.py index 599afe51..c1a3bc7c 100755 --- a/run_tests.py +++ b/run_tests.py @@ -3,10 +3,10 @@ import pytest import sys package_name = 'vtool_ibeis' - mod_dpath = package_name + mod_dpath = 'vtool_ibeis' test_dpath = 'tests' pytest_args = [ - '--cov-config', '.coveragerc', + '--cov-config', 'pyproject.toml', '--cov-report', 'html', '--cov-report', 'term', '--xdoctest', From acae01e1e879a58281d03e3eadda697a831416ee Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 29 Jan 2023 02:05:40 -0500 Subject: [PATCH 10/23] wip --- .github/workflows/tests.yml | 5 ----- pyproject.toml | 2 +- requirements/optional.txt | 2 +- requirements/tests.txt | 41 ++++++++++++++++++++++++++++++++----- 4 files changed, 38 insertions(+), 12 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c6f55f8d..ed00b39f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,11 +28,6 @@ jobs: run: |- # stop the build if there are Python syntax errors or undefined names flake8 ./vtool_ibeis --count --select=E9,F63,F7,F82 --show-source --statistics - - name: Typecheck with mypy - run: |- - python -m pip install mypy - mypy --install-types --non-interactive ./vtool_ibeis - mypy ./vtool_ibeis build_and_test_sdist: name: Test sdist Python 3.8 runs-on: ubuntu-latest diff --git a/pyproject.toml b/pyproject.toml index 86fc9951..52783719 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ requires = [ "setuptools>=41.0.1", "wheel>=0.37.1",] ignore_missing_imports = true [tool.xcookie] -tags = [ "purepy", "github", "erotemic", "cv2"] +tags = [ "purepy", "github", "erotemic", "cv2", "notypes"] mod_name = "vtool_ibeis" repo_name = "vtool_ibeis" url = "https://github.com/Erotemic/vtool_ibeis" diff --git a/requirements/optional.txt b/requirements/optional.txt index d55e1244..563b55f5 100644 --- a/requirements/optional.txt +++ b/requirements/optional.txt @@ -8,4 +8,4 @@ pyflann_ibeis>=2.2.0 ; python_version < '3.8' and python_version >= '3.7' pyhesaff >= 2.1.0 -vtool_ibeis_ext>=0.1.0 +vtool_ibeis_ext>=0.1.1 diff --git a/requirements/tests.txt b/requirements/tests.txt index 157d67d3..be6a7144 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -1,5 +1,36 @@ -xdoctest >= 0.3.0 -pytest >= 3.3.1 -pytest-cov -coverage >= 4.3.4 -codecov >= 2.0.15 +xdoctest>=0.14.0 + +# Pin maximum pytest versions for older python versions +# TODO: determine what the actual minimum and maximum acceptable versions of +# pytest (that are also compatible with xdoctest) are for each legacy python +# major.minor version. +# See ~/local/tools/supported_python_versions_pip.py for helper script +pytest>=6.2.5 ; python_version >= '3.10.0' # Python 3.10+ +pytest>=4.6.0 ; python_version < '3.10.0' and python_version >= '3.7.0' # Python 3.7-3.9 +pytest>=4.6.0 ; python_version < '3.7.0' and python_version >= '3.6.0' # Python 3.6 +pytest>=4.6.0, <= 6.1.2 ; python_version < '3.6.0' and python_version >= '3.5.0' # Python 3.5 +pytest>=4.6.0, <= 4.6.11 ; python_version < '3.5.0' and python_version >= '3.4.0' # Python 3.4 +pytest>=4.6.0, <= 4.6.11 ; python_version < '2.8.0' and python_version >= '2.7.0' # Python 2.7 + +## +#pytest-cov >= 2.6.0 ; python_version >= '3.7.0' +#pytest-cov >= 2.6.0, <= 2.8.1 ; python_version < '3.7.0' and python_version >= '3.6.0' + +pytest-cov>=3.0.0 ; python_version >= '3.6.0' # Python 3.6+ +pytest-cov>=2.9.0 ; python_version < '3.6.0' and python_version >= '3.5.0' # Python 3.5 +pytest-cov>=2.8.1 ; python_version < '3.5.0' and python_version >= '3.4.0' # Python 3.4 +pytest-cov>=2.8.1 ; python_version < '2.8.0' and python_version >= '2.7.0' # Python 2.7 + +# python ~/local/tools/supported_python_versions_pip.py xdoctest +# python ~/local/tools/supported_python_versions_pip.py coverage +coverage>=6.1.1 ; python_version >= '3.10' # Python 3.10+ +coverage>=5.3.1 ; python_version < '3.10' and python_version >= '3.9' # Python 3.9 +coverage>=6.1.1 ; python_version < '3.9' and python_version >= '3.8' # Python 3.8 +coverage>=6.1.1 ; python_version < '3.8' and python_version >= '3.7' # Python 3.7 +coverage>=6.1.1 ; python_version < '3.7' and python_version >= '3.6' # Python 3.6 +coverage>=5.3.1 ; python_version < '3.6' and python_version >= '3.5' # Python 3.5 +coverage>=4.3.4 ; python_version < '3.5' and python_version >= '3.4' # Python 3.4 +coverage>=5.3.1 ; python_version < '3.4' and python_version >= '2.7' # Python 2.7 +coverage>=4.5 ; python_version < '2.7' and python_version >= '2.6' # Python 2.6 + +codecov>=2.0.15 From 7ca98a8d5ec3324caa519429eacfab0b3ace4655 Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 29 Jan 2023 02:18:27 -0500 Subject: [PATCH 11/23] Bump statsmodels --- requirements/runtime.txt | 5 +++-- vtool_ibeis/spatial_verification.py | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/requirements/runtime.txt b/requirements/runtime.txt index 34e1276c..6cab64e0 100644 --- a/requirements/runtime.txt +++ b/requirements/runtime.txt @@ -43,10 +43,11 @@ scikit-learn>=1.0.2 ; python_version < '3.9' and python_version >= '3.8' scikit-learn>=0.24.1 ; python_version < '3.8' and python_version >= '3.7' # Python 3.7 scikit-learn>=0.24.1 ; python_version < '3.7' and python_version >= '3.6' # Python 3.6 -statsmodels>=0.13.1 ; python_version >= '3.10' # Python 3.10+ +statsmodels>=0.13.1 ; python_version < '4.0' and python_version >= '3.11' # Python 3.11+ +statsmodels>=0.13.1 ; python_version < '3.11' and python_version >= '3.10' # Python 3.10 statsmodels>=0.13.1 ; python_version < '3.10' and python_version >= '3.9' # Python 3.9 statsmodels>=0.13.1 ; python_version < '3.9' and python_version >= '3.8' # Python 3.8 -statsmodels>=0.9.0 ; python_version < '3.8' and python_version >= '3.7' # Python 3.7 +statsmodels>=0.12.2 ; python_version < '3.8' and python_version >= '3.7' # Python 3.7 ubelt >= 1.2.3 utool >= 2.1.7 diff --git a/vtool_ibeis/spatial_verification.py b/vtool_ibeis/spatial_verification.py index 0c1049ed..3fa4a0fb 100755 --- a/vtool_ibeis/spatial_verification.py +++ b/vtool_ibeis/spatial_verification.py @@ -270,7 +270,6 @@ def compute_affine(xy1_man, xy2_man): >>> from vtool_ibeis.spatial_verification import * # NOQA >>> import vtool_ibeis.demodata as demodata >>> import vtool_ibeis.keypoint as ktool - >>> import plottool_ibeis as pt >>> xy1_man, xy2_man, rchip1, rchip2, T1, T2 = testdata_matching_affine_inliers_normalized() >>> A_prime = compute_affine(xy1_man, xy2_man) >>> A = npl.solve(T2, A_prime).dot(T1) @@ -278,6 +277,7 @@ def compute_affine(xy1_man, xy2_man): >>> result = np.array_str(A, precision=2) >>> print(result) >>> # xdoctest: +REQUIRES(--show) + >>> import plottool_ibeis as pt >>> rchip2_blendA = pt.draw_sv.get_blended_chip(rchip1, rchip2, A) >>> pt.imshow(rchip2_blendA) >>> ut.show_if_requested() @@ -694,7 +694,6 @@ def test_homog_errors(H, kpts1, kpts2, fm, xy_thresh_sqrd, scale_thresh, Example0: >>> # DISABLE_DOCTEST >>> from vtool_ibeis.spatial_verification import * # NOQA - >>> import plottool_ibeis as pt >>> kpts1, kpts2, fm, aff_inliers, rchip1, rchip2, xy_thresh_sqrd = testdata_matching_affine_inliers() >>> H = estimate_refined_transform(kpts1, kpts2, fm, aff_inliers) >>> scale_thresh, ori_thresh = 2.0, 1.57 @@ -702,13 +701,13 @@ def test_homog_errors(H, kpts1, kpts2, fm, xy_thresh_sqrd, scale_thresh, >>> homog_tup1 = test_homog_errors(H, kpts1, kpts2, fm, xy_thresh_sqrd, scale_thresh, ori_thresh, full_homog_checks) >>> homog_tup = (homog_tup1[0], homog_tup1[2]) >>> # xdoctest: +REQUIRES(--show) + >>> import plottool_ibeis as pt >>> pt.draw_sv.show_sv(rchip1, rchip2, kpts1, kpts2, fm, homog_tup=homog_tup) >>> ut.show_if_requested() Example1: >>> # DISABLE_DOCTEST >>> from vtool_ibeis.spatial_verification import * # NOQA - >>> import plottool_ibeis as pt >>> kpts1, kpts2, fm_, aff_inliers, rchip1, rchip2, xy_thresh_sqrd = testdata_matching_affine_inliers() >>> H = estimate_refined_transform(kpts1, kpts2, fm_, aff_inliers) >>> scale_thresh, ori_thresh = 2.0, 1.57 @@ -731,6 +730,7 @@ def test_homog_errors(H, kpts1, kpts2, fm, xy_thresh_sqrd, scale_thresh, ... 'kpts1_m, kpts2_m, off_xy1_m, off_xy1_mt, dxy1_m, dxy1_mt, xy2_m, xy1_m, xy1_mt, scale_err, xy_err, ori_err'.split(', ')) >>> #--------------- >>> # xdoctest: +REQUIRES(--show) + >>> import plottool_ibeis as pt >>> pt.figure(fnum=1, pnum=(1, 2, 1), title='orig points and offset point') >>> segments_list1 = np.array(list(zip(xy1_m.T.tolist(), off_xy1_m.T.tolist()))) >>> pt.draw_line_segments(segments_list1, color=pt.LIGHT_BLUE) @@ -871,11 +871,11 @@ def refine_inliers(kpts1, kpts2, fm, aff_inliers, xy_thresh_sqrd, >>> # DISABLE_DOCTEST >>> from vtool_ibeis.spatial_verification import * # NOQA >>> import vtool_ibeis.keypoint as ktool - >>> import plottool_ibeis as pt >>> kpts1, kpts2, fm, aff_inliers, rchip1, rchip2, xy_thresh_sqrd = testdata_matching_affine_inliers() >>> homog_tup1 = refine_inliers(kpts1, kpts2, fm, aff_inliers, xy_thresh_sqrd) >>> homog_tup = (homog_tup1[0], homog_tup1[2]) >>> # xdoctest: +REQUIRES(--show) + >>> import plottool_ibeis as pt >>> pt.draw_sv.show_sv(rchip1, rchip2, kpts1, kpts2, fm, homog_tup=homog_tup) >>> ut.show_if_requested() From b8657a100e7119ad1cc8e92138b98c062f855a53 Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 29 Jan 2023 02:25:11 -0500 Subject: [PATCH 12/23] wip --- requirements/runtime.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/requirements/runtime.txt b/requirements/runtime.txt index 6cab64e0..2743bc49 100644 --- a/requirements/runtime.txt +++ b/requirements/runtime.txt @@ -17,11 +17,12 @@ Pillow>=8.3.2 ; python_version < '3.9' and python_version >= '3.8' # Pyth Pillow>=9.0.0 ; python_version < '3.8' and python_version >= '3.7' # Python 3.7 Pillow>=8.3.2 ; python_version < '3.7' and python_version >= '3.6' # Python 3.6 -numpy>=1.21.6 ; python_version >= '3.10' # Python 3.10+ -numpy>=1.21.0 ; python_version < '3.10' and python_version >= '3.9' # Python 3.9 -numpy>=1.21.0 ; python_version < '3.9' and python_version >= '3.8' # Python 3.8 -numpy>=1.20.0 ; python_version < '3.8' and python_version >= '3.7' # Python 3.7 -numpy>=1.19.0 ; python_version < '3.7' and python_version >= '3.6' # Python 3.6 +numpy>=1.23.2 ; python_version >= '3.11' # Python 3.11 +numpy>=1.21.6 ; python_version < '3.11' and python_version >= '3.10' # Python 3.10 +numpy>=1.19.3 ; python_version < '3.10' and python_version >= '3.9' # Python 3.9 +numpy>=1.19.2 ; python_version < '3.9' and python_version >= '3.8' # Python 3.8 +numpy>=1.19.2 ; python_version < '3.8' and python_version >= '3.7' # Python 3.7 +numpy>=1.19.2 ; python_version < '3.7' and python_version >= '3.6' # Python 3.6 scipy>=1.8.0 ; python_version >= '3.10' # Python 3.10+ scipy>=1.8.0 ; python_version < '3.10' and python_version >= '3.9' # Python 3.9 From ae2296bfb7330e2b86def587b68da81f4d803d4d Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 29 Jan 2023 02:49:25 -0500 Subject: [PATCH 13/23] Updates --- docs/Makefile | 20 +++++++++++++++++ docs/make.bat | 35 +++++++++++++++++++++++++++++ requirements/runtime.txt | 2 ++ vtool_ibeis/clustering2.py | 1 + vtool_ibeis/image.py | 6 ++++- vtool_ibeis/image_shared.py | 2 +- vtool_ibeis/keypoint.py | 17 ++++++++------ vtool_ibeis/spatial_verification.py | 2 ++ 8 files changed, 76 insertions(+), 9 deletions(-) create mode 100644 docs/Makefile create mode 100644 docs/make.bat diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 00000000..d0c3cbf1 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 00000000..6fcf05b4 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +set BUILDDIR=build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/requirements/runtime.txt b/requirements/runtime.txt index 2743bc49..1630362a 100644 --- a/requirements/runtime.txt +++ b/requirements/runtime.txt @@ -55,3 +55,5 @@ utool >= 2.1.7 delorean >= 1.0.0 # python ~/local/tools/supported_python_versions_pip.py delorean + +packaging>=21.3 diff --git a/vtool_ibeis/clustering2.py b/vtool_ibeis/clustering2.py index 4e61b709..7454e8fc 100755 --- a/vtool_ibeis/clustering2.py +++ b/vtool_ibeis/clustering2.py @@ -167,6 +167,7 @@ def group_indices(idx2_groupid, assume_sorted=False): >>> (keys, groupxs) = group_indices(idx2_groupid) >>> result = ut.repr2((keys, groupxs), nl=2, nobr=True, with_dtype=True) >>> print(result) + np.array([False, True], dtype=bool), [ np.array([2, 4, 5], dtype=np.int64), diff --git a/vtool_ibeis/image.py b/vtool_ibeis/image.py index 4cd92f33..2364582f 100755 --- a/vtool_ibeis/image.py +++ b/vtool_ibeis/image.py @@ -10,6 +10,11 @@ import utool as ut import ubelt as ub +try: + from packaging.version import parse as LooseVersion +except ImportError: + from distutils.version import LooseVersion + if cv2 is not None: @@ -39,7 +44,6 @@ try: IMREAD_COLOR = cv2.IMREAD_COLOR except AttributeError: - from distutils.version import LooseVersion cv2_version = LooseVersion(cv2.__version__) print('UNKNOWN cv2_version = {!r}'.format(cv2_version)) assert cv2_version.version[0] <= 2 diff --git a/vtool_ibeis/image_shared.py b/vtool_ibeis/image_shared.py index 4a3769d1..88df2661 100755 --- a/vtool_ibeis/image_shared.py +++ b/vtool_ibeis/image_shared.py @@ -13,5 +13,5 @@ def print_image_checks(img_fpath): _tup = (img_fpath, ut.filesize_str(img_fpath)) print('[io] Image %r (%s) exists. Is it corrupted?' % _tup) else: - print('[io] Image %r does not exists ' (img_fpath,)) + print('[io] Image %r does not exist ' % (img_fpath,)) return hasimg diff --git a/vtool_ibeis/keypoint.py b/vtool_ibeis/keypoint.py index c30058bc..4894b81d 100755 --- a/vtool_ibeis/keypoint.py +++ b/vtool_ibeis/keypoint.py @@ -129,8 +129,7 @@ using np.take is a better idea, but its a bit harder to use with multidimensional arrays (nope use axis=x) """ -from __future__ import absolute_import, division, print_function -from six.moves import zip, range, reduce +from functools import reduce import numpy as np import numpy.linalg as npl from vtool_ibeis import linalg as linalgtool @@ -1189,13 +1188,11 @@ def get_invVR_mats_oris(invVR_mats): >>> # nptheta = np.linspace(0, 2 * np.pi, 32, endpoint=False) - mapping = np.arctan(np.tan(nptheta)) print(ub.repr2(zip(nptheta / (2 * np.pi), nptheta, mapping, nptheta == mapping), precision=3)) print(ub.repr2(zip(nptheta / (2 * np.pi), nptheta, mapping % (np.pi * 2), nptheta == mapping % (np.pi * 2)), precision=3)) - + >>> # xdoctest: +SKIP >>> # NUMPY CHECKS - >>> nptheta_special = [ np.arccos(0), -np.arccos(0), -np.arcsin(0), np.arcsin(0) ] >>> nptheta = np.array(np.linspace(0, 2 * np.pi, 64, endpoint=False).tolist() + nptheta_special) >>> # Case 1 @@ -1205,6 +1202,7 @@ def get_invVR_mats_oris(invVR_mats): >>> case1_result = (-np.arctan(np.tan(-case1_theta)) % TAU) >>> case1_theta == case1_result + >>> # xdoctest: +SKIP >>> print(ub.repr2(zip(case1_theta, case1_result, vt.ori_distance(case1_theta, case1_result) ), precision=3)) >>> # >>> # Case 2 @@ -1237,8 +1235,8 @@ def get_invVR_mats_oris(invVR_mats): # numpy check - >>> # LATEX PART + >>> # xdoctest: +SKIP >>> expr1_repr = vt.sympy_latex_repr(invTVR_held_full) >>> print(expr1_repr) >>> @@ -1246,6 +1244,7 @@ def get_invVR_mats_oris(invVR_mats): >>> print(expr1_repr) + >>> # xdoctest: +SKIP >>> from sympy import Symbol, Q, refine, atan2 >>> from sympy.assumptions.refine import refine_atan2 >>> from sympy.abc import x, y @@ -1256,9 +1255,9 @@ def get_invVR_mats_oris(invVR_mats): atan(y/x) - pi atan(y/x) + pi + >>> # xdoctest: +SKIP >>> negtheta = sympy.symbols('negtheta', **symkw) >>> ori_subs2 = sympy.simplify(sympy.trigsimp(ori_subs)) - >>> ori_subs3 = ori_subs2.subs({theta:-negtheta}) >>> ori_subs4 = sympy.simplify(ori_subs3) Out[45]: Mod(-atan2(sin(negtheta)/a, cos(negtheta)/a), 2*pi) @@ -1283,17 +1282,20 @@ def get_invVR_mats_oris(invVR_mats): + >>> # xdoctest: +SKIP >>> ori_subs3 = ori_subs2.subs({theta:0}) >>> ori_subs3 = ori_subs2.subs(dict(theta=0), simultanious=True) for sym in ori_subs2.free_symbols: print('%r.assumptions0 = %s' % (sym, ub.repr2(sym.assumptions0),)) + >>> # xdoctest: +SKIP >>> #invTVR = sympy.simplify(RVT_full.inv()) >>> expr1_repr = vt.sympy_latex_repr(invTVR_full) >>> print(expr1_repr) Sympy: + >>> # xdoctest: +SKIP >>> import sympy >>> import vtool_ibeis as vt >>> # First orient a unit circle @@ -1340,6 +1342,7 @@ def get_invVR_mats_oris(invVR_mats): Sympy: >>> # Show orientation property + >>> # xdoctest: +SKIP >>> import sympy >>> import vtool_ibeis as vt >>> # First orient a unit circle diff --git a/vtool_ibeis/spatial_verification.py b/vtool_ibeis/spatial_verification.py index 3fa4a0fb..73e70df0 100755 --- a/vtool_ibeis/spatial_verification.py +++ b/vtool_ibeis/spatial_verification.py @@ -318,6 +318,7 @@ def compute_homog(xy1_mn, xy2_mn): Example: >>> # ENABLE_DOCTEST + >>> # xdoctest: +REQUIRES(module:pyhesaff) >>> from vtool_ibeis.spatial_verification import * # NOQA >>> import vtool_ibeis.keypoint as ktool >>> import vtool_ibeis.demodata as demodata @@ -334,6 +335,7 @@ def compute_homog(xy1_mn, xy2_mn): Example1: >>> # ENABLE_DOCTEST + >>> # xdoctest: +REQUIRES(module:pyhesaff) >>> from vtool_ibeis.spatial_verification import * # NOQA >>> import vtool_ibeis.keypoint as ktool >>> xy1_man, xy2_man, rchip1, rchip2, T1, T2 = testdata_matching_affine_inliers_normalized() From 76e7bfbfc5cf925cb3cac026acd722e4d66f18cc Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 29 Jan 2023 02:55:00 -0500 Subject: [PATCH 14/23] wip --- vtool_ibeis/confusion.py | 10 +++++----- vtool_ibeis/nearest_neighbors.py | 7 +++++++ vtool_ibeis/other.py | 1 + vtool_ibeis/spatial_verification.py | 1 + 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/vtool_ibeis/confusion.py b/vtool_ibeis/confusion.py index f53529ed..7046fbc4 100644 --- a/vtool_ibeis/confusion.py +++ b/vtool_ibeis/confusion.py @@ -497,7 +497,7 @@ def get_thresh_at_metric(self, metric, value, maximize=None): python -m vtool_ibeis.confusion --exec-interact_roc_factory --show Example: - >>> # DISABLE_DOCTEST + >>> # xdoctest: +SKIP >>> from vtool_ibeis.confusion import * # NOQA >>> scores, labels = testdata_scores_labels() >>> self = ConfusionMetrics().fit(scores, labels) @@ -796,15 +796,15 @@ def interpolate_replbounds(xdata, ydata, pt, maximize=True): >>> print('thresh = %r' % (thresh,)) Example: - >>> # DISABLE_DOCTEST + >>> # xdoctest: +SKIP >>> from vtool_ibeis.confusion import * # NOQA >>> xdata = np.array([0.7, 0.8, 0.8, 0.9, 0.9, 0.9]) >>> ydata = np.array([34, 26, 23, 22, 19, 17]) >>> pt = np.array([.85, 1.0, -1.0]) >>> interp_vals = interpolate_replbounds(xdata, ydata, pt) >>> result = ('interp_vals = %s' % (str(interp_vals),)) + >>> assert np.allclose(results, [ 22.5, 17., 34., ]) >>> print(result) - interp_vals = [ 22.5 17. 34. ] """ if not ut.issorted(xdata): if ut.issorted(xdata[::-1]): @@ -937,7 +937,7 @@ def interact_roc_factory(confusions, target_tpr=None, show_operating_point=False python -m vtool_ibeis.confusion --exec-interact_roc_factory --show Example: - >>> # DISABLE_DOCTEST + >>> # xdoctest: +SKIP >>> from vtool_ibeis.confusion import * # NOQA >>> scores, labels = testdata_scores_labels() >>> print('scores = %r' % (scores,)) @@ -1024,7 +1024,7 @@ def draw_roc_curve(fpr, tpr, fnum=None, pnum=None, marker='', target_tpr=None, python -m vtool_ibeis.confusion --exec-draw_roc_curve --show --lightbg Example: - >>> # DISABLE_DOCTEST + >>> # xdoctest: +SKIP >>> from vtool_ibeis.confusion import * # NOQA >>> scores, labels = testdata_scores_labels() >>> confusions = ConfusionMetrics().fit(scores, labels) diff --git a/vtool_ibeis/nearest_neighbors.py b/vtool_ibeis/nearest_neighbors.py index ec982a32..f3d82171 100755 --- a/vtool_ibeis/nearest_neighbors.py +++ b/vtool_ibeis/nearest_neighbors.py @@ -175,6 +175,7 @@ def ann_flann_once(dpts, qpts, num_neighbors, flann_params={}): Example0: >>> # ENABLE_DOCTEST + >>> # xdoctest: +REQUIRES(module:pyflann_ibeis) >>> from vtool_ibeis.nearest_neighbors import * # NOQA >>> np.random.seed(1) >>> dpts = np.random.randint(0, 255, (5, 128)).astype(np.uint8) @@ -195,6 +196,7 @@ def ann_flann_once(dpts, qpts, num_neighbors, flann_params={}): >>> # ENABLE_DOCTEST >>> # Test upper bounds on sift descriptors >>> # SeeAlso distance.understanding_pseudomax_props + >>> # xdoctest: +REQUIRES(module:pyflann_ibeis) >>> from vtool_ibeis.nearest_neighbors import * # NOQA >>> import vtool_ibeis as vt >>> import numpy as np @@ -300,6 +302,7 @@ def get_flann_cfgstr(dpts, flann_params, cfgstr='', use_params_hash=True, Example: >>> # ENABLE_DOCTEST + >>> # xdoctest: +REQUIRES(module:pyflann_ibeis) >>> from vtool_ibeis.nearest_neighbors import * # NOQA >>> rng = np.random.RandomState(1) >>> dpts = rng.randint(0, 255, (10, 128)).astype(np.uint8) @@ -403,6 +406,7 @@ def flann_augment(dpts, new_dpts, cache_dir, cfgstr, new_cfgstr, flann_params, """ Example: >>> # DISABLE_DOCTEST + >>> # xdoctest: +REQUIRES(module:pyflann_ibeis) >>> from vtool_ibeis.nearest_neighbors import * # NOQA >>> import vtool_ibeis.demodata as demodata # NOQA >>> dpts = demodata.get_dummy_dpts(ut.get_nth_prime(10)) @@ -451,6 +455,7 @@ def get_flann_params(algorithm='kdtree', **kwargs): Example: >>> # ENABLE_DOCTEST + >>> # xdoctest: +REQUIRES(module:pyflann_ibeis) >>> from vtool_ibeis.nearest_neighbors import * # NOQA >>> algorithm = ut.get_argval('--algo', default='kdtree') >>> flann_params = get_flann_params(algorithm) @@ -659,6 +664,7 @@ def flann_index_time_experiment(): Example: >>> # SLOW_DOCTEST >>> # xdoctest: +SKIP + >>> # xdoctest: +REQUIRES(module:pyflann_ibeis) >>> from vtool_ibeis.nearest_neighbors import * # NOQA >>> result = flann_index_time_experiment() >>> print(result) @@ -754,6 +760,7 @@ def invertible_stack(vecs_list, label_list): Example: >>> # DISABLE_DOCTEST + >>> # xdoctest: +REQUIRES(module:pyflann_ibeis) >>> from vtool_ibeis.nearest_neighbors import * # NOQA >>> DESC_TYPE = np.uint8 >>> label_list = [1, 2, 3, 4, 5] diff --git a/vtool_ibeis/other.py b/vtool_ibeis/other.py index 1d20d6af..82d7a903 100644 --- a/vtool_ibeis/other.py +++ b/vtool_ibeis/other.py @@ -1353,6 +1353,7 @@ def get_uncovered_mask(covered_array, covering_array): >>> flags = get_uncovered_mask(covered_array, covering_array) >>> result = ub.repr2(flags, with_dtype=True) >>> print(result) + np.array([[ True, False, True], [False, False, True], [ True, True, True]], dtype=bool) diff --git a/vtool_ibeis/spatial_verification.py b/vtool_ibeis/spatial_verification.py index 73e70df0..54c1663a 100755 --- a/vtool_ibeis/spatial_verification.py +++ b/vtool_ibeis/spatial_verification.py @@ -267,6 +267,7 @@ def compute_affine(xy1_man, xy2_man): Example1: >>> # ENABLE_DOCTEST + >>> # xdoctest: +REQUIRES(module:pyhesaff) >>> from vtool_ibeis.spatial_verification import * # NOQA >>> import vtool_ibeis.demodata as demodata >>> import vtool_ibeis.keypoint as ktool From 2659e373f449b5a2adab731be3468192faa7de80 Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 29 Jan 2023 03:03:11 -0500 Subject: [PATCH 15/23] wip --- requirements/runtime.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/requirements/runtime.txt b/requirements/runtime.txt index 1630362a..3461b6f2 100644 --- a/requirements/runtime.txt +++ b/requirements/runtime.txt @@ -24,7 +24,8 @@ numpy>=1.19.2 ; python_version < '3.9' and python_version >= '3.8' # Python numpy>=1.19.2 ; python_version < '3.8' and python_version >= '3.7' # Python 3.7 numpy>=1.19.2 ; python_version < '3.7' and python_version >= '3.6' # Python 3.6 -scipy>=1.8.0 ; python_version >= '3.10' # Python 3.10+ +scipy>=1.9.2 ; python_version < '4.0' and python_version >= '3.11' # Python 3.11+ +scipy>=1.8.0 ; python_version < '3.11' and python_version >= '3.10' # Python 3.10 scipy>=1.8.0 ; python_version < '3.10' and python_version >= '3.9' # Python 3.9 scipy>=1.8.0 ; python_version < '3.9' and python_version >= '3.8' # Python 3.8 scipy>=1.6.0 ; python_version < '3.8' and python_version >= '3.7' # Python 3.7 @@ -38,7 +39,8 @@ scikit-image>=0.17.2 ; python_version < '3.9' and python_version >= '3.8' scikit-image>=0.17.2 ; python_version < '3.8' and python_version >= '3.7' # Python 3.7 scikit-image>=0.17.2 ; python_version < '3.7' and python_version >= '3.6' # Python 3.6 -scikit-learn>=1.0.2 ; python_version >= '3.10' # Python 3.10+ +scikit-learn>=1.1.3 ; python_version < '4.0' and python_version >= '3.11' # Python 3.11+ +scikit-learn>=1.0.2 ; python_version < '3.11' and python_version >= '3.10' # Python 3.10 scikit-learn>=1.0.2 ; python_version < '3.10' and python_version >= '3.9' # Python 3.9 scikit-learn>=1.0.2 ; python_version < '3.9' and python_version >= '3.8' # Python 3.8 scikit-learn>=0.24.1 ; python_version < '3.8' and python_version >= '3.7' # Python 3.7 From 9474e5561fd36d9a57b63d111377e66879c9aaf6 Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 29 Jan 2023 12:31:09 -0500 Subject: [PATCH 16/23] bump pillow on 311 --- requirements/runtime.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/runtime.txt b/requirements/runtime.txt index 3461b6f2..c7cb997f 100644 --- a/requirements/runtime.txt +++ b/requirements/runtime.txt @@ -10,7 +10,7 @@ networkx>=2.5 ; python_version < '3.7' and python_version >= '3.6' # Py networkx>=2.3 ; python_version < '3.6' and python_version >= '3.5' # Python 3.5 networkx>=1.11 ; python_version < '3.5' and python_version >= '2.7' # Python 2.7 -Pillow>=9.2.0 ; python_version < '4.0' and python_version >= '3.11' # Python 3.11+ +Pillow>=9.4.0 ; python_version < '4.0' and python_version >= '3.11' # Python 3.11+ Pillow>=9.1.0 ; python_version < '3.11' and python_version >= '3.10' # Python 3.10 Pillow>=8.3.2 ; python_version < '3.10' and python_version >= '3.9' # Python 3.9 Pillow>=8.3.2 ; python_version < '3.9' and python_version >= '3.8' # Python 3.8 From 9d0d04313c4a0167a9db95fb2a7cb7bb847af2d8 Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 29 Jan 2023 12:32:12 -0500 Subject: [PATCH 17/23] bump statsmodels on 311 --- requirements/runtime.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/runtime.txt b/requirements/runtime.txt index c7cb997f..88ce3a09 100644 --- a/requirements/runtime.txt +++ b/requirements/runtime.txt @@ -46,7 +46,7 @@ scikit-learn>=1.0.2 ; python_version < '3.9' and python_version >= '3.8' scikit-learn>=0.24.1 ; python_version < '3.8' and python_version >= '3.7' # Python 3.7 scikit-learn>=0.24.1 ; python_version < '3.7' and python_version >= '3.6' # Python 3.6 -statsmodels>=0.13.1 ; python_version < '4.0' and python_version >= '3.11' # Python 3.11+ +statsmodels>=0.13.3 ; python_version < '4.0' and python_version >= '3.11' # Python 3.11+ statsmodels>=0.13.1 ; python_version < '3.11' and python_version >= '3.10' # Python 3.10 statsmodels>=0.13.1 ; python_version < '3.10' and python_version >= '3.9' # Python 3.9 statsmodels>=0.13.1 ; python_version < '3.9' and python_version >= '3.8' # Python 3.8 From 5a169141443e3751d1bf9fe7ae9db73fdf6aceec Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 29 Jan 2023 12:38:09 -0500 Subject: [PATCH 18/23] Update versions --- requirements/optional.txt | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/requirements/optional.txt b/requirements/optional.txt index 563b55f5..3762b733 100644 --- a/requirements/optional.txt +++ b/requirements/optional.txt @@ -1,11 +1,23 @@ # Add requirements here, use the script for help (erotemic needs to publish this script) # python ~/local/tools/supported_python_versions_pip.py pyflann_ibeis -pyflann_ibeis>=2.2.0 ; python_version >= '3.10' # Python 3.10+ +pyflann_ibeis>=2.3.0 ; python_version < '4.0' and python_version >= '3.11' # Python 3.11+ +pyflann_ibeis>=2.2.0 ; python_version < '3.11' and python_version >= '3.10' # Python 3.10 pyflann_ibeis>=2.2.0 ; python_version < '3.10' and python_version >= '3.9' # Python 3.9 pyflann_ibeis>=2.0.0 ; python_version < '3.9' and python_version >= '3.8' # Python 3.8 pyflann_ibeis>=2.2.0 ; python_version < '3.8' and python_version >= '3.7' # Python 3.7 -pyhesaff >= 2.1.0 +pyhesaff>=2.1.1 ; python_version < '4.0' and python_version >= '3.11' # Python 3.11+ +pyhesaff>=2.1.0 ; python_version < '3.11' and python_version >= '3.10' # Python 3.10 +pyhesaff>=2.1.0 ; python_version < '3.10' and python_version >= '3.9' # Python 3.9 +pyhesaff>=2.0.1 ; python_version < '3.9' and python_version >= '3.8' # Python 3.8 +pyhesaff>=2.0.1 ; python_version < '3.8' and python_version >= '3.7' # Python 3.7 +pyhesaff>=2.0.1 ; python_version < '3.7' and python_version >= '3.6' # Python 3.6 -vtool_ibeis_ext>=0.1.1 + +# xdev availpkg vtool_ibeis_ext --refresh +vtool_ibeis_ext>=0.1.1 ; python_version < '4.0' and python_version >= '3.11' # Python 3.11+ +vtool_ibeis_ext>=0.1.0 ; python_version < '3.11' and python_version >= '3.10' # Python 3.10 +vtool_ibeis_ext>=0.1.0 ; python_version < '3.10' and python_version >= '3.9' # Python 3.9 +vtool_ibeis_ext>=0.1.0 ; python_version < '3.9' and python_version >= '3.8' # Python 3.8 +vtool_ibeis_ext>=0.1.0 ; python_version < '3.8' and python_version >= '3.7' # Python 3.7 From 8613886287ac4450a153552efae23e07807f13fb Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 29 Jan 2023 12:40:00 -0500 Subject: [PATCH 19/23] Update versions --- requirements/runtime.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/requirements/runtime.txt b/requirements/runtime.txt index 88ce3a09..fcdd5e0f 100644 --- a/requirements/runtime.txt +++ b/requirements/runtime.txt @@ -17,9 +17,10 @@ Pillow>=8.3.2 ; python_version < '3.9' and python_version >= '3.8' # Pyth Pillow>=9.0.0 ; python_version < '3.8' and python_version >= '3.7' # Python 3.7 Pillow>=8.3.2 ; python_version < '3.7' and python_version >= '3.6' # Python 3.6 -numpy>=1.23.2 ; python_version >= '3.11' # Python 3.11 -numpy>=1.21.6 ; python_version < '3.11' and python_version >= '3.10' # Python 3.10 -numpy>=1.19.3 ; python_version < '3.10' and python_version >= '3.9' # Python 3.9 +# xdev availpkg numpy --refresh +numpy>=1.22.0 ; python_version < '4.0' and python_version >= '3.11' # Python 3.11+ +numpy>=1.21.3 ; python_version < '3.11' and python_version >= '3.10' # Python 3.10 +numpy>=1.19.3 ; python_version < '3.10' and python_version >= '3.9' # Python 3.9 numpy>=1.19.2 ; python_version < '3.9' and python_version >= '3.8' # Python 3.8 numpy>=1.19.2 ; python_version < '3.8' and python_version >= '3.7' # Python 3.7 numpy>=1.19.2 ; python_version < '3.7' and python_version >= '3.6' # Python 3.6 From 2009b8caaef9e0f85b617d1f9c29fd6ee8a7dd17 Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 29 Jan 2023 12:42:16 -0500 Subject: [PATCH 20/23] Update versions --- requirements/headless.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements/headless.txt b/requirements/headless.txt index 4c296ffb..809e889d 100644 --- a/requirements/headless.txt +++ b/requirements/headless.txt @@ -1,5 +1,6 @@ # python ~/local/tools/supported_python_versions_pip.py opencv-python-headless -opencv-python-headless>=4.5.4.58 ; python_version >= '3.10' # Python 3.10+ +# xdev availpkg opencv-python-headless --refresh +opencv-python-headless>=4.5.5.62 ; python_version >= '3.10' # Python 3.10+ opencv-python-headless>=3.4.15.55 ; python_version < '3.10' and python_version >= '3.9' # Python 3.9 opencv-python-headless>=3.4.15.55 ; python_version < '3.9' and python_version >= '3.8' # Python 3.8 opencv-python-headless>=3.4.15.55 ; python_version < '3.8' and python_version >= '3.7' # Python 3.7 From 9c15f5b33222d77ecf242e4024fc987df3395b0f Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 29 Jan 2023 12:42:58 -0500 Subject: [PATCH 21/23] Update versions --- requirements/runtime.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements/runtime.txt b/requirements/runtime.txt index fcdd5e0f..5b73cf5f 100644 --- a/requirements/runtime.txt +++ b/requirements/runtime.txt @@ -18,9 +18,9 @@ Pillow>=9.0.0 ; python_version < '3.8' and python_version >= '3.7' # Pyth Pillow>=8.3.2 ; python_version < '3.7' and python_version >= '3.6' # Python 3.6 # xdev availpkg numpy --refresh -numpy>=1.22.0 ; python_version < '4.0' and python_version >= '3.11' # Python 3.11+ -numpy>=1.21.3 ; python_version < '3.11' and python_version >= '3.10' # Python 3.10 -numpy>=1.19.3 ; python_version < '3.10' and python_version >= '3.9' # Python 3.9 +numpy>=1.23.2 ; python_version >= '3.11' # Python 3.11 +numpy>=1.21.6 ; python_version < '3.11' and python_version >= '3.10' # Python 3.10 +numpy>=1.19.3 ; python_version < '3.10' and python_version >= '3.9' # Python 3.9 numpy>=1.19.2 ; python_version < '3.9' and python_version >= '3.8' # Python 3.8 numpy>=1.19.2 ; python_version < '3.8' and python_version >= '3.7' # Python 3.7 numpy>=1.19.2 ; python_version < '3.7' and python_version >= '3.6' # Python 3.6 From e96ae600a7a3f5dd689be542512449d7a3fedb6a Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 29 Jan 2023 12:47:00 -0500 Subject: [PATCH 22/23] Remove OSX and Win32 builds --- pyproject.toml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 52783719..0b90b3c6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,11 +5,19 @@ requires = [ "setuptools>=41.0.1", "wheel>=0.37.1",] ignore_missing_imports = true [tool.xcookie] +rel_mod_parent_dpath = "." tags = [ "purepy", "github", "erotemic", "cv2", "notypes"] mod_name = "vtool_ibeis" repo_name = "vtool_ibeis" url = "https://github.com/Erotemic/vtool_ibeis" -authors = ['Avi Weinstock', 'Chuck Stewart', 'Hendrik Weideman', 'Jason Parham', 'Jon Crall', 'Zackary Rutfield'] +description = "vision tools for IBEIS" +os = [ "linux" ] +ci_pypy_versions = [] +authors = ['Jon Crall', 'Jason Parham', 'Hendrik Weideman', 'Avi Weinstock', 'Zackary Rutfield', 'Chuck Stewart'] +author_email="erotemic@gmail.com" +min_python = 3.7 +version = "{mod_dpath}/__init__.py::__version__" +license = "Apache 2" dev_status = "beta" From ea950933304b5bdb6b24b9245399d26fad0ca7d5 Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 29 Jan 2023 12:48:13 -0500 Subject: [PATCH 23/23] xcookie regen --- .github/workflows/tests.yml | 76 -------------------- pyproject.toml | 2 +- setup.py | 136 ++++++++++++++++-------------------- 3 files changed, 61 insertions(+), 153 deletions(-) mode change 100755 => 100644 setup.py diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ed00b39f..07d3ea80 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -137,34 +137,10 @@ jobs: os: ubuntu-latest install-extras: tests-strict,runtime-strict,headless-strict arch: auto - - python-version: '3.7' - os: macOS-latest - install-extras: tests-strict,runtime-strict,headless-strict - arch: auto - - python-version: '3.7' - os: windows-latest - install-extras: tests-strict,runtime-strict,headless-strict - arch: auto - python-version: '3.11' os: ubuntu-latest install-extras: tests-strict,runtime-strict,optional-strict,headless-strict arch: auto - - python-version: '3.11' - os: macOS-latest - install-extras: tests-strict,runtime-strict,optional-strict,headless-strict - arch: auto - - python-version: '3.11' - os: windows-latest - install-extras: tests-strict,runtime-strict,optional-strict,headless-strict - arch: auto - - python-version: '3.11' - os: macOS-latest - install-extras: tests,headless - arch: auto - - python-version: '3.11' - os: windows-latest - install-extras: tests,headless - arch: auto - python-version: '3.7' os: ubuntu-latest install-extras: tests,optional,headless @@ -185,58 +161,6 @@ jobs: os: ubuntu-latest install-extras: tests,optional,headless arch: auto - - python-version: '3.7' - os: macOS-latest - install-extras: tests,optional,headless - arch: auto - - python-version: '3.8' - os: macOS-latest - install-extras: tests,optional,headless - arch: auto - - python-version: '3.9' - os: macOS-latest - install-extras: tests,optional,headless - arch: auto - - python-version: '3.10' - os: macOS-latest - install-extras: tests,optional,headless - arch: auto - - python-version: '3.11' - os: macOS-latest - install-extras: tests,optional,headless - arch: auto - - python-version: '3.7' - os: windows-latest - install-extras: tests,optional,headless - arch: auto - - python-version: '3.8' - os: windows-latest - install-extras: tests,optional,headless - arch: auto - - python-version: '3.9' - os: windows-latest - install-extras: tests,optional,headless - arch: auto - - python-version: '3.10' - os: windows-latest - install-extras: tests,optional,headless - arch: auto - - python-version: '3.11' - os: windows-latest - install-extras: tests,optional,headless - arch: auto - - python-version: pypy-3.7 - os: ubuntu-latest - install-extras: tests,optional,headless - arch: auto - - python-version: pypy-3.7 - os: macOS-latest - install-extras: tests,optional,headless - arch: auto - - python-version: pypy-3.7 - os: windows-latest - install-extras: tests,optional,headless - arch: auto steps: - name: Checkout source uses: actions/checkout@v3 diff --git a/pyproject.toml b/pyproject.toml index 0b90b3c6..d982a69b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ url = "https://github.com/Erotemic/vtool_ibeis" description = "vision tools for IBEIS" os = [ "linux" ] ci_pypy_versions = [] -authors = ['Jon Crall', 'Jason Parham', 'Hendrik Weideman', 'Avi Weinstock', 'Zackary Rutfield', 'Chuck Stewart'] +author = ['Jon Crall', 'Jason Parham', 'Hendrik Weideman', 'Avi Weinstock', 'Zackary Rutfield', 'Chuck Stewart'] author_email="erotemic@gmail.com" min_python = 3.7 version = "{mod_dpath}/__init__.py::__version__" diff --git a/setup.py b/setup.py old mode 100755 new mode 100644 index 923507fa..ca5ded64 --- a/setup.py +++ b/setup.py @@ -1,3 +1,6 @@ +#!/usr/bin/env python +# Generated by ~/code/xcookie/xcookie/builders/setup.py +# based on part ~/code/xcookie/xcookie/rc/setup.py.in import sys from os.path import exists from setuptools import find_packages @@ -103,6 +106,9 @@ def parse_line(line, dpath=""): if line.startswith("-e "): info["package"] = line.split("#egg=")[1] else: + if "--find-links" in line: + # setuptools doesnt seem to handle find links + line = line.split("--find-links")[0] if ";" in line: pkgpart, platpart = line.split(";") # Handle platform specific dependencies @@ -160,52 +166,34 @@ def gen_packages_items(): return packages -def native_mb_python_tag(plat_impl=None, version_info=None): - """ - Get the correct manylinux python version tag for this interpreter - - Example: - >>> print(native_mb_python_tag()) - >>> print(native_mb_python_tag('PyPy', (2, 7))) - >>> print(native_mb_python_tag('CPython', (3, 8))) - """ - if plat_impl is None: - import platform - - plat_impl = platform.python_implementation() - - if version_info is None: - import sys - - version_info = sys.version_info - - major, minor = version_info[0:2] - ver = "{}{}".format(major, minor) - - if plat_impl == "CPython": - # TODO: get if cp27m or cp27mu - impl = "cp" - if ver == "27": - IS_27_BUILT_WITH_UNICODE = True # how to determine this? - if IS_27_BUILT_WITH_UNICODE: - abi = "mu" - else: - abi = "m" - else: - if sys.version_info[:2] >= (3, 8): - # bpo-36707: 3.8 dropped the m flag - abi = "" - else: - abi = "m" - mb_tag = "{impl}{ver}-{impl}{ver}{abi}".format(**locals()) - elif plat_impl == "PyPy": - abi = "" - impl = "pypy" - ver = "{}{}".format(major, minor) - mb_tag = "{impl}-{ver}".format(**locals()) - else: - raise NotImplementedError(plat_impl) - return mb_tag +# # Maybe use in the future? But has private deps +# def parse_requirements_alt(fpath='requirements.txt', versions='loose'): +# """ +# Args: +# versions (str): can be +# False or "free" - remove all constraints +# True or "loose" - use the greater or equal (>=) in the req file +# strict - replace all greater equal with equals +# """ +# # Note: different versions of pip might have different internals. +# # This may need to be fixed. +# from pip._internal.req import parse_requirements +# from pip._internal.network.session import PipSession +# requirements = [] +# for req in parse_requirements(fpath, session=PipSession()): +# if not versions or versions == 'free': +# req_name = req.requirement.split(' ')[0] +# requirements.append(req_name) +# elif versions == 'loose' or versions is True: +# requirements.append(req.requirement) +# elif versions == 'strict': +# part1, *rest = req.requirement.split(';') +# strict_req = ';'.join([part1.replace('>=', '==')] + rest) +# requirements.append(strict_req) +# else: +# raise KeyError(versions) +# requirements = [r.replace(' ', '') for r in requirements] +# return requirements NAME = "vtool_ibeis" @@ -215,11 +203,6 @@ def native_mb_python_tag(plat_impl=None, version_info=None): if __name__ == "__main__": setupkw = {} - if 0: - setupkw["entry_points"] = { - # the console_scripts entry point creates the package CLI - "console_scripts": ["xcookie = xcookie.__main__:main"] - } setupkw["install_requires"] = parse_requirements("requirements/runtime.txt") setupkw["extras_require"] = { "all": parse_requirements("requirements.txt"), @@ -244,28 +227,29 @@ def native_mb_python_tag(plat_impl=None, version_info=None): ), } - setup( - name=NAME, - version=VERSION, - author=static_parse("__author__", INIT_PATH), - author_email=static_parse("__author_email__", INIT_PATH), - url=static_parse("__url__", INIT_PATH), - description=("The xcookie Module"), - long_description=parse_description(), - long_description_content_type="text/x-rst", - license="Apache 2", - packages=find_packages("."), - python_requires=">=3.7", - classifiers=[ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "Topic :: Software Development :: Libraries :: Python Modules", - "Topic :: Utilities", - "License :: OSI Approved :: Apache Software License", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - ], - **setupkw, - ) + setupkw["name"] = NAME + setupkw["version"] = VERSION + setupkw[ + "author" + ] = "Jon Crall, Jason Parham, Hendrik Weideman, Avi Weinstock, Zackary Rutfield, Chuck Stewart" + setupkw["author_email"] = "erotemic@gmail.com" + setupkw["url"] = "https://github.com/Erotemic/vtool_ibeis" + setupkw["description"] = "vision tools for IBEIS" + setupkw["long_description"] = parse_description() + setupkw["long_description_content_type"] = "text/x-rst" + setupkw["license"] = "Apache 2" + setupkw["packages"] = find_packages(".") + setupkw["python_requires"] = ">=3.7" + setupkw["classifiers"] = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Utilities", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + ] + setup(**setupkw)