Skip to content

Commit 70cab11

Browse files
committed
Change import qatools to import qaboard, while staying backward compatible
1 parent 644c524 commit 70cab11

34 files changed

+74
-44
lines changed

MANIFEST.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
recursive-include qatools/sample_project/qa *
2-
include qatools/sample_project/qaboard.yaml
1+
recursive-include qaboard/sample_project/qa *
2+
include qaboard/sample_project/qaboard.yaml
33

qaboard/__init__.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# need to be update setup.py as well
2+
__version__ = '0.8.2'
3+
from .check_for_updates import check_for_updates
4+
check_for_updates()
5+
6+
from .config import on_windows, on_linux, on_lsf, on_vdi, is_ci
7+
from .config import config, merge
8+
from .conventions import slugify
9+
from .qa import qa

qaboard/__main__.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from .qa import main
2+
main()

qatools/api.py qaboard/api.py

File renamed without changes.
File renamed without changes.

qatools/check_for_updates.py qaboard/check_for_updates.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def latest_qatools_version():
2020
import re
2121
try:
2222
# we surely could do something more robust
23-
r = requests.get('http://gitlab-srv/common-infrastructure/qatools/raw/master/setup.py', timeout=1)
23+
r = requests.get('https://raw.githubusercontent.com/Samsung/qaboard/master/setup.py', timeout=1)
2424
except:
2525
return None
2626
for l in r.text.split('\n'):
@@ -71,9 +71,9 @@ def check_for_updates():
7171

7272

7373
if latest_version:
74-
from qatools import __version__ as current_version
74+
from qaboard import __version__ as current_version
7575
to_ints = lambda v: [int(n) for n in v.split('.')]
7676
newer_version_available = to_ints(current_version) < to_ints(latest_version)
7777
if newer_version_available:
78-
click.secho(f'A new version of qatools is available! Upgrade to {latest_version}:', fg='yellow', bold=True, err=True)
79-
click.secho('$ pip install --upgrade --trusted-host pypi.python.org --trusted-host pypi.org --trusted-host files.pythonhosted.org git+http://gitlab-srv/common-infrastructure/qatools', fg='yellow', err=True)
78+
click.secho(f'[INFO] A new version of qaboard is available! Upgrade to {latest_version}:', fg='yellow', bold=True, err=True)
79+
click.secho(' $ pip install --upgrade qaboard', fg='yellow', err=True)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

qatools/init.py qaboard/init.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def qa_init():
4141
pass
4242
except:
4343
import pkg_resources
44-
qatools_dir = Path(pkg_resources.resource_filename('qatools', ''))
44+
qatools_dir = Path(pkg_resources.resource_filename('qaboard', ''))
4545

4646
click.secho('Creating a `qatools` configuration based on the sample project 🎉', fg='green')
4747
shutil.copy(str(qatools_dir / 'sample_project/qaboard.yaml'), 'qaboard.yaml')
File renamed without changes.

qatools/lsf.py qaboard/lsf.py

File renamed without changes.

qatools/qatools.py qaboard/qa.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
@click.option('--database', type=PathType(), help="Input database location")
4848
@click.option('--type', 'input_type', default=default_input_type, help="How we define inputs")
4949
@click.option('--offline', is_flag=True, help="Do not notify QA-Board about run statuses.")
50-
def cli(ctx, platform, configuration, label, tuning, tuning_filepath, dryrun, share, database, input_type, offline):
50+
def qa(ctx, platform, configuration, label, tuning, tuning_filepath, dryrun, share, database, input_type, offline):
5151
"""Entrypoint to running your algo, launching batchs..."""
5252
# We want all paths to be relative to top-most qaboard.yaml
5353
# it should be located at the root of the git repository
@@ -122,7 +122,7 @@ def cli(ctx, platform, configuration, label, tuning, tuning_filepath, dryrun, sh
122122
ctx.obj['color'] = is_ci or share
123123

124124

125-
@cli.command()
125+
@qa.command()
126126
@click.option('-i', '--input', 'input_path', type=PathType(), help='Path of the input/recording/test we should work on, relative to the database directory.')
127127
@click.option('-o', '--output', 'output_path', type=PathType(), default=None, help='Custom output directory path. If not provided, defaults to ctx.obj["prefix_output_dir"] / input_path.with_suffix('')')
128128
@click.argument('variable')
@@ -144,7 +144,7 @@ def get(ctx, input_path, output_path, variable):
144144

145145

146146

147-
@cli.command(context_settings=dict(
147+
@qa.command(context_settings=dict(
148148
ignore_unknown_options=True,
149149
allow_interspersed_args=False,
150150
))
@@ -293,7 +293,7 @@ def postprocess_(runtime_metrics, context, skip=False, save_manifests_in_databas
293293

294294

295295

296-
@cli.command(context_settings=dict(
296+
@qa.command(context_settings=dict(
297297
ignore_unknown_options=True,
298298
))
299299
@click.pass_context
@@ -318,7 +318,7 @@ def postprocess(ctx, input_path, output_path, forwarded_args):
318318

319319

320320

321-
@cli.command(context_settings=dict(
321+
@qa.command(context_settings=dict(
322322
ignore_unknown_options=True,
323323
))
324324
@click.pass_context
@@ -341,7 +341,7 @@ def sync(ctx, input_path, output_path):
341341

342342

343343
lsf_config = config.get('runners').get('lsf', {}) if 'runners' in config else config.get('lsf', {})
344-
@cli.command(context_settings=dict(
344+
@qa.command(context_settings=dict(
345345
ignore_unknown_options=True,
346346
))
347347
@click.option('--batch', '-b', 'batches', multiple=True, help="We run over all inputs+configs+database in those batches")
@@ -540,7 +540,7 @@ def batch(ctx, batches, batches_files, tuning_search, tuning_search_file, no_wai
540540

541541

542542

543-
@cli.command()
543+
@qa.command()
544544
@click.option('--file', '-f', 'files', multiple=True, help="Save spcific files instead of artifacts indicated by yaml file")
545545
# Do we use this? let's deprecate and remove
546546
@click.option('--out', '-o', 'artifacts_path', default='', help="Path to save artifacts in case of specified files")
@@ -629,7 +629,7 @@ def save_artifacts(ctx, files, artifacts_path, groups):
629629
notify_qa_database(object_type='commit', **ctx.obj)
630630

631631

632-
@cli.command()
632+
@qa.command()
633633
@click.pass_context
634634
@click.option('--batch', '-b', 'batches', required=True, multiple=True, help="Only check bit-accuracy for this batch of inputs+configs+database.")
635635
@click.option('--batches-file', 'batches_files', default=default_batches_files, multiple=True, help="YAML file listing batches of inputs+config+database selected from the database.")
@@ -681,7 +681,7 @@ def check_bit_accuracy_manifest(ctx, batches, batches_files):
681681

682682

683683

684-
@cli.command()
684+
@qa.command()
685685
@click.pass_context
686686
@click.option(
687687
"--reference",
@@ -751,7 +751,7 @@ def check_bit_accuracy(ctx, reference, batches, batches_files, reference_platfor
751751
click.secho(f"https://qa/{config['project']['name']}/commit/{commit_id}?reference={reference_commit.hexsha}&selected_views=bit_accuracy", fg='red')
752752
exit(1)
753753

754-
@cli.command(context_settings=dict(
754+
@qa.command(context_settings=dict(
755755
ignore_unknown_options=True,
756756
))
757757
@click.option('--batch', '-b', 'batches', required=True, multiple=True, help="Use the inputs+configs+database in those batches")
@@ -853,7 +853,7 @@ def optimize(ctx, batches, batches_files, config_file, forwarded_args):
853853

854854

855855
def main():
856-
cli(obj={}, auto_envvar_prefix='QA')
856+
qa(obj={}, auto_envvar_prefix='QA')
857857

858858
if __name__ == '__main__':
859859
main()

qatools/qa_aggregate.py qaboard/qa_aggregate.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from pathlib import Path
2424

2525
import click
26-
from qatools.config import root_qatools, available_metrics
26+
from qaboard.config import root_qatools, available_metrics
2727

2828

2929

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

qatools/utils.py qaboard/utils.py

File renamed without changes.

qatools/__init__.py

100644100755
+19-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
1-
# need to be update setup.py as well
2-
__version__ = '0.8.2'
3-
from .check_for_updates import check_for_updates
4-
check_for_updates()
1+
"""
2+
For backward-compatibility: once qaboard was imported as "import qatools"
3+
Inspired by https://stackoverflow.com/a/24324577/5993501
4+
"""
5+
import sys
6+
import qaboard
57

6-
from .config import on_windows, on_linux, on_lsf, on_vdi, is_ci
7-
from .config import config, merge
8-
from .conventions import slugify
9-
from .qatools import cli
8+
modules = [
9+
'qaboard',
10+
'qaboard.check_for_updates',
11+
'qaboard.config',
12+
'qaboard.utils',
13+
'qaboard.conventions',
14+
'qaboard.iterators',
15+
'qaboard.qa',
16+
'qaboard.lsf',
17+
'qaboard.api'
18+
]
19+
for m in modules:
20+
sys.modules[m.replace('qaboard', 'qatools')] = sys.modules[m]

qatools/__main__.py

-2
This file was deleted.

setup.py

+17-6
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,27 @@
1717
# (works, ugly) patch: `+ verify=False` in lib/python37/site-packages/twine/repository.py:175
1818
# (helps) ssh $nice_host
1919
twine upload --verbose -u __token__ dist/*
20+
21+
22+
Until https://github.com/pypa/pip/issues/2195 is resolved,
23+
for local development with `pip install` without `--editable`,
24+
you'll likely want to speed-up pip
25+
```
26+
# site-packages/pip/_internal/download.py
27+
778: + from shutil import ignore_patterns
28+
+ shutil.copytree(link_path, location, symlinks=True, ignore=ignore_patterns('.git', 'node_modules'))
29+
- shutil.copytree(link_path, location, symlinks=True)
30+
```
31+
2032
"""
2133
# https://github.com/ninjaaron/fast-entry_points
2234
import fastentrypoints
2335

2436
from pathlib import Path
2537
from setuptools import setup, find_packages
2638

27-
# The directory containing this file
28-
HERE = Path(__file__).parent
29-
README = (HERE / "README.md").read_text(encoding='utf-8')
39+
README_md = Path(__file__).parent / "README.md"
40+
README = README_md.read_text(encoding='utf-8')
3041

3142
setup(
3243
name='qaboard',
@@ -52,8 +63,8 @@
5263
"Topic :: Software Development :: Quality Assurance",
5364
],
5465

55-
python_requires='>=3.6',
5666
packages=find_packages(exclude=("tests","backend")),
67+
python_requires='>=3.6',
5768
install_requires=[
5869
'dataclasses', # Backport for python3.6
5970
'click>=7.0', # CLI for humans. In v7 they changed CLI command conventions, started using "-" vs "_"
@@ -75,15 +86,15 @@
7586
extras_require={
7687
# Optionnal needed only for `qa optimize`
7788
# Since its CLI usage is not straightforward, it's best kept at an optionnal dependency
78-
# Enable with `pip install qatools[optimize]`
89+
# Enable with `pip install qaboard[optimize]`
7990
# Since the package is not maintained anymore, maybe we should review the optimization loop
8091
# and use nevergrad like all the cool kids.
8192
'optimize': ["skopt"],
8293
},
8394

8495
entry_points={
8596
"console_scripts": [
86-
'qa = qatools.qatools:main'
97+
'qa = qaboard.qa:main'
8798
]
8899
},
89100

tests/test_conventions.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77

88
class TestConventions(unittest.TestCase):
99
def test_serialize_config(self):
10-
from qatools.conventions import serialize_config
10+
from qaboard.conventions import serialize_config
1111
self.assertEqual(serialize_config(['a', 'b', 'c']), 'a:b:c')
1212
self.assertEqual(serialize_config(['a', {'b': 1}]), 'a:{"b": 1}')
1313
self.assertEqual(serialize_config(['a', '{"b":1']), 'a:{"b":1')
1414

1515
def test_deserialize_config(self):
16-
from qatools.conventions import deserialize_config
16+
from qaboard.conventions import deserialize_config
1717
self.assertEqual(deserialize_config('a:b:c'), ['a', 'b', 'c'])
1818
self.assertEqual(deserialize_config('a:{"b":1}'), ['a', {'b': 1}])
1919
self.assertEqual(deserialize_config('a:{"b":1'), ['a', '{"b":1'])

tests/test_iterators.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
class TestConventions(unittest.TestCase):
88
def test_flatten(self):
9-
from qatools.iterators import flatten
9+
from qaboard.iterators import flatten
1010
self.assertEqual(list(flatten([])), [])
1111
self.assertEqual(list(flatten([1])), [1])
1212
self.assertEqual(list(flatten([1, [2]])), [1, 2])
1313
self.assertEqual(list(flatten([1, [2], [3, 4, [5], [6, [7]]] ])), [1, 2, 3, 4, 5, 6, 7])
1414
self.assertEqual(list(flatten([1, {"cde": [2, 3]} ])), [1, {"cde": [2, 3]}])
1515

1616
def test_resolve_aliases(self):
17-
from qatools.iterators import resolve_aliases
17+
from qaboard.iterators import resolve_aliases
1818
self.assertEqual(
1919
list(resolve_aliases(["a", "b"], {"c": ["d", "e"], "f": ["g", "h"]})),
2020
['a', 'b']

website/docusaurus.config.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ var config = {
1717
tagline: "Visualize and compare algorithm results. Optimize parameters. Share results and track progress.",
1818
// You may provide arbitrary config keys to be used as needed by your
1919
// template. For example, if you need your repo's URL...
20-
// repoUrl: 'https://gitlab-srv/common-infrastructure/qatools',
2120

2221
// scripts: [
2322
// Add custom scripts here that would be placed in <script> tags.
@@ -40,7 +39,7 @@ var config = {
4039
links: [
4140
{to: 'docs/introduction', label: 'Docs', position: 'left'},
4241
{
43-
href: 'https://github.com/samsung/qaboard',
42+
href: 'https://github.com/Samsung/qaboard',
4443
label: 'GitHub.com',
4544
position: 'right',
4645
},
@@ -96,16 +95,16 @@ if (!publish_github_samsung_private && !publish_github_samsung_public) {
9695
url: 'http://qa-docs', // Your website URL
9796
baseUrl: '/', // Base URL for your project */
9897
}
99-
config.presets[0][1].editUrl = 'http://gitlab-srv/common-infrastructure/qatools/edit/master/website/';
98+
config.presets[0][1].editUrl = 'http://gitlab-srv/common-infrastructure/qaboard/edit/master/website/';
10099
} else {
101100
if (publish_github_samsung_private) {
102101
config = {
103102
...config,
104103
url: 'https://github.sec.samsung.net',
105-
baseUrl: '/pages/arthur-flam/qatools/',
104+
baseUrl: '/pages/arthur-flam/qaboard/',
106105
githubHost: 'github.sec.samsung.net',
107106
organizationName: 'arthur-flam',
108-
projectName: 'qatools',
107+
projectName: 'qaboard',
109108
}
110109
}
111110
if (publish_github_samsung_public) {

0 commit comments

Comments
 (0)