annoy-rb 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8108550b7970bce06a297ee075182f286e451e902ade1254a1c095f05b53d2b
4
- data.tar.gz: e35e6b247dfec3b21341339a56039ae63267c133ba53f4d6d3004f9acce90d67
3
+ metadata.gz: 1ae4f03fb87f0ea9ab0ff8ff13eb5c011cfd51931e5b4fc63c9a480560e9b102
4
+ data.tar.gz: 815d1f92d975ad932cc608a50a0bf983477d4fb3554aec5cd2978d904fe766b1
5
5
  SHA512:
6
- metadata.gz: 60fc9c1c02215333eb63b8a6cc2c1228bf97da7da444ea5ba9b930f756ed5f4363f336b96332034d4f391f18e999dbb21c8e2df0dd6bb00a7491ea257d39a2ac
7
- data.tar.gz: dd63d425a08a94a102e7731c040563a2f788e284b671babb0d9683275c9affcc2119eeb89968f699f642ad8203230e7b821b49ca88a03c9963be9ea66d95b893
6
+ metadata.gz: 2dd6f50030ac181a66633ea63c1e616ddb3b931227ce002d25b8ec5fb5b7d9094e6e0970bb9367bfe63004bce448bdb318658d17bc089d7af2978cdfdc33c776
7
+ data.tar.gz: f6c5995f2a7986e2c6dfba83bccf3a41b52e564dfce503c4def30395c3c19287422a93d1e62fd5a139e824bf2372910c415cb6cc66c22c41833153790f3bbc1f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## 0.6.0
2
+ - Add `dtype` argument to initialize method to specify the data type of vector element.
3
+ If you want to load a search index created with the Python bindings, specify 'float32' to the dtype argument.
4
+
5
+ ```
6
+ require 'annoy'
7
+
8
+ f = 40
9
+ t = Annoy::AnnoyIndex.new(n_features: f, metric: 'angular', dtype: 'float32')
10
+ t.load('index_with_python_bindings.ann')
11
+ ```
12
+
13
+ - Change the data type of item index from int to int32_t.
14
+ - Update type declarations and documentations.
15
+ - Introduce conventional commits.
16
+
1
17
  ## 0.5.0
2
18
  ### Breaking change
3
19
  - Remove `-march=native` and `-DANNOYLIB_MULTITHREADED_BUILD` from CXXFLAGS.
data/README.md CHANGED
@@ -50,6 +50,18 @@ u.load('test.ann')
50
50
  p u.get_nns_by_item(0, 100) # will find the 100 nearest neighbors.
51
51
  ```
52
52
 
53
+ With the default argument, annoy.rb uses double precision floating point type for the data type of vector element.
54
+ On the other hand, the [Python bindings of Annoy](https://pypi.org/project/annoy/) use single precision floating point type.
55
+ If you want to load a search index created with the Python bindings, specify 'float32' to the dtype argument.
56
+
57
+ ```ruby
58
+ require 'annoy'
59
+
60
+ f = 40
61
+ t = Annoy::AnnoyIndex.new(n_features: f, metric: 'angular', dtype: 'float32')
62
+ t.load('index_with_python_bindings.ann')
63
+ ```
64
+
53
65
  ## License
54
66
 
55
67
  The gem is available as open source under the terms of the [Apache-2.0 License](https://www.apache.org/licenses/LICENSE-2.0).
@@ -58,4 +70,4 @@ The gem is available as open source under the terms of the [Apache-2.0 License](
58
70
 
59
71
  Bug reports and pull requests are welcome on GitHub at https://github.com/yoshoku/annoy.rb.
60
72
  This project is intended to be a safe, welcoming space for collaboration,
61
- and contributors are expected to adhere to the [code of conduct](https://github.com/yoshoku/annoy.rb/blob/main/CODE_OF_CONDUCT.md).
73
+ and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Annoy.rb is a Ruby binding for the Annoy (Approximate Nearest Neighbors Oh Yeah).
3
3
  *
4
- * Copyright (c) 2020 Atsushi Tatsuma
4
+ * Copyright (c) 2020-2022 Atsushi Tatsuma
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -22,9 +22,14 @@ extern "C"
22
22
  void Init_annoyext(void)
23
23
  {
24
24
  VALUE rb_mAnnoy = rb_define_module("Annoy");
25
- RbAnnoyIndex<AnnoyIndexAngular, double>::define_class(rb_mAnnoy, "AnnoyIndexAngular");
26
- RbAnnoyIndex<AnnoyIndexDotProduct, double>::define_class(rb_mAnnoy, "AnnoyIndexDotProduct");
27
- RbAnnoyIndex<AnnoyIndexHamming, uint64_t>::define_class(rb_mAnnoy, "AnnoyIndexHamming");
28
- RbAnnoyIndex<AnnoyIndexEuclidean, double>::define_class(rb_mAnnoy, "AnnoyIndexEuclidean");
29
- RbAnnoyIndex<AnnoyIndexManhattan, double>::define_class(rb_mAnnoy, "AnnoyIndexManhattan");
25
+ RbAnnoyIndex<AnnoyIndexAngular<double>, double>::define_class(rb_mAnnoy, "AnnoyIndexAngular");
26
+ RbAnnoyIndex<AnnoyIndexDotProduct<double>, double>::define_class(rb_mAnnoy, "AnnoyIndexDotProduct");
27
+ RbAnnoyIndex<AnnoyIndexHamming<uint64_t>, uint64_t>::define_class(rb_mAnnoy, "AnnoyIndexHamming");
28
+ RbAnnoyIndex<AnnoyIndexEuclidean<double>, double>::define_class(rb_mAnnoy, "AnnoyIndexEuclidean");
29
+ RbAnnoyIndex<AnnoyIndexManhattan<double>, double>::define_class(rb_mAnnoy, "AnnoyIndexManhattan");
30
+
31
+ RbAnnoyIndex<AnnoyIndexAngular<float>, float>::define_class(rb_mAnnoy, "AnnoyIndexAngularFloat32");
32
+ RbAnnoyIndex<AnnoyIndexDotProduct<float>, float>::define_class(rb_mAnnoy, "AnnoyIndexDotProductFloat32");
33
+ RbAnnoyIndex<AnnoyIndexEuclidean<float>, float>::define_class(rb_mAnnoy, "AnnoyIndexEuclideanFloat32");
34
+ RbAnnoyIndex<AnnoyIndexManhattan<float>, float>::define_class(rb_mAnnoy, "AnnoyIndexManhattanFloat32");
30
35
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Annoy.rb is a Ruby binding for the Annoy (Approximate Nearest Neighbors Oh Yeah).
3
3
  *
4
- * Copyright (c) 2020 Atsushi Tatsuma
4
+ * Copyright (c) 2020-2022 Atsushi Tatsuma
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -31,11 +31,11 @@
31
31
  typedef AnnoyIndexSingleThreadedBuildPolicy AnnoyIndexThreadedBuildPolicy;
32
32
  #endif
33
33
 
34
- typedef AnnoyIndex<int, double, Angular, Kiss64Random, AnnoyIndexThreadedBuildPolicy> AnnoyIndexAngular;
35
- typedef AnnoyIndex<int, double, DotProduct, Kiss64Random, AnnoyIndexThreadedBuildPolicy> AnnoyIndexDotProduct;
36
- typedef AnnoyIndex<int, uint64_t, Hamming, Kiss64Random, AnnoyIndexThreadedBuildPolicy> AnnoyIndexHamming;
37
- typedef AnnoyIndex<int, double, Euclidean, Kiss64Random, AnnoyIndexThreadedBuildPolicy> AnnoyIndexEuclidean;
38
- typedef AnnoyIndex<int, double, Manhattan, Kiss64Random, AnnoyIndexThreadedBuildPolicy> AnnoyIndexManhattan;
34
+ template<typename F> using AnnoyIndexAngular = AnnoyIndex<int32_t, F, Angular, Kiss64Random, AnnoyIndexThreadedBuildPolicy>;
35
+ template<typename F> using AnnoyIndexDotProduct = AnnoyIndex<int32_t, F, DotProduct, Kiss64Random, AnnoyIndexThreadedBuildPolicy>;
36
+ template<typename F> using AnnoyIndexHamming = AnnoyIndex<int32_t, F, Hamming, Kiss64Random, AnnoyIndexThreadedBuildPolicy>;
37
+ template<typename F> using AnnoyIndexEuclidean = AnnoyIndex<int32_t, F, Euclidean, Kiss64Random, AnnoyIndexThreadedBuildPolicy>;
38
+ template<typename F> using AnnoyIndexManhattan = AnnoyIndex<int32_t, F, Manhattan, Kiss64Random, AnnoyIndexThreadedBuildPolicy>;
39
39
 
40
40
  template<class T, typename F> class RbAnnoyIndex
41
41
  {
@@ -94,7 +94,7 @@ template<class T, typename F> class RbAnnoyIndex
94
94
  };
95
95
 
96
96
  static VALUE _annoy_index_add_item(VALUE self, VALUE _idx, VALUE arr) {
97
- const int idx = NUM2INT(_idx);
97
+ const int32_t idx = (int32_t)NUM2INT(_idx);
98
98
  const int n_dims = get_annoy_index(self)->get_f();
99
99
 
100
100
  if (!RB_TYPE_P(arr, T_ARRAY)) {
@@ -172,11 +172,11 @@ template<class T, typename F> class RbAnnoyIndex
172
172
  };
173
173
 
174
174
  static VALUE _annoy_index_get_nns_by_item(VALUE self, VALUE _idx, VALUE _n_neighbors, VALUE _search_k, VALUE _include_distances) {
175
- const int idx = NUM2INT(_idx);
175
+ const int32_t idx = (int32_t)NUM2INT(_idx);
176
176
  const int n_neighbors = NUM2INT(_n_neighbors);
177
177
  const int search_k = NUM2INT(_search_k);
178
178
  const bool include_distances = _include_distances == Qtrue ? true : false;
179
- std::vector<int> neighbors;
179
+ std::vector<int32_t> neighbors;
180
180
  std::vector<F> distances;
181
181
 
182
182
  get_annoy_index(self)->get_nns_by_item(idx, n_neighbors, search_k, &neighbors, include_distances ? &distances : NULL);
@@ -185,7 +185,7 @@ template<class T, typename F> class RbAnnoyIndex
185
185
  VALUE neighbors_arr = rb_ary_new2(sz_neighbors);
186
186
 
187
187
  for (int i = 0; i < sz_neighbors; i++) {
188
- rb_ary_store(neighbors_arr, i, INT2NUM(neighbors[i]));
188
+ rb_ary_store(neighbors_arr, i, INT2NUM((int)(neighbors[i])));
189
189
  }
190
190
 
191
191
  if (include_distances) {
@@ -224,7 +224,7 @@ template<class T, typename F> class RbAnnoyIndex
224
224
  const int n_neighbors = NUM2INT(_n_neighbors);
225
225
  const int search_k = NUM2INT(_search_k);
226
226
  const bool include_distances = _include_distances == Qtrue ? true : false;
227
- std::vector<int> neighbors;
227
+ std::vector<int32_t> neighbors;
228
228
  std::vector<F> distances;
229
229
 
230
230
  get_annoy_index(self)->get_nns_by_vector(vec, n_neighbors, search_k, &neighbors, include_distances ? &distances : NULL);
@@ -235,7 +235,7 @@ template<class T, typename F> class RbAnnoyIndex
235
235
  VALUE neighbors_arr = rb_ary_new2(sz_neighbors);
236
236
 
237
237
  for (int i = 0; i < sz_neighbors; i++) {
238
- rb_ary_store(neighbors_arr, i, INT2NUM(neighbors[i]));
238
+ rb_ary_store(neighbors_arr, i, INT2NUM((int)(neighbors[i])));
239
239
  }
240
240
 
241
241
  if (include_distances) {
@@ -254,7 +254,7 @@ template<class T, typename F> class RbAnnoyIndex
254
254
  };
255
255
 
256
256
  static VALUE _annoy_index_get_item(VALUE self, VALUE _idx) {
257
- const int idx = NUM2INT(_idx);
257
+ const int32_t idx = (int32_t)NUM2INT(_idx);
258
258
  const int n_dims = get_annoy_index(self)->get_f();
259
259
  F* vec = (F*)ruby_xmalloc(n_dims * sizeof(F));
260
260
  VALUE arr = rb_ary_new2(n_dims);
@@ -270,8 +270,8 @@ template<class T, typename F> class RbAnnoyIndex
270
270
  };
271
271
 
272
272
  static VALUE _annoy_index_get_distance(VALUE self, VALUE _i, VALUE _j) {
273
- const int i = NUM2INT(_i);
274
- const int j = NUM2INT(_j);
273
+ const int32_t i = (int32_t)NUM2INT(_i);
274
+ const int32_t j = (int32_t)NUM2INT(_j);
275
275
  const F dist = get_annoy_index(self)->get_distance(i, j);
276
276
  return typeid(F) == typeid(double) ? DBL2NUM(dist) : UINT2NUM(dist);
277
277
  };
data/lib/annoy/version.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  # Annoy.rb is a Ruby wrapper for Annoy (Approximate Nearest Neighbors Oh Yeah).
4
4
  module Annoy
5
5
  # The version of Annoy.rb you are using.
6
- VERSION = '0.5.0'
6
+ VERSION = '0.6.0'
7
7
 
8
8
  # The version of Annoy included with gem.
9
9
  ANNOY_VERSION = '1.17.0'
data/lib/annoy.rb CHANGED
@@ -30,27 +30,35 @@ module Annoy
30
30
  # @return [String]
31
31
  attr_reader :metric
32
32
 
33
+ # Returns the data type of feature.
34
+ # @return [String]
35
+ attr_reader :dtype
36
+
33
37
  # Create a new search index.
34
38
  #
35
39
  # @param n_features [Integer] The number of features (dimensions) of stored vector.
36
40
  # @param metric [String] The distance metric between vectors ('angular', 'dot', 'hamming', 'euclidean', or 'manhattan').
37
- def initialize(n_features:, metric: 'angular')
41
+ # @param dtype [String] The data type of features ('float64' and 'float32').
42
+ # If metric is given 'hamming', 'uint64' is automatically assigned to this argument.
43
+ def initialize(n_features:, metric: 'angular', dtype: 'float64')
38
44
  raise ArgumentError, 'Expect n_features to be Integer.' unless n_features.is_a?(Numeric)
39
45
 
40
46
  @n_features = n_features.to_i
41
47
  @metric = metric
48
+ @dtype = dtype
42
49
 
43
50
  @index = case @metric
44
51
  when 'angular'
45
- AnnoyIndexAngular.new(@n_features)
52
+ @dtype == 'float64' ? AnnoyIndexAngular.new(@n_features) : AnnoyIndexAngularFloat32.new(@n_features)
46
53
  when 'dot'
47
- AnnoyIndexDotProduct.new(@n_features)
54
+ @dtype == 'float64' ? AnnoyIndexDotProduct.new(@n_features) : AnnoyIndexDotProductFloat32.new(@n_features)
48
55
  when 'hamming'
56
+ @dtype = 'uint64'
49
57
  AnnoyIndexHamming.new(@n_features)
50
58
  when 'euclidean'
51
- AnnoyIndexEuclidean.new(@n_features)
59
+ @dtype == 'float64' ? AnnoyIndexEuclidean.new(@n_features) : AnnoyIndexEuclideanFloat32.new(@n_features)
52
60
  when 'manhattan'
53
- AnnoyIndexManhattan.new(@n_features)
61
+ @dtype == 'float64' ? AnnoyIndexManhattan.new(@n_features) : AnnoyIndexManhattanFloat32.new(@n_features)
54
62
  else
55
63
  raise ArgumentError, "No such metric: #{@metric}."
56
64
  end
@@ -69,6 +77,7 @@ module Annoy
69
77
  #
70
78
  # @param n_trees [Integer] The number of trees. More trees gives higher search precision.
71
79
  # @param n_jobs [Integer] The number of threads used to build the trees. If -1 is given, uses all available CPU cores.
80
+ # This parameter is enabled only if "-DANNOYLIB_MULTITHREADED_BUILD" is specified on gem installation.
72
81
  # @return [Boolean]
73
82
  def build(n_trees, n_jobs: -1)
74
83
  @index.build(n_trees, n_jobs)
data/sig/annoy.rbs CHANGED
@@ -1,11 +1,13 @@
1
1
  module Annoy
2
2
  VERSION: String
3
+ ANNOY_VERSION: String
3
4
 
4
5
  class AnnoyIndex
5
6
  attr_reader n_features: Integer
6
7
  attr_reader metric: String
8
+ attr_reader dtype: String
7
9
 
8
- def initialize: (n_features: Integer n_features, ?metric: String metric) -> void
10
+ def initialize: (n_features: Integer n_features, ?metric: String metric, ?dtype: String dtype) -> void
9
11
  def add_item: (Integer i, Array[Float | Integer] v) -> bool
10
12
  def build: (Integer n_trees, ?n_jobs: Integer n_jobs) -> bool
11
13
  def save: (String filename, ?prefault: bool prefault) -> bool
@@ -40,6 +42,24 @@ module Annoy
40
42
  def seed: (Integer s) -> nil
41
43
  end
42
44
 
45
+ class AnnoyIndexAngularFloat32
46
+ def initialize: (Integer n_features) -> void
47
+ def add_item: (Integer i, Array[Float] v) -> bool
48
+ def build: (Integer n_trees, Integer n_jobs) -> bool
49
+ def save: (String filename, bool prefault) -> bool
50
+ def load: (String filename, bool prefault) -> bool
51
+ def unload: () -> bool
52
+ def get_nns_by_item: (Integer i, Integer n, Integer search_k, (true | false) include_distances) -> ([Array[Integer], Array[Float]] | Array[Integer])
53
+ def get_nns_by_vector: (Array[Float] v, Integer n, Integer search_k, (true | false) include_distances) -> ([Array[Integer], Array[Float]] | Array[Integer])
54
+ def get_item: (Integer i) -> Array[Float]
55
+ def get_distance: (Integer i, Integer j) -> Float
56
+ def n_items: () -> Integer
57
+ def n_trees: () -> Integer
58
+ def on_disk_build: (String filename) -> bool
59
+ def verbose: (bool flag) -> nil
60
+ def seed: (Integer s) -> nil
61
+ end
62
+
43
63
  class AnnoyIndexDotProduct
44
64
  def initialize: (Integer n_features) -> void
45
65
  def add_item: (Integer i, Array[Float] v) -> bool
@@ -58,6 +78,24 @@ module Annoy
58
78
  def seed: (Integer s) -> nil
59
79
  end
60
80
 
81
+ class AnnoyIndexDotProductFloat32
82
+ def initialize: (Integer n_features) -> void
83
+ def add_item: (Integer i, Array[Float] v) -> bool
84
+ def build: (Integer n_trees, Integer n_jobs) -> bool
85
+ def save: (String filename, bool prefault) -> bool
86
+ def load: (String filename, bool prefault) -> bool
87
+ def unload: () -> bool
88
+ def get_nns_by_item: (Integer i, Integer n, Integer search_k, (true | false) include_distances) -> ([Array[Integer], Array[Float]] | Array[Integer])
89
+ def get_nns_by_vector: (Array[Float] v, Integer n, Integer search_k, (true | false) include_distances) -> ([Array[Integer], Array[Float]] | Array[Integer])
90
+ def get_item: (Integer i) -> Array[Float]
91
+ def get_distance: (Integer i, Integer j) -> Float
92
+ def n_items: () -> Integer
93
+ def n_trees: () -> Integer
94
+ def on_disk_build: (String filename) -> bool
95
+ def verbose: (bool flag) -> nil
96
+ def seed: (Integer s) -> nil
97
+ end
98
+
61
99
  class AnnoyIndexHamming
62
100
  def initialize: (Integer n_features) -> void
63
101
  def add_item: (Integer i, Array[Integer] v) -> bool
@@ -94,6 +132,24 @@ module Annoy
94
132
  def seed: (Integer s) -> nil
95
133
  end
96
134
 
135
+ class AnnoyIndexEuclideanFloat32
136
+ def initialize: (Integer n_features) -> void
137
+ def add_item: (Integer i, Array[Float] v) -> bool
138
+ def build: (Integer n_trees, Integer n_jobs) -> bool
139
+ def save: (String filename, bool prefault) -> bool
140
+ def load: (String filename, bool prefault) -> bool
141
+ def unload: () -> bool
142
+ def get_nns_by_item: (Integer i, Integer n, Integer search_k, (true | false) include_distances) -> ([Array[Integer], Array[Float]] | Array[Integer])
143
+ def get_nns_by_vector: (Array[Float] v, Integer n, Integer search_k, (true | false) include_distances) -> ([Array[Integer], Array[Float]] | Array[Integer])
144
+ def get_item: (Integer i) -> Array[Float]
145
+ def get_distance: (Integer i, Integer j) -> Float
146
+ def n_items: () -> Integer
147
+ def n_trees: () -> Integer
148
+ def on_disk_build: (String filename) -> bool
149
+ def verbose: (bool flag) -> nil
150
+ def seed: (Integer s) -> nil
151
+ end
152
+
97
153
  class AnnoyIndexManhattan
98
154
  def initialize: (Integer n_features) -> void
99
155
  def add_item: (Integer i, Array[Float] v) -> bool
@@ -111,4 +167,22 @@ module Annoy
111
167
  def verbose: (bool flag) -> nil
112
168
  def seed: (Integer s) -> nil
113
169
  end
170
+
171
+ class AnnoyIndexManhattanFloat32
172
+ def initialize: (Integer n_features) -> void
173
+ def add_item: (Integer i, Array[Float] v) -> bool
174
+ def build: (Integer n_trees, Integer n_jobs) -> bool
175
+ def save: (String filename, bool prefault) -> bool
176
+ def load: (String filename, bool prefault) -> bool
177
+ def unload: () -> bool
178
+ def get_nns_by_item: (Integer i, Integer n, Integer search_k, (true | false) include_distances) -> ([Array[Integer], Array[Float]] | Array[Integer])
179
+ def get_nns_by_vector: (Array[Float] v, Integer n, Integer search_k, (true | false) include_distances) -> ([Array[Integer], Array[Float]] | Array[Integer])
180
+ def get_item: (Integer i) -> Array[Float]
181
+ def get_distance: (Integer i, Integer j) -> Float
182
+ def n_items: () -> Integer
183
+ def n_trees: () -> Integer
184
+ def on_disk_build: (String filename) -> bool
185
+ def verbose: (bool flag) -> nil
186
+ def seed: (Integer s) -> nil
187
+ end
114
188
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: annoy-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - yoshoku
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-27 00:00:00.000000000 Z
11
+ date: 2022-01-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Annoy.rb provides Ruby bindings for the Annoy (Approximate Nearest Neighbors
14
14
  Oh Yeah).
@@ -19,17 +19,9 @@ extensions:
19
19
  - ext/annoy/extconf.rb
20
20
  extra_rdoc_files: []
21
21
  files:
22
- - ".github/workflows/build.yml"
23
- - ".gitignore"
24
- - ".rspec"
25
22
  - CHANGELOG.md
26
- - CODE_OF_CONDUCT.md
27
- - Gemfile
28
23
  - LICENSE.txt
29
24
  - README.md
30
- - Rakefile
31
- - Steepfile
32
- - annoy-rb.gemspec
33
25
  - ext/annoy/annoyext.cpp
34
26
  - ext/annoy/annoyext.hpp
35
27
  - ext/annoy/extconf.rb
@@ -63,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
55
  - !ruby/object:Gem::Version
64
56
  version: '0'
65
57
  requirements: []
66
- rubygems_version: 3.2.32
58
+ rubygems_version: 3.3.3
67
59
  signing_key:
68
60
  specification_version: 4
69
61
  summary: Ruby bindings for the Annoy (Approximate Nearest Neighbors Oh Yeah).
@@ -1,20 +0,0 @@
1
- name: build
2
-
3
- on: [push, pull_request]
4
-
5
- jobs:
6
- build:
7
- runs-on: ubuntu-latest
8
- strategy:
9
- fail-fast: false
10
- matrix:
11
- ruby: [ '2.6', '2.7', '3.0' ]
12
- steps:
13
- - uses: actions/checkout@v2
14
- - name: Set upt Ruby ${{ matrix.ruby }}
15
- uses: ruby/setup-ruby@v1
16
- with:
17
- ruby-version: ${{ matrix.ruby }}
18
- bundler-cache: true
19
- - name: Build and test with Rake
20
- run: bundle exec rake
data/.gitignore DELETED
@@ -1,21 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
- *.bundle
10
- *.so
11
- *.o
12
- *.a
13
- mkmf.log
14
-
15
- # rspec failure tracking
16
- .rspec_status
17
-
18
- *.swp
19
- *.dat
20
- tags
21
- .DS_Store
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at yoshoku@outlook.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [https://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: https://contributor-covenant.org
74
- [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile DELETED
@@ -1,10 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in annoy.gemspec
4
- gemspec
5
-
6
- gem 'rake', '~> 13.0'
7
- gem 'rake-compiler', '~> 1.1'
8
- gem 'rspec', '~> 3.0'
9
- gem 'rbs', '~> 1.2'
10
- gem 'steep', '~> 0.44'
data/Rakefile DELETED
@@ -1,15 +0,0 @@
1
- require 'bundler/gem_tasks'
2
- require 'rspec/core/rake_task'
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- require 'rake/extensiontask'
7
-
8
- task :build => :compile
9
-
10
- Rake::ExtensionTask.new('annoyext') do |ext|
11
- ext.ext_dir = 'ext/annoy'
12
- ext.lib_dir = 'lib/annoy'
13
- end
14
-
15
- task :default => [:clobber, :compile, :spec]
data/Steepfile DELETED
@@ -1,20 +0,0 @@
1
- target :lib do
2
- signature "sig"
3
-
4
- check "lib" # Directory name
5
- # check "Gemfile" # File name
6
- # check "app/models/**/*.rb" # Glob
7
- # # ignore "lib/templates/*.rb"
8
- #
9
- # # library "pathname", "set" # Standard libraries
10
- # # library "strong_json" # Gems
11
- end
12
-
13
- # target :spec do
14
- # signature "sig", "sig-private"
15
- #
16
- # check "spec"
17
- #
18
- # # library "pathname", "set" # Standard libraries
19
- # # library "rspec"
20
- # end
data/annoy-rb.gemspec DELETED
@@ -1,28 +0,0 @@
1
- require_relative 'lib/annoy/version'
2
-
3
- Gem::Specification.new do |spec|
4
- spec.name = 'annoy-rb'
5
- spec.version = Annoy::VERSION
6
- spec.authors = ['yoshoku']
7
- spec.email = ['yoshoku@outlook.com']
8
-
9
- spec.summary = 'Ruby bindings for the Annoy (Approximate Nearest Neighbors Oh Yeah).'
10
- spec.description = 'Annoy.rb provides Ruby bindings for the Annoy (Approximate Nearest Neighbors Oh Yeah).'
11
- spec.homepage = 'https://github.com/yoshoku/annoy.rb'
12
- spec.license = 'Apache-2.0'
13
-
14
- spec.metadata['homepage_uri'] = spec.homepage
15
- spec.metadata['source_code_uri'] = spec.homepage
16
- spec.metadata['changelog_uri'] = 'https://github.com/yoshoku/annoy.rb/blob/main/CHANGELOG.md'
17
- spec.metadata['documentation_uri'] = 'https://yoshoku.github.io/annoy.rb/doc/'
18
-
19
- # Specify which files should be added to the gem when it is released.
20
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
22
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
- end
24
- spec.bindir = 'exe'
25
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
- spec.require_paths = ['lib']
27
- spec.extensions = ['ext/annoy/extconf.rb']
28
- end