diff --git a/README.md b/README.md index 01b7bc7..e2d759e 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ The **rsml** python package provides: The **rsml** package is an openalea package that can be installed using conda or mamba: - mamba create -n rsml -c conda-forge -c openalea3 rsml + mamba create -n rsml -c conda-forge -c openalea3 openalea.rsml mamba activate rsml @@ -40,7 +40,7 @@ To install it, go to the rsml folder and enter the following command:: ### Use ```python - import rsml + import openalea.rsml as rsml # load rsml g = rsml.rsml2mtg( filename ) @@ -53,7 +53,7 @@ To install it, go to the rsml folder and enter the following command:: rsml.mtg2rsml(g, filename) # export mesurements to tabular file - from rsml import measurements + from openalea.rsml import measurements measurements.export(g, filename[:-5]+'.csv') ``` diff --git a/conda/environment.yml b/conda/environment.yml index bbc15c8..78cec83 100644 --- a/conda/environment.yml +++ b/conda/environment.yml @@ -1,13 +1,11 @@ name: rsml_dev channels: - - conda-forge + - openalea3/label/dev + - openalea3/label/rc - openalea3 + - conda-forge dependencies: - matplotlib-base - - pandas - - xlsxwriter - - path - - numpy - openalea.mtg # let pip install the rest using pyproject.toml (if you are okay with conda/pip mix) - pip: diff --git a/conda/meta.yaml b/conda/meta.yaml index 545ad8b..4ea89d3 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -20,7 +20,6 @@ build: noarch: python number: 0 preserve_egg_dir: True - string: py{{ PY_VER }} script: - {{ PYTHON }} -m pip install . --no-deps --ignore-installed --no-build-isolation -vv @@ -45,7 +44,7 @@ test: {% endfor %} imports: - - rsml + - openalea.rsml source_files: - test/** diff --git a/doc/conf.py b/doc/conf.py index 89327e7..f8aee02 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -4,15 +4,22 @@ import pydata_sphinx_theme # Pydata theme: https://pydata-sphinx-theme.readthedocs.io/en/stable/index.html +from importlib.metadata import metadata +project='rsml' +meta = metadata('openalea.' + project) +release = meta.get("version") +# for example take major/minor +version = ".".join(release.split('.')[:3]) +# author = meta['Author-email'].split(' <')[0] +desc = meta['Summary'] +urls = {k:v for k,v in [item.split(',') for item in meta.get_all('Project-URL')]} +author = u'Christophe Pradal' -# Get the project root dir, which is the parent dir of this -cwd = os.getcwd() -project_root = os.path.dirname(cwd) - -# Insert the project root dir as the first element in the PYTHONPATH. -# This lets us ensure that the source package is imported, and that its -# version is used. -sys.path.insert(0, os.path.join(project_root, 'src')) +# 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 @@ -30,13 +37,14 @@ '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', '_templates'] +exclude_patterns = ['build', '_build', '_templates'] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: source_suffix = { @@ -46,22 +54,7 @@ # The master toctree document. master_doc = 'index' # General information about the project. -project = u'rsml' copyright = u'Cecill-C INRAE / INRIA / CIRAD' -author = u'Christophe Pradal' - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -pkgver={} -with open("../src/rsml/version.py") as fp: - exec(fp.read(), pkgver) -# The short X.Y version. -version = str(pkgver["MAJOR"])+'.'+str(pkgver["MINOR"]) -# The full version, including alpha/beta/rc tags. -release = pkgver["__version__"] - # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # @@ -81,15 +74,17 @@ # further. For a list of options available for each theme, see the # documentation. html_theme_options = { + "show_nav_level": 4, "header_links_before_dropdown": 6, "sidebarwidth": 200, + "show_nav_level": 2, "sticky_navigation": "false", "collapse_navigation": "false", "display_version": "true", "icon_links": [ { "name": "GitHub", - "url": "https://github.com/openalea/openalea.rtfd.io", + "url": "https://github.com/openalea/rsml", "icon": "fa-brands fa-github", }, ], @@ -100,6 +95,7 @@ "**/*": ["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, @@ -120,21 +116,30 @@ # 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 = 'rsml_documentation' +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": "rsml", + "github_version": "main", + "doc_path": "doc", +} # -- Options for LaTeX output --------------------------------------------- latex_elements = { } latex_documents = [ (master_doc, 'rsml.tex', u'rsml Documentation', - u'INRAE / inria / CIRAD', 'manual'), + 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, 'rsml', u'rsml Documentation', + (master_doc, project, project + ' Documentation', [author], 1) ] @@ -143,9 +148,9 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'rsml', u'rsml Documentation', - author, 'rsml', 'RootSystemML (RSML) is a file format to represent root architectural data.', + (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)} +intersphinx_mapping = {'python': ('https://docs.python.org/', None)} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 8d78e38..292fa33 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ version_scheme = "guess-next-dev" local_scheme = "no-local-version" [project] -name = "rsml" +name = "openalea.rsml" dynamic = ["version"] description = "RootSystemML (RSML) is a file format to represent root architectural data. This package is an openalea pckage to manage it, import/export between .rsml files and MTG, etc." readme = "README.md" @@ -47,7 +47,7 @@ Homepage = "http://github.com/openalea/rsml" Discussions = "https://github.com/openalea/rsml/discussions" [project.entry-points."wralea"] -mtg = "rsml_wralea" +"rsml" = "openalea.rsml_wralea" [project.optional-dependencies] test = [ @@ -58,7 +58,7 @@ doc = [ "sphinx-rtd-theme", "pydata-sphinx-theme", "myst-parser", - "sphinx-favicon", + "sphinx-copybutton", "nbsphinx", ] diff --git a/src/openalea/rsml/__init__.py b/src/openalea/rsml/__init__.py new file mode 100644 index 0000000..65848f9 --- /dev/null +++ b/src/openalea/rsml/__init__.py @@ -0,0 +1,2 @@ +from openalea.rsml.io import rsml2mtg, mtg2rsml +from openalea.rsml.plot import plot2d, plot3d diff --git a/src/rsml/continuous.py b/src/openalea/rsml/continuous.py similarity index 98% rename from src/rsml/continuous.py rename to src/openalea/rsml/continuous.py index ca9d054..122c1c9 100644 --- a/src/rsml/continuous.py +++ b/src/openalea/rsml/continuous.py @@ -34,7 +34,7 @@ def discrete_to_continuous(g, position='position'): - convert "discrete" functions (such as diameter) - convert continuous functions? """ - from rsml.metadata import add_property_definition + from openalea.rsml.metadata import add_property_definition # accessor of the segment position property if isinstance(position, str): diff --git a/src/rsml/data/AR570/2012_11_19_18h00_chl110_1_1.jpg b/src/openalea/rsml/data/AR570/2012_11_19_18h00_chl110_1_1.jpg similarity index 100% rename from src/rsml/data/AR570/2012_11_19_18h00_chl110_1_1.jpg rename to src/openalea/rsml/data/AR570/2012_11_19_18h00_chl110_1_1.jpg diff --git a/src/rsml/data/AR570/2012_11_19_18h00_chl110_1_1.rsml b/src/openalea/rsml/data/AR570/2012_11_19_18h00_chl110_1_1.rsml similarity index 100% rename from src/rsml/data/AR570/2012_11_19_18h00_chl110_1_1.rsml rename to src/openalea/rsml/data/AR570/2012_11_19_18h00_chl110_1_1.rsml diff --git a/src/rsml/data/AR570/2012_11_20_08h30_chl110_1_1.jpg b/src/openalea/rsml/data/AR570/2012_11_20_08h30_chl110_1_1.jpg similarity index 100% rename from src/rsml/data/AR570/2012_11_20_08h30_chl110_1_1.jpg rename to src/openalea/rsml/data/AR570/2012_11_20_08h30_chl110_1_1.jpg diff --git a/src/rsml/data/AR570/2012_11_20_08h30_chl110_1_1.rsml b/src/openalea/rsml/data/AR570/2012_11_20_08h30_chl110_1_1.rsml similarity index 100% rename from src/rsml/data/AR570/2012_11_20_08h30_chl110_1_1.rsml rename to src/openalea/rsml/data/AR570/2012_11_20_08h30_chl110_1_1.rsml diff --git a/src/rsml/data/AR570/2012_11_21_09h00_chl110_1_1.jpg b/src/openalea/rsml/data/AR570/2012_11_21_09h00_chl110_1_1.jpg similarity index 100% rename from src/rsml/data/AR570/2012_11_21_09h00_chl110_1_1.jpg rename to src/openalea/rsml/data/AR570/2012_11_21_09h00_chl110_1_1.jpg diff --git a/src/rsml/data/AR570/2012_11_21_09h00_chl110_1_1.rsml b/src/openalea/rsml/data/AR570/2012_11_21_09h00_chl110_1_1.rsml similarity index 100% rename from src/rsml/data/AR570/2012_11_21_09h00_chl110_1_1.rsml rename to src/openalea/rsml/data/AR570/2012_11_21_09h00_chl110_1_1.rsml diff --git a/src/rsml/data/AR570/2012_11_23_09h00_chl110_1_1.jpg b/src/openalea/rsml/data/AR570/2012_11_23_09h00_chl110_1_1.jpg similarity index 100% rename from src/rsml/data/AR570/2012_11_23_09h00_chl110_1_1.jpg rename to src/openalea/rsml/data/AR570/2012_11_23_09h00_chl110_1_1.jpg diff --git a/src/rsml/data/AR570/2012_11_23_09h00_chl110_1_1.rsml b/src/openalea/rsml/data/AR570/2012_11_23_09h00_chl110_1_1.rsml similarity index 100% rename from src/rsml/data/AR570/2012_11_23_09h00_chl110_1_1.rsml rename to src/openalea/rsml/data/AR570/2012_11_23_09h00_chl110_1_1.rsml diff --git a/src/rsml/data/AR570/2012_11_24_09h00_chl110_1_1.jpg b/src/openalea/rsml/data/AR570/2012_11_24_09h00_chl110_1_1.jpg similarity index 100% rename from src/rsml/data/AR570/2012_11_24_09h00_chl110_1_1.jpg rename to src/openalea/rsml/data/AR570/2012_11_24_09h00_chl110_1_1.jpg diff --git a/src/rsml/data/AR570/2012_11_24_09h00_chl110_1_1.rsml b/src/openalea/rsml/data/AR570/2012_11_24_09h00_chl110_1_1.rsml similarity index 100% rename from src/rsml/data/AR570/2012_11_24_09h00_chl110_1_1.rsml rename to src/openalea/rsml/data/AR570/2012_11_24_09h00_chl110_1_1.rsml diff --git a/src/rsml/data/AR570/2012_11_25_09h00_chl110_1_1.jpg b/src/openalea/rsml/data/AR570/2012_11_25_09h00_chl110_1_1.jpg similarity index 100% rename from src/rsml/data/AR570/2012_11_25_09h00_chl110_1_1.jpg rename to src/openalea/rsml/data/AR570/2012_11_25_09h00_chl110_1_1.jpg diff --git a/src/rsml/data/AR570/2012_11_25_09h00_chl110_1_1.rsml b/src/openalea/rsml/data/AR570/2012_11_25_09h00_chl110_1_1.rsml similarity index 100% rename from src/rsml/data/AR570/2012_11_25_09h00_chl110_1_1.rsml rename to src/openalea/rsml/data/AR570/2012_11_25_09h00_chl110_1_1.rsml diff --git a/src/rsml/data/__init__.py b/src/openalea/rsml/data/__init__.py similarity index 100% rename from src/rsml/data/__init__.py rename to src/openalea/rsml/data/__init__.py diff --git a/src/rsml/data/discrete.bmtg b/src/openalea/rsml/data/discrete.bmtg similarity index 100% rename from src/rsml/data/discrete.bmtg rename to src/openalea/rsml/data/discrete.bmtg diff --git a/src/rsml/data/lupin_aero.rsml b/src/openalea/rsml/data/lupin_aero.rsml similarity index 100% rename from src/rsml/data/lupin_aero.rsml rename to src/openalea/rsml/data/lupin_aero.rsml diff --git a/src/rsml/data/nacry.rsml b/src/openalea/rsml/data/nacry.rsml similarity index 100% rename from src/rsml/data/nacry.rsml rename to src/openalea/rsml/data/nacry.rsml diff --git a/src/rsml/data/root_ramifie.rsml b/src/openalea/rsml/data/root_ramifie.rsml similarity index 100% rename from src/rsml/data/root_ramifie.rsml rename to src/openalea/rsml/data/root_ramifie.rsml diff --git a/src/rsml/hirros.py b/src/openalea/rsml/hirros.py similarity index 99% rename from src/rsml/hirros.py rename to src/openalea/rsml/hirros.py index 3b5b04d..1fc3e46 100644 --- a/src/rsml/hirros.py +++ b/src/openalea/rsml/hirros.py @@ -10,7 +10,7 @@ import numpy as np import pandas as pd -import rsml +import openalea.rsml def walk(dir: str, recursive=True): diff --git a/src/rsml/io.py b/src/openalea/rsml/io.py similarity index 100% rename from src/rsml/io.py rename to src/openalea/rsml/io.py diff --git a/src/rsml/matching.py b/src/openalea/rsml/matching.py similarity index 98% rename from src/rsml/matching.py rename to src/openalea/rsml/matching.py index 2ae855d..9848045 100644 --- a/src/rsml/matching.py +++ b/src/openalea/rsml/matching.py @@ -4,7 +4,7 @@ import numpy as _np -from rsml.misc import plant_vertices +from openalea.rsml.misc import plant_vertices def match_plants(t1,t2, max_distance=None): """ @@ -114,7 +114,7 @@ def find_match(axes1, axes2): def _match_root_axes(t1, axes1, t2, axes2, max_distance=None): """ return "best" match between axes in `axes1` and in `axes2` """ - from rsml.misc import hausdorff_distance + from openalea.rsml.misc import hausdorff_distance # construct distance matrix geom1 = t1.property('geometry') diff --git a/src/rsml/measurements.py b/src/openalea/rsml/measurements.py similarity index 100% rename from src/rsml/measurements.py rename to src/openalea/rsml/measurements.py diff --git a/src/rsml/metadata.py b/src/openalea/rsml/metadata.py similarity index 98% rename from src/rsml/metadata.py rename to src/openalea/rsml/metadata.py index 6c570cc..6341c8f 100644 --- a/src/rsml/metadata.py +++ b/src/openalea/rsml/metadata.py @@ -2,7 +2,7 @@ Manage rsml metadata attributes The metadata element in rsml contains some mandatory content and optional ones. -In the IO operation from rsml file to&from mtg, these metadata are looked for +In the IO operation from openalea.rsml file to&from mtg, these metadata are looked for in the 'metadata' graph property of the mtg:: mtg.graph_properties()['metadata'] diff --git a/src/rsml/misc.py b/src/openalea/rsml/misc.py similarity index 100% rename from src/rsml/misc.py rename to src/openalea/rsml/misc.py diff --git a/src/rsml/plot.py b/src/openalea/rsml/plot.py similarity index 99% rename from src/rsml/plot.py rename to src/openalea/rsml/plot.py index 6e83df7..e0fdf0c 100644 --- a/src/rsml/plot.py +++ b/src/openalea/rsml/plot.py @@ -145,7 +145,7 @@ def multiple_plot(files, image=True): ''' from openalea.core.path import path from matplotlib import pyplot as plt - import rsml + import openalea.rsml import os def get_file(f): diff --git a/src/rsml/properties.py b/src/openalea/rsml/properties.py similarity index 100% rename from src/rsml/properties.py rename to src/openalea/rsml/properties.py diff --git a/src/rsml/todo.rst b/src/openalea/rsml/todo.rst similarity index 100% rename from src/rsml/todo.rst rename to src/openalea/rsml/todo.rst diff --git a/src/rsml/version.py b/src/openalea/rsml/version.py similarity index 100% rename from src/rsml/version.py rename to src/openalea/rsml/version.py diff --git a/src/rsml_wralea/__init__.py b/src/openalea/rsml_wralea/__init__.py similarity index 100% rename from src/rsml_wralea/__init__.py rename to src/openalea/rsml_wralea/__init__.py diff --git a/src/rsml_wralea/__wralea__.py b/src/openalea/rsml_wralea/__wralea__.py similarity index 100% rename from src/rsml_wralea/__wralea__.py rename to src/openalea/rsml_wralea/__wralea__.py diff --git a/src/rsml/__init__.py b/src/rsml/__init__.py deleted file mode 100644 index c839c75..0000000 --- a/src/rsml/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from rsml.io import rsml2mtg, mtg2rsml -from rsml.plot import plot2d, plot3d diff --git a/test/test.py b/test/test.py index 3394cb5..c95532a 100644 --- a/test/test.py +++ b/test/test.py @@ -2,8 +2,8 @@ N = 2 from time import sleep -from rsml.data import data_dir -import rsml +from openalea.rsml.data import data_dir +import openalea.rsml as rsml img_dir = data_dir data = data_dir diff --git a/test/test_discrete_mtg.py b/test/test_discrete_mtg.py index 1947952..cb9242a 100644 --- a/test/test_discrete_mtg.py +++ b/test/test_discrete_mtg.py @@ -4,8 +4,8 @@ import pickle def load_discrete(): - from rsml.data import data_dir - import rsml + from openalea.rsml.data import data_dir + import openalea.rsml as rsml filename = data_dir/'discrete.bmtg' with open(filename, 'rb') as f: # F. Bauget 2022-04-12: needs bytes g = pickle.load(f, encoding="latin1") # F. Bauget 2022-04-12: Python 2 bytestring data to Python 3 @@ -38,8 +38,8 @@ def simple_tree(): return g def test_discrete_to_continuous(): - from rsml.continuous import discrete_to_continuous - from rsml.continuous import continuous_to_discrete + from openalea.rsml.continuous import discrete_to_continuous + from openalea.rsml.continuous import continuous_to_discrete def test_tree(g0): gc = discrete_to_continuous(g0.copy()) diff --git a/test/test_hirros.py b/test/test_hirros.py index 12f2c4a..a3afbe8 100644 --- a/test/test_hirros.py +++ b/test/test_hirros.py @@ -1,8 +1,8 @@ """ Tests for the measurements module """ -import rsml -from rsml import hirros +import openalea.rsml as rsml +from openalea.rsml import hirros def get_mtg(): fn = 'data/61_graph_expertized.rsml' diff --git a/test/test_measurements.py b/test/test_measurements.py index aa4db95..fd2b77a 100644 --- a/test/test_measurements.py +++ b/test/test_measurements.py @@ -19,7 +19,7 @@ def simple_tree(): return g def test_length(): - from rsml.measurements import root_length + from openalea.rsml.measurements import root_length g = simple_tree() L = root_length(g) @@ -28,7 +28,7 @@ def test_length(): assert sorted(L.values())==[1,3], 'invalid axe length' def test_RSML_Measurement(): - from rsml.measurements import RSML_Measurements + from openalea.rsml.measurements import RSML_Measurements g = simple_tree() m = RSML_Measurements()