Skip to content

Commit 103fa7f

Browse files
authored
Refactors CaseStudy out into varats-core (#366)
1 parent aeded5b commit 103fa7f

File tree

155 files changed

+1503
-1476
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+1503
-1476
lines changed

.travis.yml

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ script:
4242
- pip uninstall -y rich
4343
######
4444
- mypy --strict -p varats
45-
- mypy --strict -p varats-core
4645

4746
after_success:
4847
- codecov

docs/source/vara-ts-api/data.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Module: data_manager
9898
Module: version_header
9999
......................
100100

101-
.. automodule:: varats.data.version_header
101+
.. automodule:: varats.base.version_header
102102
:members:
103103
:undoc-members:
104104
:show-inheritance:
@@ -111,12 +111,12 @@ Data providers
111111
Providers are a means to supply additional data for a :ref:`project<Projects>`.
112112
For example, the :ref:`CVE provider` allows access to all CVEs that are related to a project.
113113

114-
You can implement your own provider by creating a subclass of :class:`~varats.data.provider.provider.Provider` in its own subdirectory of ``data/provider``.
114+
You can implement your own provider by creating a subclass of :class:`~varats.provider.provider.Provider` in its own subdirectory of ``provider`` in varats-core.
115115
There is no restriction on the format in which data has to be provided.
116116
The ``Provider`` abstract class only requires you to specify how to create an instance of your provider for a specific project, as well as a fallback implementation (that most likely returns no data).
117-
If your provider needs some project-specific implementation, create a class with the name ``<your_provider_class>Hook`` and make the projects inherit from it, similar to the :class:`~varats.data.provider.cve.cve_provider.CVEProviderHook`.
118-
If a project does not inherit from that hook, your provider's :func:`~varats.data.provider.provider.Provider.create_provider_for_project` should return ``None``.
119-
In that case, the :func:`provider factory method<varats.data.provider.provider.Provider.get_provider_for_project>` falls back to your default provider implementation and issues a warning.
117+
If your provider needs some project-specific implementation, create a class with the name ``<your_provider_class>Hook`` and make the projects inherit from it, similar to the :class:`~varats.provider.cve.cve_provider.CVEProviderHook`.
118+
If a project does not inherit from that hook, your provider's :func:`~varats.provider.provider.Provider.create_provider_for_project` should return ``None``.
119+
In that case, the :func:`provider factory method<varats.provider.provider.Provider.get_provider_for_project>` falls back to your default provider implementation and issues a warning.
120120
For an example provider implementation take a look at the :ref:`CVE provider`.
121121

122122

@@ -131,7 +131,7 @@ For an example provider implementation take a look at the :ref:`CVE provider`.
131131
Provider module
132132
...............
133133

134-
.. automodule:: varats.data.provider.provider
134+
.. automodule:: varats.provider.provider
135135
:members:
136136
:undoc-members:
137137
:show-inheritance:

docs/source/vara-ts-api/data_providers/cve_provider.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ CVE Provider
22
------------
33

44
This provider allows access to CVEs associated with a project.
5-
It relies on a :class:`hook<varats.data.provider.cve.cve_provider.CVEProviderHook>` to know what CVEs belong to that project and uses heuristics to determine which revision fixed a certain CVE.
5+
It relies on a :class:`hook<varats.provider.cve.cve_provider.CVEProviderHook>` to know what CVEs belong to that project and uses heuristics to determine which revision fixed a certain CVE.
66

7-
.. automodule:: varats.data.provider.cve.cve_provider
7+
.. automodule:: varats.provider.cve.cve_provider
88
:members:
99
:undoc-members:
1010
:show-inheritance:
1111

12-
.. automodule:: varats.data.provider.cve.cve
12+
.. automodule:: varats.provider.cve.cve
1313
:members:
1414
:undoc-members:
1515
:show-inheritance:
1616

17-
.. automodule:: varats.data.provider.cve.cve_map
17+
.. automodule:: varats.provider.cve.cve_map
1818
:members:
1919
:undoc-members:
2020
:show-inheritance:

docs/source/vara-ts-api/data_providers/release_provider.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ Release Provider
33

44
This provider allows access to the release revisions of a project.
55
The default implementation works for projects following the versioning scheme specified in `PEP 440 <https://www.python.org/dev/peps/pep-0440/>`_.
6-
Alternatively, a :class:`hook<varats.data.provider.release.release_provider.ReleaseProviderHook>` can be used for custom release lookup logic.
6+
Alternatively, a :class:`hook<varats.provider.release.release_provider.ReleaseProviderHook>` can be used for custom release lookup logic.
77

8-
.. automodule:: varats.data.provider.release.release_provider
8+
.. automodule:: varats.provider.release.release_provider
99
:members:
1010
:undoc-members:
1111
:show-inheritance:

docs/source/vara-ts-api/experiments.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ For example, how a specific project is compiled is the responsibilitty of the pr
1111
Designing a new ``Experiment`` is also quite simple.
1212

1313
* First, create a new python module in the ``experiments`` directory and add an experiment class which inherits from ``benchbuild.experiment.Experiment``.
14-
If VaRA-TS should provide automatic support for analyzing different versions, i.e., different revisions of a git based project, use :class:`~varats.utils.experiment_util.VersionExperiment` as base class.
14+
If VaRA-TS should provide automatic support for analyzing different versions, i.e., different revisions of a git based project, use :class:`~varats.utilss.experiment_util.VersionExperiment` as base class.
1515
* Second, define two static variables for your experiment: ``NAME`` and ``REPORT_TYPE``
1616
* Next, override the ``actions_for_project`` method.
1717
This method should assign run-time/compile-time extensions and specify the list of actions that should be performed.
1818
Each action the experiment does is called a ``Step`` and will be executed by BenchBuild in order.
19-
* Last, add your experiment for testing to the BenchBuild config file `vara-root/benchbuild/.benchbuild.yml` under plugins/experiments/value. After testing, integrate them into the tool suite by adding it to the experiment list in ``varats.utils.settings.generate_benchbuild_config``, so it will be automatically added to the BenchBuild config in the future.
19+
* Last, add your experiment for testing to the BenchBuild config file `vara-root/benchbuild/.benchbuild.yml` under plugins/experiments/value. After testing, integrate them into the tool suite by adding it to the experiment list in ``varats.utilss.settings.generate_benchbuild_config``, so it will be automatically added to the BenchBuild config in the future.
2020

2121
.. note::
2222
For more information about ``Experiment``'s consider reading the BenchBuild `docs <https://pprof-study.readthedocs.io/en/master/>`_.
@@ -51,7 +51,7 @@ WLLVM module
5151
Experiment utilities module
5252
...........................
5353

54-
.. automodule:: varats.utils.experiment_util
54+
.. automodule:: varats.utilss.experiment_util
5555
:noindex:
5656
:members:
5757
:undoc-members:

docs/source/vara-ts-api/paper.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Paper and case study modules
114114
Module: paper_config
115115
....................
116116

117-
.. automodule:: varats.paper.paper_config
117+
.. automodule:: varats.paper_mgmt.paper_config
118118
:members:
119119
:undoc-members:
120120
:show-inheritance:
@@ -134,7 +134,7 @@ Module: case_study
134134
Module: artefacts
135135
..................
136136

137-
.. automodule:: varats.paper.artefacts
137+
.. automodule:: varats.paper_mgmt.artefacts
138138
:members:
139139
:undoc-members:
140140
:show-inheritance:
@@ -144,7 +144,7 @@ Module: artefacts
144144
Module: paper_config_manager
145145
............................
146146

147-
.. automodule:: varats.paper.paper_config_manager
147+
.. automodule:: varats.paper_mgmt.paper_config_manager
148148
:members:
149149
:undoc-members:
150150
:show-inheritance:

docs/source/vara-ts-api/projects.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ template for your own project::
2929
from benchbuild.utils.settings import get_number_of_jobs
3030
from plumbum import local
3131

32-
from varats.paper.paper_config import project_filter_generator
33-
from varats.utils.settings import bb_cfg
34-
from varats.utils.project_util import (
32+
from varats.paper_mgmt.paper_config import project_filter_generator
33+
from varats.utilss.settings import bb_cfg
34+
from varats.utilss.project_util import (
3535
ProjectBinaryWrapper,
3636
wrap_paths_to_binaries,
3737
)

docs/source/vara-ts-api/utils.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Utilities overview
1414
Module: cli_util
1515
................
1616

17-
.. automodule:: varats.utils.cli_util
17+
.. automodule:: varats.utilss.cli_util
1818
:members:
1919
:undoc-members:
2020
:show-inheritance:
@@ -24,7 +24,7 @@ Module: cli_util
2424
Module: exceptions
2525
..................
2626

27-
.. automodule:: varats.utils.exceptions
27+
.. automodule:: varats.utilss.exceptions
2828
:members:
2929
:undoc-members:
3030
:show-inheritance:
@@ -34,7 +34,7 @@ Module: exceptions
3434
Module: git_util
3535
................
3636

37-
.. automodule:: varats.utils.git_util
37+
.. automodule:: varats.utilss.git_util
3838
:members:
3939
:undoc-members:
4040
:show-inheritance:
@@ -44,7 +44,7 @@ Module: git_util
4444
Module: experiment_util
4545
.......................
4646

47-
.. automodule:: varats.utils.experiment_util
47+
.. automodule:: varats.utilss.experiment_util
4848
:members:
4949
:undoc-members:
5050
:show-inheritance:
@@ -54,7 +54,7 @@ Module: experiment_util
5454
Module: project_util
5555
....................
5656

57-
.. automodule:: varats.utils.project_util
57+
.. automodule:: varats.utilss.project_util
5858
:members:
5959
:undoc-members:
6060
:show-inheritance:
@@ -64,7 +64,7 @@ Module: project_util
6464
Module: filesystem_util
6565
.......................
6666

67-
.. automodule:: varats.utils.filesystem_util
67+
.. automodule:: varats.utilss.filesystem_util
6868
:members:
6969
:undoc-members:
7070
:show-inheritance:
@@ -102,7 +102,7 @@ For logging categories, we follow the default python logging `HOWTO <https://doc
102102
Module: logger_util
103103
.......................
104104

105-
.. automodule:: varats.utils.logger_util
105+
.. automodule:: varats.utilss.logger_util
106106
:members:
107107
:undoc-members:
108108
:show-inheritance:

mypy.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[mypy]
22
namespace_packages = True
3-
mypy_path = varats/
3+
mypy_path = varats/:varats-core/
44

55
[mypy-benchbuild.*]
66
ignore_missing_imports = True

notebooks/cf_df_plot_example.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"metadata": {},
77
"outputs": [],
88
"source": [
9-
"from varats.utils.settings import CFG\n",
9+
"from varats.utilss.settings import CFG\n",
1010
"from varats.jupyterhelper.file import load_commit_report"
1111
]
1212
},

tests/data/test_blame_verifier_report.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
import unittest
44
from pathlib import Path
55

6-
from varats.data.report import FileStatusExtension
76
from varats.data.reports.blame_verifier_report import (
87
BlameVerifierReportNoOpt,
98
BlameVerifierReportOpt,
109
)
10+
from varats.report.report import FileStatusExtension
1111

1212

1313
class TestBlameVerifierReport(unittest.TestCase):

tests/data/test_commit_report.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import yaml
77

8-
from varats.data.report import FileStatusExtension
98
from varats.data.reports.commit_report import (
109
CommitMap,
1110
CommitReport,
@@ -14,6 +13,7 @@
1413
RegionMapping,
1514
generate_interactions,
1615
)
16+
from varats.report.report import FileStatusExtension
1717

1818
YAML_DOC_1 = """---
1919
DocType: CommitReport

tests/data/test_cve.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import requests_cache
88

9-
from varats.data.provider.cve.cve import (
9+
from varats.provider.cve.cve import (
1010
CVE,
1111
CWE,
1212
find_all_cve,

tests/data/test_diff_correlation_overview_table.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pytest
55

66
from tests.test_utils import replace_config, TEST_INPUTS_DIR
7-
from varats.paper.paper_config import load_paper_config
7+
from varats.paper_mgmt.paper_config import load_paper_config
88
from varats.tables import diff_correlation_overview_table
99

1010

tests/data/test_report.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import unittest
44

5-
from varats.data.report import FileStatusExtension, MetaReport
65
from varats.data.reports.commit_report import CommitReport as CR
76
from varats.data.reports.empty_report import EmptyReport
7+
from varats.report.report import FileStatusExtension, MetaReport
88

99

1010
class TestMetaReport(unittest.TestCase):

tests/data/test_version_header.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import yaml
66

7-
import varats.data.version_header as vh
7+
import varats.base.version_header as vh
88

99

1010
class TestVersionHeader(unittest.TestCase):

tests/paper/test_artefacts.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
from pathlib import Path
44
from tempfile import NamedTemporaryFile
55

6-
from varats.paper.artefacts import (
6+
from varats.paper_mgmt.artefacts import (
77
ArtefactType,
88
PlotArtefact,
99
load_artefacts_from_file,
1010
)
1111
from varats.plots.paper_config_overview import PaperConfigOverviewPlot
12-
from varats.utils.settings import vara_cfg
12+
from varats.utilss.settings import vara_cfg
1313

1414
YAML_ARTEFACTS = """DocType: Artefacts
1515
Version: 1

tests/paper/test_case_study.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import varats.paper.case_study as CS
88
from varats.data.reports.commit_report import CommitMap
9+
from varats.paper_mgmt.case_study import sample_n
910

1011
YAML_CASE_STUDY = """---
1112
DocType: CaseStudy
@@ -154,23 +155,23 @@ def test_sample_amount(self):
154155
"""Check if sampling function produces the correct amount of sample."""
155156
self.assertEqual(
156157
len(
157-
CS.sample_n(
158+
sample_n(
158159
CS.SamplingMethod.uniform.gen_distribution_function(), 5,
159160
self.base_list
160161
)
161162
), 5
162163
)
163164
self.assertEqual(
164165
len(
165-
CS.sample_n(
166+
sample_n(
166167
CS.SamplingMethod.uniform.gen_distribution_function(), 1,
167168
self.base_list
168169
)
169170
), 1
170171
)
171172
self.assertEqual(
172173
len(
173-
CS.sample_n(
174+
sample_n(
174175
CS.SamplingMethod.uniform.gen_distribution_function(), 7,
175176
self.base_list
176177
)
@@ -182,7 +183,7 @@ def test_sample_more_than_max_amount(self):
182183
we sample more than in the initial list."""
183184
self.assertEqual(
184185
len(
185-
CS.sample_n(
186+
sample_n(
186187
CS.SamplingMethod.uniform.gen_distribution_function(),
187188
len(self.base_list) + 1, self.base_list
188189
)
@@ -191,7 +192,7 @@ def test_sample_more_than_max_amount(self):
191192

192193
self.assertEqual(
193194
len(
194-
CS.sample_n(
195+
sample_n(
195196
CS.SamplingMethod.uniform.gen_distribution_function(),
196197
len(self.base_list) + 666, self.base_list
197198
)
@@ -203,7 +204,7 @@ def test_sample_nothing(self):
203204
we want nothing."""
204205
self.assertEqual(
205206
len(
206-
CS.sample_n(
207+
sample_n(
207208
CS.SamplingMethod.uniform.gen_distribution_function(), 0,
208209
self.base_list
209210
)

0 commit comments

Comments
 (0)