Skip to content

Commit ab015d6

Browse files
authored
Develop (#30)
* Filter out directories generating pytest errors. * Doc: fix and improve settings section. * Homogenize versions. * Fix sphinx-js warning. * Move autodoc examples to doctest format. * Exclude docs and tests from directories scanned by mypy. * Doc: remove inherited members from Pydantic models. * Doc: refactor config API. * Doc: move settings API outside of config section.
1 parent 5786325 commit ab015d6

File tree

11 files changed

+167
-148
lines changed

11 files changed

+167
-148
lines changed

docs/src/api/server/config.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
Config
22
======
33

4+
.. automodule:: visiomatic.server.config.config
5+
:members:
6+
:show-inheritance:
7+
8+
.. automodule:: visiomatic.server.config.fields
9+
:members:
10+
:show-inheritance:
11+
12+
.. automodule:: visiomatic.server.config.quantity
13+
:members:
14+
:show-inheritance:
15+
416
.. automodule:: visiomatic.server.config
517
:members:
618
:show-inheritance:

docs/src/api/server/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Python server
22
=============
33

44
.. toctree::
5-
:maxdepth: 3
5+
:maxdepth: 2
66

77
app
88
cache

docs/src/api/server/settings.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Settings
22
========
33

4-
.. automodule:: visiomatic.server.settings
4+
.. automodule:: visiomatic.server.config.settings
55
:members:
66
:show-inheritance:
77

docs/src/api/server/tiled.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ Tiled
33

44
.. automodule:: visiomatic.server.tiled
55
:members:
6-
:inherited-members:
76
:show-inheritance:
87

98

docs/src/conf.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
# -- Project information -----------------------------------------------------
2121

2222
project = 'VisiOmatic'
23-
copyright = '2024 Emmanuel Bertin, Hervé Bouy'
23+
copyright = '2024 CEA/CFHT/CNRS/UParisSaclay'
2424
author = 'Emmanuel Bertin, Hervé Bouy'
2525

2626
# The full version, including alpha/beta/rc tags
27-
release = '3.0.0'
27+
release = '3.0.4'
2828

2929

3030
# -- General configuration ---------------------------------------------------
@@ -42,6 +42,7 @@
4242
'sphinx.ext.mathjax',
4343
'sphinx.ext.todo',
4444
'sphinx.ext.viewcode',
45+
'sphinxcontrib.autodoc_pydantic',
4546
'sphinxcontrib.bibtex'
4647
]
4748

pyproject.toml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "pdm.backend"
44

55
[project]
66
name = "VisiOmatic"
7-
version = "3.0.3"
7+
version = "3.0.4"
88
description = "A web application for visualizing astronomical images"
99
authors = [
1010
{name = "Emmanuel Bertin", email = "[email protected]"},
@@ -49,6 +49,7 @@ test = [
4949
"pytest-cov"
5050
]
5151
doc = [
52+
"autodoc_pydantic >= 2.2.0",
5253
"sphinx >= 7.0",
5354
"sphinx-rtd-theme >= 1.2",
5455
"sphinxcontrib-bibtex >= 2.4.0",
@@ -76,7 +77,16 @@ mypy = "mypy src"
7677
pre_build = {composite = ["doc", "mypy"]}
7778
pre_install = {composite = ["doc", "mypy"]}
7879

80+
[tool.mypy]
81+
exclude = ["docs", "tests"]
82+
7983
[tool.pytest.ini_options]
84+
norecursedirs = [
85+
"tests/performance",
86+
"src/visiomatic/client",
87+
]
88+
addopts = "--doctest-modules --doctest-continue-on-failure"
89+
doctest_optionflags = "NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL ELLIPSIS"
8090
filterwarnings = [
8191
"ignore::DeprecationWarning"
8292
]

src/visiomatic/client/js/control/UI.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ export const UI = Control.extend( /** @lends UI */ {
6565
* @param {boolean} [options.position='topleft']
6666
Position of the dialog on the map.
6767
68-
* @see [Leaflet API reference]{@link https://leafletjs.com/reference.html#control}
69-
for additional control options.
68+
* @see Leaflet API reference]{@link https://leafletjs.com/reference.html#control}
7069
7170
* @returns {UI} VisiOmatic UI instance.
7271
*/
@@ -855,10 +854,10 @@ export const UI = Control.extend( /** @lends UI */ {
855854
* Instantiate a VisiOmatic UI.
856855
* @memberof module:control/UI.js
857856
* @function
858-
* @param {VTileLayer[]} baseLayers - Array of layers
859-
* @param {object} [options] - Options: see {@link UI}
857+
* @param {VTileLayer[]} baseLayers - Array of layers.
858+
* @param {object} [options] - Options: see {@link UI}.
860859
* @returns {UI} VisiOmatic UI instance.
861-
*/
860+
*/
862861
export const ui = function (baseLayers, options) {
863862
return new UI(baseLayers, options);
864863
};

src/visiomatic/client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "visiomatic",
3-
"version": "3.0.3",
3+
"version": "3.0.4",
44
"description": "Astronomical image client viewer",
55
"homepage": "https://github.com/astromatic/visiomatic",
66
"author": "Emmanuel Bertin (CFHT/IAP/CNRS/SorbonneU/CEA/UParisSaclay)",

src/visiomatic/server/config/__init__.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,13 @@ def override(key: str, value: Any) -> Any:
2424
2525
Examples
2626
--------
27-
```python
28-
from .config import override
27+
>>> from . import override, settings
28+
>>> settings['port'] = 8009
29+
>>> print(f"{override('port', 8080)}")
30+
8080
2931
30-
print(f"{override('a_setting', 10)}")
31-
32-
#> 10
33-
34-
print(f"{override('a_setting', None)}")
35-
36-
#> 3
32+
>>> print(f"{override('port', None)}")
33+
8009
3734
3835
Parameters
3936
----------
@@ -50,8 +47,6 @@ def override(key: str, value: Any) -> Any:
5047
return settings[key] if value is None else value
5148

5249

53-
54-
if 'sphinx' not in modules:
55-
config_filename = config.config_filename
56-
image_filename = config.image_filename
50+
config_filename = config.config_filename
51+
image_filename = config.image_filename
5752

src/visiomatic/server/config/fields.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,21 @@ def SField(short: str | None = None, **kwargs) -> Any:
1919
2020
Examples
2121
--------
22-
```python
23-
from pydantic_settings import BaseSettings
24-
25-
class Settings(BaseSettings):
26-
parameter: float = SField(
27-
short='p',
28-
description="an arbitrary parameter",
29-
default=10.,
30-
)
22+
>>> from pydantic_settings import BaseSettings
23+
24+
>>> class Settings(BaseSettings):
25+
... parameter: float = SField(
26+
... short='p',
27+
... description="an arbitrary parameter",
28+
... default=10.,
29+
... )
3130
32-
s = Settings(parameter=3.)
31+
>>> s = Settings(parameter=3.)
3332
34-
print(s.model_schema_json())
35-
#> {'additionalProperties': False, 'properties': {'parameter': {'default':
36-
# '10.', 'description': 'an arbitrary parameter', 'short': 'p',
37-
# 'title': 'Parameter', 'type': 'float'}}, 'title': 'Settings', 'type':
38-
# 'object'}
33+
>>> s.model_json_schema()
34+
{'additionalProperties': False, 'properties': {'parameter': {'default': 10.0,
35+
'description': 'an arbitrary parameter', 'short': 'p', 'title': 'Parameter',
36+
'type': 'number'}}, 'title': 'Settings', 'type': 'object'}
3937
4038
Parameters
4139
----------

0 commit comments

Comments
 (0)