Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Switch to TOML and use Pydantic for validation #1432

Draft
wants to merge 39 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
29aeaf1
MAINT: Remove dev outright
HaoZeke Sep 8, 2024
331ece9
BLD: Add a catch-all asv[all] target
HaoZeke Sep 8, 2024
bd7ade0
BLD: Cleanup unnecessary virtualenv group
HaoZeke Sep 8, 2024
564efda
MAINT: Cleanup to not include test dependencies
HaoZeke Sep 8, 2024
e60a3bc
DOC: Remove unused make cruft
HaoZeke Sep 8, 2024
4c1445a
BLD: Use newer options for setuptools_scm
HaoZeke Sep 8, 2024
32aad70
DOC: Use importlib for obtaining version numbers
HaoZeke Sep 8, 2024
e28498d
DOC: Use autoapi and stop importing asv
HaoZeke Sep 8, 2024
c8e6a08
DOC: Cleanup old/unused comments and options
HaoZeke Sep 8, 2024
fc7bc43
DOC: Cleanup gitig and be explicit about conf
HaoZeke Sep 8, 2024
32fb296
DOC: Reduce warnings and errors from Sphinx
HaoZeke Sep 8, 2024
d785097
DOC: Rework to resolve references correctly
HaoZeke Sep 8, 2024
775a0cb
DOC: Add a proper bibtex file
HaoZeke Sep 8, 2024
4652a40
MAINT: Use better version management
HaoZeke Sep 8, 2024
51295fc
DOC: Restructure with bibtex and more explicit pgs
HaoZeke Sep 8, 2024
3cc220a
DOC: Cleanup more warnings
HaoZeke Sep 8, 2024
2ac7645
DOC: Minor cleanup with more mathjax
HaoZeke Sep 8, 2024
941aa2c
DOC: Switch to katex
HaoZeke Sep 8, 2024
278170e
MAINT: Switch to furo
HaoZeke Sep 8, 2024
9cca359
MAINT: Minor rename
HaoZeke Sep 8, 2024
2ddd459
DOC: Add logos and theme options
HaoZeke Sep 8, 2024
638bd85
MAINT: Rework documentation slightly
HaoZeke Sep 8, 2024
567a534
MAINT: Remove unused fork banner
HaoZeke Sep 8, 2024
514d975
MAINT: Remove inline TOC handled by the theme
HaoZeke Sep 8, 2024
c5f3da8
MAINT: Add and use sphinx-collapse
HaoZeke Sep 8, 2024
8b3f800
MAINT: Update conf
HaoZeke Sep 8, 2024
4012ef9
MAINT: Minor cleanup of documentation
HaoZeke Sep 8, 2024
3f970fe
MAINT: Appease linter
HaoZeke Sep 8, 2024
9f4aa36
MAINT: Bump scm version
HaoZeke Sep 8, 2024
f0c87a6
MAINT: Go back to an older scm version
HaoZeke Sep 8, 2024
b637ea2
MAINT: Use a backfill for importlib.metadata
HaoZeke Sep 8, 2024
c7b149b
MAINT: Add the dep needed for sphinx
HaoZeke Sep 8, 2024
0361580
MAINT: Rework with importlib_metadata
HaoZeke Sep 8, 2024
4b2e8d0
MAINT: Please the linter
HaoZeke Sep 8, 2024
1aa9ee0
DOC: Minor cleanup
HaoZeke Sep 8, 2024
047febc
MAINT: Fix versionadded calls
HaoZeke Sep 8, 2024
e88a2ac
MAINT: Rename and move to clarify statistics
HaoZeke Sep 9, 2024
fdca470
BLD: Setup the pydantic config
HaoZeke Sep 9, 2024
65eec8e
ENH: Start testing a schema for pydantic
HaoZeke Sep 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Added
/docs/html/
docs/source/autoapi/
# Compiled files
*.py[cod]
*.a
Expand Down Expand Up @@ -46,4 +49,3 @@ htmlcov

# Mac OSX
.DS_Store
/docs/html/
5 changes: 4 additions & 1 deletion asv/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst

from asv._version import version as __version__
from importlib_metadata import version as get_version

from asv import plugin_manager # noqa F401 Needed to load the plugins

__version__ = get_version("asv")

__all__ = '__version__',
23 changes: 17 additions & 6 deletions asv/statistics.py → asv/_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ def mann_whitney_u(x, y, method='auto'):
"""
Mann-Whitney U test

Ties are handled conservatively, returning the least significant
tie breaking.
Ties are handled conservatively, returning the least significant tie
breaking.
:cite:empty:`mwu-mannTestWhetherOne1947,mwu-gibbonsNonparametricStatisticalInference2010`.

Parameters
----------
Expand All @@ -96,8 +97,10 @@ def mann_whitney_u(x, y, method='auto'):

References
----------
.. [1] Mann & Whitney, Ann. Math. Statist. 18, 50 (1947).
.. [2] Gibbons & Chakraborti, "Nonparametric statistical inference". (2003)
.. bibliography::
:filter: docname in docnames
:labelprefix: MWU_
:keyprefix: mwu-

"""
memo = _mann_whitney_u_memo
Expand Down Expand Up @@ -177,11 +180,19 @@ def mann_whitney_u_r(m, n, u, memo=None):
Number of orderings in Mann-Whitney U test.

The PMF of U for samples of sizes (m, n) is given by
p(u) = r(m, n, u) / binom(m + n, m).
:cite:empty:`mwur-mannTestWhetherOne1947`

.. code-block::

p(u) = r(m, n, u) / binom(m + n, m).

References
----------
.. [1] Mann & Whitney, Ann. Math. Statist. 18, 50 (1947).
.. bibliography::
:filter: docname in docnames
:labelprefix: MWUR_
:keyprefix: mwur-

"""
if u < 0:
value = 0
Expand Down
1 change: 0 additions & 1 deletion asv/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
'Machine',
'Setup',
'Run',
'Dev',
'Continuous',
'Find',
'Rm',
Expand Down
7 changes: 5 additions & 2 deletions asv/commands/common_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import multiprocessing
import argparse

from .. import __version__, util
from importlib_metadata import version as get_version

from asv import util


def add_global_arguments(parser, suppress_defaults=True):
Expand All @@ -29,7 +31,8 @@ def add_global_arguments(parser, suppress_defaults=True):
default=(argparse.SUPPRESS if suppress_defaults else None))

parser.add_argument(
"--version", action="version", version="%(prog)s " + __version__,
"--version", action="version",
version="%(prog)s " + get_version("asv"),
help="Print program version",
**suppressor)

Expand Down
4 changes: 2 additions & 2 deletions asv/commands/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from ..util import human_value, load_json
from ..console import log
from ..environment import get_environments
from .. import util, statistics
from .. import util, _stats


def mean(values):
Expand Down Expand Up @@ -76,7 +76,7 @@ def _is_result_better(a, b, a_ss, b_ss, factor, use_stats=True):
# Special-case the situation with only one sample, in which
# case we do the comparison only based on `factor` as there's
# not enough data to do statistics.
if not statistics.is_different(a_ss[1], b_ss[1],
if not _stats.is_different(a_ss[1], b_ss[1],
a_ss[0], b_ss[0]):
return False

Expand Down
32 changes: 0 additions & 32 deletions asv/commands/dev.py

This file was deleted.

24 changes: 13 additions & 11 deletions asv/commands/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@
import datetime
from collections import defaultdict

from . import Command
from ..benchmarks import Benchmarks
from ..console import log
from ..graph import GraphSet
from ..machine import iter_machine_files
from ..repo import get_repo
from ..results import iter_results
from ..publishing import OutputPublisher
from .. import statistics, util, __version__
from importlib_metadata import version as get_version

from asv.commands import Command
from asv.benchmarks import Benchmarks
from asv.console import log
from asv.graph import GraphSet
from asv.machine import iter_machine_files
from asv.repo import get_repo
from asv.results import iter_results
from asv.publishing import OutputPublisher
from asv import _stats, util


def check_benchmark_params(name, benchmark):
Expand Down Expand Up @@ -189,7 +191,7 @@ def copy_ignore(src, names):
b_params = b['params']

result = results.get_result_value(key, b_params)
weight = [statistics.get_weight(s)
weight = [_stats.get_weight(s)
for s in results.get_result_stats(key, b_params)]
if not b_params:
result = result[0]
Expand Down Expand Up @@ -281,7 +283,7 @@ def copy_ignore(src, names):
}, compact=True)

util.write_json(os.path.join(conf.html_dir, "info.json"), {
'asv-version': __version__,
'asv-version': get_version("asv"),
'timestamp': util.datetime_to_js_timestamp(
datetime.datetime.now(datetime.timezone.utc)
)
Expand Down
4 changes: 3 additions & 1 deletion asv/commands/rm.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

from asv_runner.console import get_answer_default

from . import Command, util
from asv import util

from . import Command
from ..console import log
from ..results import iter_results

Expand Down
18 changes: 11 additions & 7 deletions asv/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


class GraphSet:
"""Manage multiple `Graph`"""
"""Manage multiple :py:class:`Graph` objects"""

def __init__(self):
self._graphs = {}
Expand Down Expand Up @@ -326,15 +326,19 @@ def make_summary_graph(graphs):

def _compute_summary_data_series(*ys):
"""
Given multiple input series::
Given a multiple input series:

y0, y1, ...
.. code-block::

calculate summary data series::
y0, y1, ...

val = [geom_mean([y0[0], y1[0], ...]),
geom_mean([y0[1], y1[1], ...]),
...]
calculate summary data series:

.. code-block::

val = [geom_mean([y0[0], y1[0], ...]),
geom_mean([y0[1], y1[1], ...]),
...]

Missing data in each y-series is filled for each series
separately, before averaging. Data points that are missing from
Expand Down
4 changes: 2 additions & 2 deletions asv/plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class PluginManager:
"""
A class to load and manage plugins.

By default in asv, plugins are searched for in the `asv.plugins`
namespace package and in the `asv.commands` package.
By default in asv, plugins are searched for in the :py:mod:`asv.plugins`
namespace package and in the :py:mod:`asv.commands` package.

Then, any modules specified in the ``plugins`` entry in the
``asv.conf.json`` file are loaded.
Expand Down
12 changes: 9 additions & 3 deletions asv/plugins/_mamba_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,18 +218,24 @@ def replace_channels(self):

def solve(self, specs, pkg_cache_path=None):
"""Solve given a set of specs.

Parameters
----------

specs : list of str
A list of package specs. You can use `conda.models.match_spec.MatchSpec`
to get them to the right form by calling
`MatchSpec(mypec).conda_build_form()`
A list of package specs. You can use
``conda.models.match_spec.MatchSpec`` to get them to the right form
by calling ``MatchSpec(mypec).conda_build_form()``

Returns
-------

transaction : libmambapy.Transaction
The mamba transaction.

Raises
------

RuntimeError :
If the solver did not find a solution.
"""
Expand Down
4 changes: 3 additions & 1 deletion asv/plugins/mamba.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
except ImportError:
from yaml import Loader

from ._mamba_helpers import libmambapy, MambaSolver
import libmambapy

from ._mamba_helpers import MambaSolver
from .. import environment, util
from ..console import log

Expand Down
Loading
Loading