diff options
author | Thiago G. Martins <tmartins@verizonmedia.com> | 2020-06-16 10:29:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-16 10:29:42 +0200 |
commit | c0d8eff2873a2a352b368fe0e616caf812673a33 (patch) | |
tree | e1168059d7cea4f2a2217cb911d7482bbc9c32c9 | |
parent | 06bacbd04910e9645d39033f2aef1c1a25ef6b13 (diff) | |
parent | 075d9d5fec2026c4589c2f0f1d4ededc05128ece (diff) |
Merge pull request #13585 from vespa-engine/tgm/add-pypi
publish pyvespa to test PyPI
-rw-r--r-- | .github/workflows/python.yml | 9 | ||||
-rw-r--r-- | python/vespa/README.md | 405 | ||||
-rw-r--r-- | python/vespa/docs/index.html | 438 | ||||
-rw-r--r-- | python/vespa/setup.py | 100 |
4 files changed, 82 insertions, 870 deletions
diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index a32300043a3..52c655eebfe 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -37,3 +37,12 @@ jobs: - name: Run notebook tests run: | nbdev_test_nbs + - name: Build and publish + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.test_pypi_password }} + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + python setup.py sdist bdist_wheel + twine upload --repository testpypi dist/* diff --git a/python/vespa/README.md b/python/vespa/README.md index c316564f3c1..00d8cc2e769 100644 --- a/python/vespa/README.md +++ b/python/vespa/README.md @@ -4,7 +4,7 @@ ## Install -`pip install vespa` +`pip install pyvespa` ## Connect to a Vespa app @@ -52,16 +52,9 @@ query_result = app.query( ``` ``` -query_result["root"]["fields"] +query_result.number_documents_retrieved ``` - - - - {'totalCount': 1077} - - - ## Labelled data > How to structure labelled data @@ -97,346 +90,6 @@ training_data_batch = app.collect_training_data( training_data_batch ``` - - - -<div> -<style scoped> - .dataframe tbody tr th:only-of-type { - vertical-align: middle; - } - - .dataframe tbody tr th { - vertical-align: top; - } - - .dataframe thead th { - text-align: right; - } -</style> -<table border="1" class="dataframe"> - <thead> - <tr style="text-align: right;"> - <th></th> - <th>attributeMatch(authors.first)</th> - <th>attributeMatch(authors.first).averageWeight</th> - <th>attributeMatch(authors.first).completeness</th> - <th>attributeMatch(authors.first).fieldCompleteness</th> - <th>attributeMatch(authors.first).importance</th> - <th>attributeMatch(authors.first).matches</th> - <th>attributeMatch(authors.first).maxWeight</th> - <th>attributeMatch(authors.first).normalizedWeight</th> - <th>attributeMatch(authors.first).normalizedWeightedWeight</th> - <th>attributeMatch(authors.first).queryCompleteness</th> - <th>...</th> - <th>textSimilarity(results).queryCoverage</th> - <th>textSimilarity(results).score</th> - <th>textSimilarity(title).fieldCoverage</th> - <th>textSimilarity(title).order</th> - <th>textSimilarity(title).proximity</th> - <th>textSimilarity(title).queryCoverage</th> - <th>textSimilarity(title).score</th> - <th>document_id</th> - <th>query_id</th> - <th>relevant</th> - </tr> - </thead> - <tbody> - <tr> - <th>0</th> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>...</td> - <td>0.0</td> - <td>0.0</td> - <td>0.000000</td> - <td>0.0</td> - <td>0.000000</td> - <td>0.000000</td> - <td>0.000000</td> - <td>0</td> - <td>0</td> - <td>1</td> - </tr> - <tr> - <th>1</th> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>...</td> - <td>0.0</td> - <td>0.0</td> - <td>1.000000</td> - <td>1.0</td> - <td>1.000000</td> - <td>1.000000</td> - <td>1.000000</td> - <td>56212</td> - <td>0</td> - <td>0</td> - </tr> - <tr> - <th>2</th> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>...</td> - <td>0.0</td> - <td>0.0</td> - <td>0.187500</td> - <td>0.5</td> - <td>0.617188</td> - <td>0.428571</td> - <td>0.457087</td> - <td>34026</td> - <td>0</td> - <td>0</td> - </tr> - <tr> - <th>3</th> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>...</td> - <td>0.0</td> - <td>0.0</td> - <td>0.000000</td> - <td>0.0</td> - <td>0.000000</td> - <td>0.000000</td> - <td>0.000000</td> - <td>3</td> - <td>0</td> - <td>1</td> - </tr> - <tr> - <th>4</th> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>...</td> - <td>0.0</td> - <td>0.0</td> - <td>1.000000</td> - <td>1.0</td> - <td>1.000000</td> - <td>1.000000</td> - <td>1.000000</td> - <td>56212</td> - <td>0</td> - <td>0</td> - </tr> - <tr> - <th>5</th> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>...</td> - <td>0.0</td> - <td>0.0</td> - <td>0.187500</td> - <td>0.5</td> - <td>0.617188</td> - <td>0.428571</td> - <td>0.457087</td> - <td>34026</td> - <td>0</td> - <td>0</td> - </tr> - <tr> - <th>6</th> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>...</td> - <td>0.0</td> - <td>0.0</td> - <td>0.071429</td> - <td>0.0</td> - <td>0.000000</td> - <td>0.083333</td> - <td>0.039286</td> - <td>1</td> - <td>1</td> - <td>1</td> - </tr> - <tr> - <th>7</th> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>...</td> - <td>0.0</td> - <td>0.0</td> - <td>1.000000</td> - <td>1.0</td> - <td>1.000000</td> - <td>1.000000</td> - <td>1.000000</td> - <td>29774</td> - <td>1</td> - <td>0</td> - </tr> - <tr> - <th>8</th> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>...</td> - <td>0.0</td> - <td>0.0</td> - <td>0.500000</td> - <td>1.0</td> - <td>1.000000</td> - <td>0.333333</td> - <td>0.700000</td> - <td>22787</td> - <td>1</td> - <td>0</td> - </tr> - <tr> - <th>9</th> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>...</td> - <td>0.0</td> - <td>0.0</td> - <td>0.058824</td> - <td>0.0</td> - <td>0.000000</td> - <td>0.083333</td> - <td>0.036765</td> - <td>5</td> - <td>1</td> - <td>1</td> - </tr> - <tr> - <th>10</th> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>...</td> - <td>0.0</td> - <td>0.0</td> - <td>1.000000</td> - <td>1.0</td> - <td>1.000000</td> - <td>1.000000</td> - <td>1.000000</td> - <td>29774</td> - <td>1</td> - <td>0</td> - </tr> - <tr> - <th>11</th> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>...</td> - <td>0.0</td> - <td>0.0</td> - <td>0.500000</td> - <td>1.0</td> - <td>1.000000</td> - <td>0.333333</td> - <td>0.700000</td> - <td>22787</td> - <td>1</td> - <td>0</td> - </tr> - </tbody> -</table> -<p>12 rows × 984 columns</p> -</div> - - - ## Evaluating a query model > Define metrics and evaluate query models. See the [evaluation page](/vespa/evaluation) for more examples. @@ -463,57 +116,3 @@ evaluation = app.evaluate( ) evaluation ``` - - - - -<div> -<style scoped> - .dataframe tbody tr th:only-of-type { - vertical-align: middle; - } - - .dataframe tbody tr th { - vertical-align: top; - } - - .dataframe thead th { - text-align: right; - } -</style> -<table border="1" class="dataframe"> - <thead> - <tr style="text-align: right;"> - <th></th> - <th>query_id</th> - <th>match_ratio_retrieved_docs</th> - <th>match_ratio_docs_available</th> - <th>match_ratio_value</th> - <th>recall_10_value</th> - <th>reciprocal_rank_10_value</th> - </tr> - </thead> - <tbody> - <tr> - <th>0</th> - <td>0</td> - <td>1267</td> - <td>62529</td> - <td>0.020263</td> - <td>0</td> - <td>0</td> - </tr> - <tr> - <th>1</th> - <td>1</td> - <td>887</td> - <td>62529</td> - <td>0.014185</td> - <td>0</td> - <td>0</td> - </tr> - </tbody> -</table> -</div> - - diff --git a/python/vespa/docs/index.html b/python/vespa/docs/index.html index 054c74f3bec..7c55143b923 100644 --- a/python/vespa/docs/index.html +++ b/python/vespa/docs/index.html @@ -35,7 +35,7 @@ description: "Provide data analysis support for Vespa applications" </div> <div class="cell border-box-sizing text_cell rendered"><div class="inner_cell"> <div class="text_cell_render border-box-sizing rendered_html"> -<p><code>pip install vespa</code></p> +<p><code>pip install pyvespa</code></p> </div> </div> @@ -55,7 +55,7 @@ description: "Provide data analysis support for Vespa applications" <div class="inner_cell"> <div class="input_area"> -<div class=" highlight hl-ipython3"><pre><span></span><span class="kn">from</span> <span class="nn">vespa.application</span> <span class="k">import</span> <span class="n">Vespa</span> +<div class=" highlight hl-ipython3"><pre><span></span><span class="kn">from</span> <span class="nn">vespa.application</span> <span class="kn">import</span> <span class="n">Vespa</span> <span class="n">app</span> <span class="o">=</span> <span class="n">Vespa</span><span class="p">(</span><span class="n">url</span> <span class="o">=</span> <span class="s2">"https://api.cord19.vespa.ai"</span><span class="p">)</span> </pre></div> @@ -82,8 +82,8 @@ description: "Provide data analysis support for Vespa applications" <div class="inner_cell"> <div class="input_area"> -<div class=" highlight hl-ipython3"><pre><span></span><span class="kn">from</span> <span class="nn">vespa.query</span> <span class="k">import</span> <span class="n">Query</span><span class="p">,</span> <span class="n">Union</span><span class="p">,</span> <span class="n">WeakAnd</span><span class="p">,</span> <span class="n">ANN</span><span class="p">,</span> <span class="n">RankProfile</span> -<span class="kn">from</span> <span class="nn">random</span> <span class="k">import</span> <span class="n">random</span> +<div class=" highlight hl-ipython3"><pre><span></span><span class="kn">from</span> <span class="nn">vespa.query</span> <span class="kn">import</span> <span class="n">Query</span><span class="p">,</span> <span class="n">Union</span><span class="p">,</span> <span class="n">WeakAnd</span><span class="p">,</span> <span class="n">ANN</span><span class="p">,</span> <span class="n">RankProfile</span> +<span class="kn">from</span> <span class="nn">random</span> <span class="kn">import</span> <span class="n">random</span> <span class="n">match_phase</span> <span class="o">=</span> <span class="n">Union</span><span class="p">(</span> <span class="n">WeakAnd</span><span class="p">(</span><span class="n">hits</span> <span class="o">=</span> <span class="mi">10</span><span class="p">),</span> @@ -143,29 +143,13 @@ description: "Provide data analysis support for Vespa applications" <div class="inner_cell"> <div class="input_area"> -<div class=" highlight hl-ipython3"><pre><span></span><span class="n">query_result</span><span class="p">[</span><span class="s2">"root"</span><span class="p">][</span><span class="s2">"fields"</span><span class="p">]</span> +<div class=" highlight hl-ipython3"><pre><span></span><span class="n">query_result</span><span class="o">.</span><span class="n">number_documents_retrieved</span> </pre></div> </div> </div> </div> -<div class="output_wrapper"> -<div class="output"> - -<div class="output_area"> - - - -<div class="output_text output_subarea output_execute_result"> -<pre>{'totalCount': 1077}</pre> -</div> - -</div> - -</div> -</div> - </div> {% endraw %} @@ -240,354 +224,6 @@ description: "Provide data analysis support for Vespa applications" </div> </div> -<div class="output_wrapper"> -<div class="output"> - -<div class="output_area"> - - -<div class="output_html rendered_html output_subarea output_execute_result"> -<div> -<style scoped> - .dataframe tbody tr th:only-of-type { - vertical-align: middle; - } - - .dataframe tbody tr th { - vertical-align: top; - } - - .dataframe thead th { - text-align: right; - } -</style> -<table border="1" class="dataframe"> - <thead> - <tr style="text-align: right;"> - <th></th> - <th>attributeMatch(authors.first)</th> - <th>attributeMatch(authors.first).averageWeight</th> - <th>attributeMatch(authors.first).completeness</th> - <th>attributeMatch(authors.first).fieldCompleteness</th> - <th>attributeMatch(authors.first).importance</th> - <th>attributeMatch(authors.first).matches</th> - <th>attributeMatch(authors.first).maxWeight</th> - <th>attributeMatch(authors.first).normalizedWeight</th> - <th>attributeMatch(authors.first).normalizedWeightedWeight</th> - <th>attributeMatch(authors.first).queryCompleteness</th> - <th>...</th> - <th>textSimilarity(results).queryCoverage</th> - <th>textSimilarity(results).score</th> - <th>textSimilarity(title).fieldCoverage</th> - <th>textSimilarity(title).order</th> - <th>textSimilarity(title).proximity</th> - <th>textSimilarity(title).queryCoverage</th> - <th>textSimilarity(title).score</th> - <th>document_id</th> - <th>query_id</th> - <th>relevant</th> - </tr> - </thead> - <tbody> - <tr> - <th>0</th> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>...</td> - <td>0.0</td> - <td>0.0</td> - <td>0.000000</td> - <td>0.0</td> - <td>0.000000</td> - <td>0.000000</td> - <td>0.000000</td> - <td>0</td> - <td>0</td> - <td>1</td> - </tr> - <tr> - <th>1</th> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>...</td> - <td>0.0</td> - <td>0.0</td> - <td>1.000000</td> - <td>1.0</td> - <td>1.000000</td> - <td>1.000000</td> - <td>1.000000</td> - <td>56212</td> - <td>0</td> - <td>0</td> - </tr> - <tr> - <th>2</th> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>...</td> - <td>0.0</td> - <td>0.0</td> - <td>0.187500</td> - <td>0.5</td> - <td>0.617188</td> - <td>0.428571</td> - <td>0.457087</td> - <td>34026</td> - <td>0</td> - <td>0</td> - </tr> - <tr> - <th>3</th> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>...</td> - <td>0.0</td> - <td>0.0</td> - <td>0.000000</td> - <td>0.0</td> - <td>0.000000</td> - <td>0.000000</td> - <td>0.000000</td> - <td>3</td> - <td>0</td> - <td>1</td> - </tr> - <tr> - <th>4</th> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>...</td> - <td>0.0</td> - <td>0.0</td> - <td>1.000000</td> - <td>1.0</td> - <td>1.000000</td> - <td>1.000000</td> - <td>1.000000</td> - <td>56212</td> - <td>0</td> - <td>0</td> - </tr> - <tr> - <th>5</th> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>...</td> - <td>0.0</td> - <td>0.0</td> - <td>0.187500</td> - <td>0.5</td> - <td>0.617188</td> - <td>0.428571</td> - <td>0.457087</td> - <td>34026</td> - <td>0</td> - <td>0</td> - </tr> - <tr> - <th>6</th> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>...</td> - <td>0.0</td> - <td>0.0</td> - <td>0.071429</td> - <td>0.0</td> - <td>0.000000</td> - <td>0.083333</td> - <td>0.039286</td> - <td>1</td> - <td>1</td> - <td>1</td> - </tr> - <tr> - <th>7</th> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>...</td> - <td>0.0</td> - <td>0.0</td> - <td>1.000000</td> - <td>1.0</td> - <td>1.000000</td> - <td>1.000000</td> - <td>1.000000</td> - <td>29774</td> - <td>1</td> - <td>0</td> - </tr> - <tr> - <th>8</th> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>...</td> - <td>0.0</td> - <td>0.0</td> - <td>0.500000</td> - <td>1.0</td> - <td>1.000000</td> - <td>0.333333</td> - <td>0.700000</td> - <td>22787</td> - <td>1</td> - <td>0</td> - </tr> - <tr> - <th>9</th> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>...</td> - <td>0.0</td> - <td>0.0</td> - <td>0.058824</td> - <td>0.0</td> - <td>0.000000</td> - <td>0.083333</td> - <td>0.036765</td> - <td>5</td> - <td>1</td> - <td>1</td> - </tr> - <tr> - <th>10</th> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>...</td> - <td>0.0</td> - <td>0.0</td> - <td>1.000000</td> - <td>1.0</td> - <td>1.000000</td> - <td>1.000000</td> - <td>1.000000</td> - <td>29774</td> - <td>1</td> - <td>0</td> - </tr> - <tr> - <th>11</th> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>0.0</td> - <td>...</td> - <td>0.0</td> - <td>0.0</td> - <td>0.500000</td> - <td>1.0</td> - <td>1.000000</td> - <td>0.333333</td> - <td>0.700000</td> - <td>22787</td> - <td>1</td> - <td>0</td> - </tr> - </tbody> -</table> -<p>12 rows × 984 columns</p> -</div> -</div> - -</div> - -</div> -</div> - </div> {% endraw %} @@ -618,7 +254,7 @@ description: "Provide data analysis support for Vespa applications" <div class="inner_cell"> <div class="input_area"> -<div class=" highlight hl-ipython3"><pre><span></span><span class="kn">from</span> <span class="nn">vespa.evaluation</span> <span class="k">import</span> <span class="n">MatchRatio</span><span class="p">,</span> <span class="n">Recall</span><span class="p">,</span> <span class="n">ReciprocalRank</span> +<div class=" highlight hl-ipython3"><pre><span></span><span class="kn">from</span> <span class="nn">vespa.evaluation</span> <span class="kn">import</span> <span class="n">MatchRatio</span><span class="p">,</span> <span class="n">Recall</span><span class="p">,</span> <span class="n">ReciprocalRank</span> <span class="n">eval_metrics</span> <span class="o">=</span> <span class="p">[</span><span class="n">MatchRatio</span><span class="p">(),</span> <span class="n">Recall</span><span class="p">(</span><span class="n">at</span><span class="o">=</span><span class="mi">10</span><span class="p">),</span> <span class="n">ReciprocalRank</span><span class="p">(</span><span class="n">at</span><span class="o">=</span><span class="mi">10</span><span class="p">)]</span> </pre></div> @@ -657,68 +293,6 @@ description: "Provide data analysis support for Vespa applications" </div> </div> -<div class="output_wrapper"> -<div class="output"> - -<div class="output_area"> - - -<div class="output_html rendered_html output_subarea output_execute_result"> -<div> -<style scoped> - .dataframe tbody tr th:only-of-type { - vertical-align: middle; - } - - .dataframe tbody tr th { - vertical-align: top; - } - - .dataframe thead th { - text-align: right; - } -</style> -<table border="1" class="dataframe"> - <thead> - <tr style="text-align: right;"> - <th></th> - <th>query_id</th> - <th>match_ratio_retrieved_docs</th> - <th>match_ratio_docs_available</th> - <th>match_ratio_value</th> - <th>recall_10_value</th> - <th>reciprocal_rank_10_value</th> - </tr> - </thead> - <tbody> - <tr> - <th>0</th> - <td>0</td> - <td>1267</td> - <td>62529</td> - <td>0.020263</td> - <td>0</td> - <td>0</td> - </tr> - <tr> - <th>1</th> - <td>1</td> - <td>887</td> - <td>62529</td> - <td>0.014185</td> - <td>0</td> - <td>0</td> - </tr> - </tbody> -</table> -</div> -</div> - -</div> - -</div> -</div> - </div> {% endraw %} diff --git a/python/vespa/setup.py b/python/vespa/setup.py index de97dee06e9..2dea754602e 100644 --- a/python/vespa/setup.py +++ b/python/vespa/setup.py @@ -1,47 +1,77 @@ +import os from pkg_resources import parse_version from configparser import ConfigParser import setuptools -assert parse_version(setuptools.__version__)>=parse_version('36.2') + +assert parse_version(setuptools.__version__) >= parse_version("36.2") # note: all settings are in settings.ini; edit there, not here -config = ConfigParser(delimiters=['=']) -config.read('settings.ini') -cfg = config['DEFAULT'] +config = ConfigParser(delimiters=["="]) +config.read("settings.ini") +cfg = config["DEFAULT"] -cfg_keys = 'version description keywords author author_email'.split() -expected = cfg_keys + "lib_name user branch license status min_python audience language".split() -for o in expected: assert o in cfg, "missing expected setting: {}".format(o) -setup_cfg = {o:cfg[o] for o in cfg_keys} +cfg_keys = "description keywords author author_email".split() +expected = ( + cfg_keys + + "lib_name user branch license status min_python audience language".split() +) +for o in expected: + assert o in cfg, "missing expected setting: {}".format(o) +setup_cfg = {o: cfg[o] for o in cfg_keys} licenses = { - 'apache2': ('Apache Software License 2.0','OSI Approved :: Apache Software License'), + "apache2": ( + "Apache Software License 2.0", + "OSI Approved :: Apache Software License", + ), } -statuses = [ '1 - Planning', '2 - Pre-Alpha', '3 - Alpha', - '4 - Beta', '5 - Production/Stable', '6 - Mature', '7 - Inactive' ] -py_versions = '2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8'.split() +statuses = [ + "1 - Planning", + "2 - Pre-Alpha", + "3 - Alpha", + "4 - Beta", + "5 - Production/Stable", + "6 - Mature", + "7 - Inactive", +] +py_versions = ( + "2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8".split() +) -requirements = cfg.get('requirements','').split() -lic = licenses[cfg['license']] -min_python = cfg['min_python'] +requirements = cfg.get("requirements", "").split() +lic = licenses[cfg["license"]] +min_python = cfg["min_python"] -setuptools.setup( - name = cfg['lib_name'], - license = lic[0], - classifiers = [ - 'Development Status :: ' + statuses[int(cfg['status'])], - 'Intended Audience :: ' + cfg['audience'].title(), - 'License :: ' + lic[1], - 'Natural Language :: ' + cfg['language'].title(), - ] + ['Programming Language :: Python :: '+o for o in py_versions[py_versions.index(min_python):]], - url = cfg['git_url'], - packages = setuptools.find_packages(), - include_package_data = True, - install_requires = requirements, - dependency_links = cfg.get('dep_links','').split(), - python_requires = '>=' + cfg['min_python'], - long_description = open('README.md').read(), - long_description_content_type = 'text/markdown', - zip_safe = False, - entry_points = { 'console_scripts': cfg.get('console_scripts','').split() }, - **setup_cfg) +def get_target_version(): + build_nr = os.environ.get("GITHUB_RUN_NUMBER", "0+dev") + version = "0.1" + return "{}.{}".format(version, build_nr) + + +setuptools.setup( + name=cfg["lib_name"], + version=get_target_version(), + license=lic[0], + classifiers=[ + "Development Status :: " + statuses[int(cfg["status"])], + "Intended Audience :: " + cfg["audience"].title(), + "License :: " + lic[1], + "Natural Language :: " + cfg["language"].title(), + ] + + [ + "Programming Language :: Python :: " + o + for o in py_versions[py_versions.index(min_python) :] + ], + url=cfg["git_url"], + packages=setuptools.find_packages(), + include_package_data=True, + install_requires=requirements, + dependency_links=cfg.get("dep_links", "").split(), + python_requires=">=" + cfg["min_python"], + long_description=open("README.md").read(), + long_description_content_type="text/markdown", + zip_safe=False, + entry_points={"console_scripts": cfg.get("console_scripts", "").split()}, + **setup_cfg +) |