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/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 296f0a6d..e7aba90e 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 = {