diff --git a/.github/workflows/conda-numpy-build.yml b/.github/workflows/conda-numpy-build.yml index 0883dbda..65427935 100644 --- a/.github/workflows/conda-numpy-build.yml +++ b/.github/workflows/conda-numpy-build.yml @@ -1,67 +1,28 @@ -name: build_publish_anaconda +name: OpenAlea CI on: push: - branches: [ master ] + branches: + - main + - master + tags: + - 'v*' pull_request: - branches: [ master ] - + types: + - opened + - synchronize + - reopened + release: + types: + - published + jobs: - build-and-publish: - name: ${{ matrix.os }}, Python 3.${{ matrix.python-minor-version }} for conda deployment - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - max-parallel: 3 - matrix: - os: [ ubuntu-latest] - python-minor-version: [9] - isMaster: - - ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/dev') }} - exclude: - - isMaster: false - os: ubuntu-latest - python-minor-version: 7 - - isMaster: false - os: ubuntu-latest - python-minor-version: 8 - - isMaster: false - os: macos-latest - python-minor-version: 7 - - isMaster: false - os: macos-latest - python-minor-version: 8 - - isMaster: false - os: macos-latest - python-minor-version: 9 - - isMaster: false - os: windows-latest - python-minor-version: 7 - - isMaster: false - os: windows-latest - python-minor-version: 8 - - isMaster: false - os: windows-latest - python-minor-version: 9 + build: + uses: openalea/action-build-publish-anaconda/.github/workflows/openalea_ci.yml@main + secrets: + anaconda_token: ${{ secrets.ANACONDA_TOKEN }} - steps: - - name: Chekout - uses: actions/checkout@v3 - - name: Determine publish - uses: haya14busa/action-cond@v1 - id: publish - with: - cond: ${{ contains(github.ref, 'master') || startsWith(github.ref, 'refs/heads/v') }} - if_true: 'true' - if_false: 'false' - - name: Build and Publish - uses: openalea/action-build-publish-anaconda@v0.1.4 - with: - conda: numpy/conda - mamba: true - python: ${{ matrix.python-minor-version }} - numpy: '20' - channels: openalea3, conda-forge - token: ${{ secrets.ANACONDA_TOKEN }} - publish: ${{ steps.publish.outputs.value }} - label: main + with: + conda-directory: numpy/conda + python-minor-version: "[10, 11, 12]" + operating-system: '[ "ubuntu-latest" , "macos-13" , "windows-latest"]' diff --git a/.github/workflows/conda-pylab-build.yml b/.github/workflows/conda-pylab-build.yml deleted file mode 100644 index 1fe975c3..00000000 --- a/.github/workflows/conda-pylab-build.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: build_publish_anaconda - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build-and-publish: - name: ${{ matrix.os }}, Python 3.${{ matrix.python-minor-version }} for conda deployment - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - max-parallel: 3 - matrix: - os: [ ubuntu-latest] - python-minor-version: [9] - isMaster: - - ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/dev') }} - exclude: - - isMaster: false - os: ubuntu-latest - python-minor-version: 7 - - isMaster: false - os: ubuntu-latest - python-minor-version: 8 - - isMaster: false - os: macos-latest - python-minor-version: 7 - - isMaster: false - os: macos-latest - python-minor-version: 8 - - isMaster: false - os: macos-latest - python-minor-version: 9 - - isMaster: false - os: windows-latest - python-minor-version: 7 - - isMaster: false - os: windows-latest - python-minor-version: 8 - - isMaster: false - os: windows-latest - python-minor-version: 9 - - steps: - - name: Chekout - uses: actions/checkout@v3 - - name: Determine publish - uses: haya14busa/action-cond@v1 - id: publish - with: - cond: ${{ contains(github.ref, 'master') || startsWith(github.ref, 'refs/heads/v') }} - if_true: 'true' - if_false: 'false' - - name: Build and Publish - uses: openalea/action-build-publish-anaconda@v0.1.4 - with: - conda: pylab/conda - mamba: true - python: ${{ matrix.python-minor-version }} - numpy: '20' - channels: openalea3, conda-forge - token: ${{ secrets.ANACONDA_TOKEN }} - publish: ${{ steps.publish.outputs.value }} - label: main diff --git a/.github/workflows/conda-stdlib-build.yml b/.github/workflows/conda-stdlib-build.yml index b10ba646..9afeb694 100644 --- a/.github/workflows/conda-stdlib-build.yml +++ b/.github/workflows/conda-stdlib-build.yml @@ -1,67 +1,28 @@ -name: build_publish_anaconda +name: OpenAlea CI on: push: - branches: [ master ] + branches: + - main + - master + tags: + - 'v*' pull_request: - branches: [ master ] - + types: + - opened + - synchronize + - reopened + release: + types: + - published + jobs: - build-and-publish: - name: ${{ matrix.os }}, Python 3.${{ matrix.python-minor-version }} for conda deployment - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - max-parallel: 3 - matrix: - os: [ ubuntu-latest] - python-minor-version: [9] - isMaster: - - ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/dev') }} - exclude: - - isMaster: false - os: ubuntu-latest - python-minor-version: 7 - - isMaster: false - os: ubuntu-latest - python-minor-version: 8 - - isMaster: false - os: macos-latest - python-minor-version: 7 - - isMaster: false - os: macos-latest - python-minor-version: 8 - - isMaster: false - os: macos-latest - python-minor-version: 9 - - isMaster: false - os: windows-latest - python-minor-version: 7 - - isMaster: false - os: windows-latest - python-minor-version: 8 - - isMaster: false - os: windows-latest - python-minor-version: 9 + build: + uses: openalea/action-build-publish-anaconda/.github/workflows/openalea_ci.yml@main + secrets: + anaconda_token: ${{ secrets.ANACONDA_TOKEN }} - steps: - - name: Chekout - uses: actions/checkout@v3 - - name: Determine publish - uses: haya14busa/action-cond@v1 - id: publish - with: - cond: ${{ contains(github.ref, 'master') || startsWith(github.ref, 'refs/heads/v') }} - if_true: 'true' - if_false: 'false' - - name: Build and Publish - uses: openalea/action-build-publish-anaconda@v0.1.4 - with: - conda: stdlib/conda - mamba: true - python: ${{ matrix.python-minor-version }} - numpy: '20' - channels: openalea3, conda-forge - token: ${{ secrets.ANACONDA_TOKEN }} - publish: ${{ steps.publish.outputs.value }} - label: main + with: + conda-directory: stdlib/conda + python-minor-version: "[10, 11, 12]" + operating-system: '[ "ubuntu-latest" , "macos-13" , "windows-latest"]' diff --git a/image/setup.py b/image/setup.py index 015c35d3..c017670c 100644 --- a/image/setup.py +++ b/image/setup.py @@ -61,7 +61,7 @@ # tell setup not to create a zip file but install the egg as a directory (recomended to be set to False) zip_safe=False, # Dependencies - setup_requires=['openalea.deploy'], + #setup_requires=['openalea.deploy'], #install_requires=[], #dependency_links=['http://openalea.gforge.inria.fr/pi'], diff --git a/numpy/conda/meta.yaml b/numpy/conda/meta.yaml index f6e683dc..eaced11d 100644 --- a/numpy/conda/meta.yaml +++ b/numpy/conda/meta.yaml @@ -1,44 +1,57 @@ -{% set data = load_setup_py_data() %} +{% set pyproject = load_file_data('../pyproject.toml', from_recipe_dir=True) %} +{% set name = pyproject.get('project').get('name') %} +{% set description = pyproject.get('project').get('description') %} +{% set version = environ.get('SETUPTOOLS_SCM_PRETEND_VERSION', "0.0.0.dev") %} +{% set license = pyproject.get('project').get('license') %} +{% set home = pyproject.get('project', {}).get('urls', {}).get('Homepage', '') %} +{% set build_deps = pyproject.get("build-system", {}).get("requires", []) %} +{% set deps = pyproject.get('project', {}).get('dependencies', []) %} +{% set conda_deps = pyproject.get('tool', {}).get('conda', {}).get('environment', {}).get('dependencies',[]) %} + package: - name: openalea.numpy - version: {{ data.get('version') }} + name: {{ name }} + version: {{ version }} source: path: .. build: noarch: python + string: py{{ PY_VER }} preserve_egg_dir: True - number: 0 - script: {{PYTHON}} setup.py install + # pip install options mainly ensure that dependencies are handled by conda (and not pip) + # --no-deps ensure pip will not install deps not declared in meta.yaml (but declared in pyproject.toml) + # --no-build-isolation ensure pip will not replace build deps declared in meta.yaml (and declared in pyproject.toml) + # --ignore-installed ensure that compiled files (accidentally present in sources or uncleaned locally) will be overwritten + script: {{ PYTHON }} -m pip install . --no-deps --ignore-installed --no-build-isolation -vv requirements: - build: - - python {{PY_VER}} - - setuptools - - openalea.deploy + host: + - python + {% for dep in build_deps %} + - {{ dep }} + {% endfor %} + run: - - python <3.11 - - openalea.core - - openalea.stdlib - - numpy + - python + {% for dep in deps + conda_deps %} + - {{ dep }} + {% endfor %} test: - imports: - - openalea.numpy_wralea requires: - pytest + - setuptools + imports: + - openalea.core + - openalea.numpy_wralea source_files: - - test/ - - test/*.py - + - test/test_*.py commands: - - cd test - - pytest -v test_*.py + - pytest -v about: - home: {{ data.get('url') }} - license: Cecill-c License - summary: {{ data.get('description') }} - + home: {{ home }} + license: {{ license }} + summary: {{ description }} diff --git a/numpy/doc/conf.py b/numpy/doc/conf.py index 185a4426..186b28e5 100644 --- a/numpy/doc/conf.py +++ b/numpy/doc/conf.py @@ -1,16 +1,153 @@ -import os,sys +# -*- coding: utf-8 -*- +import sys +import os -# read sphinx conf.py file -from openalea.misc.sphinx_configuration import * -from openalea.misc.sphinx_tools import sphinx_check_version -from openalea.deploy.metainfo import read_metainfo +import pydata_sphinx_theme # Pydata theme: https://pydata-sphinx-theme.readthedocs.io/en/stable/index.html -sphinx_check_version() # check that sphinx version is recent -metadata = read_metainfo('../metainfo.ini') # read metainfo from common file with setup.py -for key in ['version','project','release', 'name']: - exec("%s = '%s'" % (key, metadata[key])) +from importlib.metadata import metadata +project='numpy' +meta = metadata('openalea.' + project) +release = meta.get("version") +# for example take major/minor +version = ".".join(release.split('.')[:3]) +author = meta['Author'].split(' <')[0] +desc = meta['Summary'] +urls = {k:v for k,v in [item.split(',') for item in meta.get_all('Project-URL')]} -# by product that need to be updated: -latex_documents = [('contents', 'main.tex', project + ' documentation', authors, 'manual')] -project = name +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# sys.path.insert(0, os.path.abspath('.')) +sys.path.insert(0, os.path.abspath('..')) # to include the root of the package + +# -- General configuration ------------------------------------------------ +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.autodoc', # support for automatic inclusion of docstring + 'sphinx.ext.autosummary', # generates autodoc summaries + 'sphinx.ext.doctest', # inclusion and testing of doctest code snippets + 'sphinx.ext.intersphinx', # support for linking to other projects + 'sphinx.ext.mathjax', # support for math equations + 'sphinx.ext.ifconfig', # support for conditional content + 'sphinx.ext.viewcode', # support for links to source code + 'sphinx.ext.coverage', # includes doc coverage stats in the documentation + 'sphinx.ext.todo', # support for todo items + 'sphinx.ext.napoleon', # support for numpy and google style docstrings + "sphinx_favicon", # support for favicon + "sphinx_copybutton", # support for copybutton in code blocks + "nbsphinx", # for integrating jupyter notebooks + "myst_parser" # for parsing .md files +] +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] +autosummary_generate = True +exclude_patterns = ['build', '_build', '_templates'] +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +source_suffix = { + '.rst': 'restructuredtext', + '.md': 'markdown', +} +# The master toctree document. +master_doc = 'index' +# General information about the project. +copyright = u'Cecill-C INRAE / INRIA / CIRAD' +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = "en" +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = False + +# -- Options for HTML output ---------------------------------------------- +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = 'pydata_sphinx_theme' +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +html_theme_options = { + "header_links_before_dropdown": 6, + "sidebarwidth": 200, + "sticky_navigation": "false", + "collapse_navigation": "false", + "display_version": "true", + "icon_links": [ + { + "name": "GitHub", + "url": urls['Repository'], + "icon": "fa-brands fa-github", + }, + ], + "show_version_warning_banner": True, + "footer_start": ["copyright"], + "footer_center": ["sphinx-version"], + "secondary_sidebar_items": { + "**/*": ["page-toc", "edit-this-page", "sourcelink"], + "examples/no-sidebar": [], + }, + "use_edit_page_button": True, + } +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] +html_logo = "_static/openalea_web.svg" +html_favicon = "_static/openalea_web.svg" +# If false, no module index is generated. +html_domain_indices = True +# If false, no index is generated. +html_use_index = True +# If true, the index is split into individual pages for each letter. +html_split_index = False +# If true, links to the reST sources are added to the pages. +html_show_sourcelink = True +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +html_show_sphinx = True +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +html_show_copyright = True +# Output file base name for HTML help builder. +htmlhelp_basename = project + '_documentation' +# Add infomation about github repository +html_context = { + # "github_url": "https://github.com", # or your GitHub Enterprise site + "github_user": "openalea", + "github_repo": "openalea-components", + "github_version": "main", + "doc_path": "doc", +} + +# -- Options for LaTeX output --------------------------------------------- +latex_elements = { +} +latex_documents = [ + (master_doc, 'numpy.tex', u'numpy Documentation', + u'INRA / INRIA / CIRAD', 'manual'), +] + +# -- Options for manual page output --------------------------------------- +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, project, project + ' Documentation', + [author], 1) +] + +# -- Options for Texinfo output ------------------------------------------- +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, project, project + ' Documentation', + author, project, desc, + 'Miscellaneous'), +] +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = {'python': ('https://docs.python.org/', None)} \ No newline at end of file diff --git a/numpy/pyproject.toml b/numpy/pyproject.toml new file mode 100644 index 00000000..ffc2f9be --- /dev/null +++ b/numpy/pyproject.toml @@ -0,0 +1,86 @@ +# FB 2025-04-14: based on ADEL and hydroshoot, sphinx pkg in environment.yml +[build-system] +requires = [ + "setuptools", + "setuptools_scm", + ] +build-backend = "setuptools.build_meta" + +# allow openalea to be a namespace package +[tool.setuptools.packages.find] +where = ["src"] + +# enable dynamic versioning based on git tags +[tool.setuptools_scm] +# can be empty if no extra settings are needed, presence enables setuptools-scm + +[project] +name = "openalea.numpy" +authors = [ + { name = "Christophe Pradal" }, +] +description = "Numpy modules for Visualea." +readme = "README.rst" +license = "CECILL-C" +license-files = ["LICEN[CS]E*"] +requires-python = ">=3.0" +classifiers = [ + "Intended Audience :: Science/Research", + "Intended Audience :: Developers", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering", +] +dynamic = ["version"] + +dependencies = [ + "numpy", +] + + +# section specific to conda-only distributed package (not used by pip yet) +[tool.conda.environment] +channels = [ + "openalea3", + "conda-forge" +] +dependencies = [ + "openalea.core", + "openalea.stdlib" +] + +[project.optional-dependencies] +test = ["pytest"] +notebook = ["jupyter"] +doc = [ + "sphinx-favicon", + "sphinx-rtd-theme", + "pydata-sphinx-theme", + "myst-parser", + "nbsphinx", + "sphinx-copybutton", +] + +[project.urls] +Homepage = "https://openalea.rtfd.io" +"Bug Tracker" = "https://github.com/openalea/openalea-components/issues" +Discussions = "https://github.com/openalea/openalea-components/discussions" +Changelog = "https://github.com/openalea/openalea-components/releases" + +[tool.setuptools.package-data] +"numpy" = ["*.csv"] + +[project.entry-points."wralea"] +"openalea.numpy" = "openalea.numpy_wralea" +"openalea.numpy.random" = "openalea.numpy_wralea.random" +"openalea.numpy.creation" = "openalea.numpy_wralea.creation" +"openalea.numpy.infos" = "openalea.numpy_wralea.infos" +"openalea.numpy.input_output" = "openalea.numpy_wralea.input_output" +"openalea.numpy.manipulation" = "openalea.numpy_wralea.manipulation" +"openalea.numpy.math" = "openalea.numpy_wralea.math" +"openalea.numpy.sorting_searching" = "openalea.numpy_wralea.sorting_searching" +"openalea.numpy.window" = "openalea.numpy_wralea.window" +"openalea.numpy.demo" = "openalea.numpy_demo_wralea" +"openalea.numpy.test" = "openalea.numpy_test_wralea" diff --git a/pylab/src/openalea/oapylab/__init__.py b/pylab/src/openalea/oapylab/__init__.py index 823a2f02..98295206 100644 --- a/pylab/src/openalea/oapylab/__init__.py +++ b/pylab/src/openalea/oapylab/__init__.py @@ -1,7 +1,7 @@ -from openalea.deploy import get_metainfo +#from openalea.deploy import get_metainfo -version = get_metainfo('openalea.pylab', 'version') -authors = get_metainfo('openalea.pylab', 'author') +#version = get_metainfo('openalea.pylab', 'version') +#authors = get_metainfo('openalea.pylab', 'author') from . import tools diff --git a/pylab/src/openalea/oapylab/tools.py b/pylab/src/openalea/oapylab/tools.py index ba2c93bb..8fb0c38c 100644 --- a/pylab/src/openalea/oapylab/tools.py +++ b/pylab/src/openalea/oapylab/tools.py @@ -552,7 +552,8 @@ def get_axes(self): axes = [axes] for axe in axes: import matplotlib - assert axe.__module__ in [matplotlib.axes._axes.__name__,matplotlib.axes._subplots.__name__,matplotlib.projections.polar.__name__], 'input must be a valid axes from matplotlib.axes %s given for %s' % (type(axes), axes) + print('DEBUG : ', axe.__module__) + assert axe.__module__ in [matplotlib.axes._axes.__name__,matplotlib.projections.polar.__name__], 'input must be a valid axes from matplotlib.axes %s given for %s' % (type(axes), axes) return axes diff --git a/pylab/src/openalea/pylab_decorators_wralea/py_pylab.py b/pylab/src/openalea/pylab_decorators_wralea/py_pylab.py index 6a3f1376..8fbc8686 100644 --- a/pylab/src/openalea/pylab_decorators_wralea/py_pylab.py +++ b/pylab/src/openalea/pylab_decorators_wralea/py_pylab.py @@ -957,7 +957,7 @@ def __init__(self): CustomizeAxes.__init__(self) self.add_input(name='axes') - self.add_input(name='b', interface=IBool, value=True) + #self.add_input(name='b', interface=IBool, value=True) self.add_input(name='which', interface=IEnumStr(list(tools.which.keys())), value='major') self.add_input(name='linestyle', interface=IEnumStr(list(tools.linestyles.keys())), value='dotted') self.add_input(name='color', interface=IEnumStr(list(tools.colors.keys())), value='black') @@ -973,7 +973,7 @@ def __call__(self, inputs): kwds['linestyle']=tools.linestyles[self.get_input("linestyle")] kwds['color']=tools.colors[self.get_input("color")] kwds['linewidth']=self.get_input("linewidth") - kwds['b']=self.get_input("b") + #kwds['b']=self.get_input("b") kwds['which']=self.get_input("which") axes = self.get_axes() diff --git a/pylab/src/openalea/pylab_plotting_wralea/py_pylab.py b/pylab/src/openalea/pylab_plotting_wralea/py_pylab.py index 7d447dd4..1c680df8 100644 --- a/pylab/src/openalea/pylab_plotting_wralea/py_pylab.py +++ b/pylab/src/openalea/pylab_plotting_wralea/py_pylab.py @@ -276,7 +276,10 @@ def call(self, plottype, kwds): print('warning more x inputs than y inputs. correct the connectors') for x,y in zip(xinputs, yinputs): try: - output = plot(x, y, **kwds) + linestyle=kwds.get('linestyle', '-') + if 'linestyle' in kwds: + del kwds['linestyle'] + output = plot(x, y, linestyle=linestyle, **kwds) except: #print kwds raise ValueError("plot failed") diff --git a/stdlib/conda/meta.yaml b/stdlib/conda/meta.yaml index fd7ded9a..87ca4fe0 100644 --- a/stdlib/conda/meta.yaml +++ b/stdlib/conda/meta.yaml @@ -1,44 +1,59 @@ -{% set data = load_setup_py_data() %} +{% set pyproject = load_file_data('../pyproject.toml', from_recipe_dir=True) %} +{% set name = pyproject.get('project').get('name') %} +{% set description = pyproject.get('project').get('description') %} +{% set version = environ.get('SETUPTOOLS_SCM_PRETEND_VERSION', "0.0.0.dev") %} +{% set license = pyproject.get('project').get('license') %} +{% set home = pyproject.get('project', {}).get('urls', {}).get('Homepage', '') %} +{% set build_deps = pyproject.get("build-system", {}).get("requires", []) %} +{% set deps = pyproject.get('project', {}).get('dependencies', []) %} +{% set conda_deps = pyproject.get('tool', {}).get('conda', {}).get('environment', {}).get('dependencies',[]) %} + package: - name: openalea.stdlib - version: {{ data.get('version') }} + name: {{ name }} + version: {{ version }} source: path: .. build: noarch: python + string: py{{ PY_VER }} preserve_egg_dir: True - number: 0 - script: {{PYTHON}} setup.py install + # pip install options mainly ensure that dependencies are handled by conda (and not pip) + # --no-deps ensure pip will not install deps not declared in meta.yaml (but declared in pyproject.toml) + # --no-build-isolation ensure pip will not replace build deps declared in meta.yaml (and declared in pyproject.toml) + # --ignore-installed ensure that compiled files (accidentally present in sources or uncleaned locally) will be overwritten + script: {{ PYTHON }} -m pip install . --no-deps --ignore-installed --no-build-isolation -vv requirements: - build: - - python {{PY_VER}} - - setuptools - - openalea.deploy + host: + - python + {% for dep in build_deps %} + - {{ dep }} + {% endfor %} + run: - - python <3.11 - - ipykernel - - configobj - - openalea.core + - python + {% for dep in deps + conda_deps %} + - {{ dep }} + {% endfor %} test: - imports: - - openalea.core requires: - pytest + - nbmake + - setuptools + imports: + - openalea.core + - {{ name }} source_files: - - test/ - - test/*.py - + - test/test_*.py commands: - - cd test - - pytest -v test_*.py + - pytest -v + - pytest --nbmake about: - home: {{ data.get('url') }} - license: Cecill-c License - summary: {{ data.get('description') }} - + home: {{ home }} + license: {{ license }} + summary: {{ description }} diff --git a/stdlib/doc/conf.py b/stdlib/doc/conf.py index a240dd64..8773aadb 100644 --- a/stdlib/doc/conf.py +++ b/stdlib/doc/conf.py @@ -1,16 +1,153 @@ -import os,sys +# -*- coding: utf-8 -*- +import sys +import os -# read sphinx conf.py file -from openalea.misc.sphinx_configuration import * -from openalea.misc.sphinx_tools import sphinx_check_version -from openalea.deploy.metainfo import read_metainfo +import pydata_sphinx_theme # Pydata theme: https://pydata-sphinx-theme.readthedocs.io/en/stable/index.html -sphinx_check_version() # check that sphinx version is recent -metadata = read_metainfo('../metainfo.ini') # read metainfo from common file with setup.py -for key in ['version','project','release','authors', 'name', 'package']: - exec("%s = '%s'" % (key, metadata[key])) +from importlib.metadata import metadata +project='stdlib' +meta = metadata('openalea.' + project) +release = meta.get("version") +# for example take major/minor +version = ".".join(release.split('.')[:3]) +author = meta['Author'].split(' <')[0] +desc = meta['Summary'] +urls = {k:v for k,v in [item.split(',') for item in meta.get_all('Project-URL')]} -# by product that need to be updated: -latex_documents = [('contents', 'main.tex', project + ' documentation', authors, 'manual')] -project = project + '.' + package +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# sys.path.insert(0, os.path.abspath('.')) +sys.path.insert(0, os.path.abspath('..')) # to include the root of the package + +# -- General configuration ------------------------------------------------ +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.autodoc', # support for automatic inclusion of docstring + 'sphinx.ext.autosummary', # generates autodoc summaries + 'sphinx.ext.doctest', # inclusion and testing of doctest code snippets + 'sphinx.ext.intersphinx', # support for linking to other projects + 'sphinx.ext.mathjax', # support for math equations + 'sphinx.ext.ifconfig', # support for conditional content + 'sphinx.ext.viewcode', # support for links to source code + 'sphinx.ext.coverage', # includes doc coverage stats in the documentation + 'sphinx.ext.todo', # support for todo items + 'sphinx.ext.napoleon', # support for numpy and google style docstrings + "sphinx_favicon", # support for favicon + "sphinx_copybutton", # support for copybutton in code blocks + "nbsphinx", # for integrating jupyter notebooks + "myst_parser" # for parsing .md files +] +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] +autosummary_generate = True +exclude_patterns = ['build', '_build', '_templates'] +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +source_suffix = { + '.rst': 'restructuredtext', + '.md': 'markdown', +} +# The master toctree document. +master_doc = 'index' +# General information about the project. +copyright = u'Cecill-C INRAE / INRIA / CIRAD' +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = "en" +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = False + +# -- Options for HTML output ---------------------------------------------- +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = 'pydata_sphinx_theme' +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +html_theme_options = { + "header_links_before_dropdown": 6, + "sidebarwidth": 200, + "sticky_navigation": "false", + "collapse_navigation": "false", + "display_version": "true", + "icon_links": [ + { + "name": "GitHub", + "url": urls['Repository'], + "icon": "fa-brands fa-github", + }, + ], + "show_version_warning_banner": True, + "footer_start": ["copyright"], + "footer_center": ["sphinx-version"], + "secondary_sidebar_items": { + "**/*": ["page-toc", "edit-this-page", "sourcelink"], + "examples/no-sidebar": [], + }, + "use_edit_page_button": True, + } +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] +html_logo = "_static/openalea_web.svg" +html_favicon = "_static/openalea_web.svg" +# If false, no module index is generated. +html_domain_indices = True +# If false, no index is generated. +html_use_index = True +# If true, the index is split into individual pages for each letter. +html_split_index = False +# If true, links to the reST sources are added to the pages. +html_show_sourcelink = True +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +html_show_sphinx = True +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +html_show_copyright = True +# Output file base name for HTML help builder. +htmlhelp_basename = project + '_documentation' +# Add infomation about github repository +html_context = { + # "github_url": "https://github.com", # or your GitHub Enterprise site + "github_user": "openalea", + "github_repo": "openalea-components", + "github_version": "main", + "doc_path": "doc", +} + +# -- Options for LaTeX output --------------------------------------------- +latex_elements = { +} +latex_documents = [ + (master_doc, 'stdlib.tex', u'stdlib Documentation', + u'INRA / INRIA / CIRAD', 'manual'), +] + +# -- Options for manual page output --------------------------------------- +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, project, project + ' Documentation', + [author], 1) +] + +# -- Options for Texinfo output ------------------------------------------- +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, project, project + ' Documentation', + author, project, desc, + 'Miscellaneous'), +] +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = {'python': ('https://docs.python.org/', None)} \ No newline at end of file diff --git a/stdlib/pyproject.toml b/stdlib/pyproject.toml new file mode 100644 index 00000000..19774cc7 --- /dev/null +++ b/stdlib/pyproject.toml @@ -0,0 +1,109 @@ +# FB 2025-04-14: based on ADEL and hydroshoot, sphinx pkg in environment.yml +[build-system] +requires = [ + "setuptools", + "setuptools_scm", + ] +build-backend = "setuptools.build_meta" + +# allow openalea to be a namespace package +[tool.setuptools.packages.find] +where = ["src"] + +# enable dynamic versioning based on git tags +[tool.setuptools_scm] +# can be empty if no extra settings are needed, presence enables setuptools-scm + +[project] +name = "openalea.stdlib" +authors = [ + { name = "Christophe Pradal" }, +] +description = "OpenAlea standard logical component library." +readme = "README.rst" +license = "CECILL-C" +license-files = ["LICEN[CS]E*"] +requires-python = ">=3.0" +classifiers = [ + "Intended Audience :: Science/Research", + "Intended Audience :: Developers", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering", +] +dynamic = ["version"] + +dependencies = [ + "ipykernel", + "configobj", +] + + +# section specific to conda-only distributed package (not used by pip yet) +[tool.conda.environment] +channels = [ + "openalea3", + "conda-forge" +] +dependencies = [ + "openalea.core" +] + +[project.optional-dependencies] +test = ["pytest"] +notebook = ["jupyter"] +doc = [ + "sphinx-favicon", + "sphinx-rtd-theme", + "pydata-sphinx-theme", + "myst-parser", + "nbsphinx", + "sphinx-copybutton", +] + +[project.urls] +Homepage = "https://openalea.rtfd.io" +"Bug Tracker" = "https://github.com/openalea/openalea-components/issues" +Discussions = "https://github.com/openalea/openalea-components/discussions" +Changelog = "https://github.com/openalea/openalea-components/releases" + +[tool.setuptools.package-data] +"stdlib" = ["*.csv"] + +[project.entry-points."wralea"] +"openalea.color" = "openalea.color" +"openalea.csv" = "openalea.csv" +"openalea.string" = "openalea.string" +"openalea.data" = "openalea.data" +"openalea.datafile" = "openalea.datafile" +"openalea.file" = "openalea.file" +"openalea.functional" = "openalea.functional" +"openalea.math" = "openalea.math" +"openalea.model" = "openalea.model" +"openalea.pickling" = "openalea.pickling" +"openalea.plotools" = "openalea.plotools" +"openalea.python" = "openalea.python" +"openalea.spatial" = "openalea.spatial" +"openalea.stand" = "openalea.stand" +"openalea.stat" = "openalea.stat" +"openalea.system" = "openalea.system" +"openalea.tutorial" = "openalea.tutorial" +"openalea.tutorial.design pattern" = "openalea.tutorial.pattern" +"openalea.tutorial.functional" = "openalea.tutorial.functional" +"openalea.tutorial.multiprocess" = "openalea.tutorial.multiprocess" +"openalea.multiprocessing" = "openalea.multiprocessing" +"openalea.path" = "openalea.path" +# Deprecated +"catalog.color" = "deprecated" +"catalog.data" = "deprecated" +"catalog.csv" = "deprecated" +"catalog.file" = "deprecated" +"catalog.functional" = "deprecated" +"catalog.math" = "deprecated" +"catalog.model" = "deprecated" +"catalog.pickling" = "deprecated" +"catalog.python" = "deprecated" +"catalog.string" = "deprecated" diff --git a/stdlib/setup.py b/stdlib/setup.py index 4741c3f6..700acccc 100644 --- a/stdlib/setup.py +++ b/stdlib/setup.py @@ -44,7 +44,7 @@ package_data = {'' : ['*.csv'],}, # Dependencies - setup_requires = ['openalea.deploy'], + #setup_requires = ['openalea.deploy'], # entry_points entry_points = {