From a4a1fb1ca32054870ea86853dff94fa84a32f0ee Mon Sep 17 00:00:00 2001
From: Dominique Benielli <dominique.benielli@univ-amu.fr>
Date: Mon, 19 May 2025 12:32:35 +0200
Subject: [PATCH] version toml

---
 license.txt => LICENSE |   0
 MANIFEST.in            |   3 +-
 VERSION                |   2 +
 copyright.py           |   8 +-
 pyproject.toml         |  48 ++++++++++
 requirements.txt       |   5 +-
 setup.py               | 198 +++++++++++++++++++++++------------------
 summit/__init__.py     |   4 +-
 8 files changed, 170 insertions(+), 98 deletions(-)
 rename license.txt => LICENSE (100%)
 create mode 100644 VERSION
 create mode 100644 pyproject.toml

diff --git a/license.txt b/LICENSE
similarity index 100%
rename from license.txt
rename to LICENSE
diff --git a/MANIFEST.in b/MANIFEST.in
index 793057f9..982ae275 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,2 +1,3 @@
 include *.md
-include multiview_platform/examples*
\ No newline at end of file
+include multiview_platform/examples*
+include LICENSE
\ No newline at end of file
diff --git a/VERSION b/VERSION
new file mode 100644
index 00000000..0b1325d0
--- /dev/null
+++ b/VERSION
@@ -0,0 +1,2 @@
+summit:0.0.1
+
diff --git a/copyright.py b/copyright.py
index f471123b..903bde70 100644
--- a/copyright.py
+++ b/copyright.py
@@ -50,7 +50,7 @@ def getStamp(date, multimodal_version):
     """ Return the corrected formated stamp """
     stamp = open("copyrightstamp.txt").read()
     stamp = stamp.replace("DATE", date)
-    stamp = stamp.replace("MULTIMODAL_VERSION", multimodal_version)
+    stamp = stamp.replace("SUMMIT_VERSION", summit_version)
     stamp = stamp.replace('\n', '\n# ')
     stamp = "# " + stamp
     stamp = stamp.replace("# \n", "#\n")
@@ -64,14 +64,14 @@ def getVersionsAndDate():
     v_text_formted = '{"' + v_text.replace('\n', '","').replace(':', '":"')
     v_text_formted += '"}'
     v_dict = eval(v_text_formted)
-    return (time.strftime("%Y"), v_dict['multimodal'])
+    return (time.strftime("%Y"), v_dict['summit'])
 
 
 def writeStamp():
     """ Write a copyright stamp on all files """
     stamp = getStamp(*getVersionsAndDate())
     files = findFiles(os.path.join(os.path.dirname(os.path.abspath(__file__)),
-                                   "multimodal"))
+                                   "summit"))
     for filename in files:
         fileStamping(filename, stamp)
     fileStamping("setup.py", stamp)
@@ -80,7 +80,7 @@ def writeStamp():
 def eraseStamp():
     """ Erase a copyright stamp from all files """
     files = findFiles(os.path.join(os.path.dirname(os.path.abspath(__file__)),
-                                   "multimodal"))
+                                   "summit"))
     for filename in files:
         fileUnStamping(filename)
     fileUnStamping("setup.py")
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 00000000..2e58eb8c
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,48 @@
+[build-system]
+requires = ["setuptools>=42", "wheel", "numpy"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = 'summit-multi-learn'
+dynamic = ["version", 'dependencies', "license"]
+requires-python = '>=3.6'
+readme = {file = "README.rst", content-type = "text/x-rst"}
+description = "Supervised MultiModal Integration Tool"
+authors = [
+    {name = "Baptiste Bauvin", email = "baptiste.bauvin.work@gmail.com"}
+]
+keywords = ['machine learning, supervised learning, classification, tool, multiview learning, monoview learning']
+classifiers=[
+    'Development Status :: 5 - Production/Stable',
+    'Intended Audience :: Science/Research',
+    'Programming Language :: Python :: 3',
+    'Programming Language :: Python :: 3.6',
+    'Programming Language :: Python :: 3.7',
+    'Programming Language :: Python :: 3.8',
+    'Programming Language :: Python :: 3.9',
+    'Programming Language :: Python :: 3.10',
+    'Programming Language :: Python :: 3.11',
+    'Topic :: Scientific/Engineering',
+    'Topic :: Scientific/Engineering :: Artificial Intelligence',
+    'Topic :: Machine Learning',
+    'Operating System :: Microsoft :: Windows',
+    'Operating System :: POSIX :: Linux',
+    'Operating System :: MacOS :: MacOS X',
+]
+
+
+[project.optional-dependencies]
+test = ['pytest', 'pytest-cov']
+doc = ['sphinx==5.0', 'numpydoc', 'sphinx_gallery', "sphinx_rtd_theme"]
+
+[project.urls]
+Homepage = 'https://github.com/multi-learn/summit'
+Documentation  = 'https://multi-learn.github.io/summit/'
+Issues = '"https://github.com/multi-learn/summit/issues'
+
+[tool.setuptools.dynamic]
+dependencies = {file = ["requirements.txt"]}
+
+[tool.setuptools.packages.find]
+where = ["."]
+
diff --git a/requirements.txt b/requirements.txt
index a9e891d8..26ba119e 100755
--- a/requirements.txt
+++ b/requirements.txt
@@ -12,4 +12,7 @@ plotly>=4.2.1
 matplotlib>=3.1.1
 tabulate>=0.8.6
 pyscm-ml>=1.0.0
-imbalanced-learn>=0.10.1
\ No newline at end of file
+imbalanced-learn>=0.10.1
+scikit-multimodallearn==0.0.3
+# Dépendances depuis des dépôts Git
+randomscm @ git+https://github.com/thibgo/randomscm.git@v0.0.0-alpha
diff --git a/setup.py b/setup.py
index c92d5a75..329c01fc 100644
--- a/setup.py
+++ b/setup.py
@@ -2,103 +2,123 @@
 #Extracting requrements from requirements.txt
 with open('requirements.txt') as f:
     requirements = f.read().splitlines()
-
-# from Cython.Build import cythonize
+import os, re
+import shutil
+from distutils.command.clean import clean as _clean
+from distutils.dir_util import remove_tree
+from distutils.command.sdist import sdist
 from setuptools import setup, find_packages
 
+USE_COPYRIGHT = True
+try:
+    from copyright import writeStamp, eraseStamp
+except ImportError:
+    USE_COPYRIGHT = False
+
+# --------------------------------------------------------------------
+# Clean target redefinition - force clean everything supprimer de la liste '^core\.*$',
+relist = ['^.*~$', '^#.*#$', '^.*\.aux$', '^.*\.pyc$', '^.*\.o$']
+reclean = []
+
+###################
+# Get Summit version
+####################
+def get_version():
+    v_text = open('VERSION').read().strip()
+    v_text_formted = '{"' + v_text.replace('\n', '","').replace(':', '":"')
+    v_text_formted += '"}'
+    v_dict = eval(v_text_formted)
+    return v_dict["summit"]
+
+########################
+# Set Summit __version__
+########################
+def set_version(summit_dir, version):
+    filename = os.path.join(summit_dir, '__init__.py')
+    buf = ""
+    for line in open(filename, "rb"):
+        if not line.decode("utf8").startswith("__version__ ="):
+            buf += line.decode("utf8")
+    f = open(filename, "wb")
+    f.write(buf.encode("utf8"))
+    f.write(('__version__ = "%s"\n' % version).encode("utf8"))
+
+for restring in relist:
+    reclean.append(re.compile(restring))
+
+
+def wselect(args, dirname, names):
+    for n in names:
+        for rev in reclean:
+            if (rev.match(n)):
+                os.remove("%s/%s" %(dirname, n))
+        break
+
+class clean(_clean):
+    def walkAndClean(self):
+        os.walk("..", wselect, [])
+        pass
+
+    def run(self):
+        clean.run(self)
+        if os.path.exists('build'):
+            shutil.rmtree('build')
+        for dirpath, dirnames, filenames in os.walk('multimodal'):
+            for filename in filenames:
+                if (filename.endswith('.so') or
+                        filename.endswith('.pyd') or
+                        filename.endswith('.dll') or
+                        filename.endswith('.pyc')):
+                    os.unlink(os.path.join(dirpath, filename))
+            for dirname in dirnames:
+                if dirname == '__pycache__':
+                    shutil.rmtree(os.path.join(dirpath, dirname))
+
+##############################
+# Custom sdist command
+##############################
+class m_sdist(sdist):
+    """ Build source package
+
+    WARNING : The stamping must be done on an default utf8 machine !
+    """
+    def run(self):
+        if USE_COPYRIGHT:
+            writeStamp()
+            sdist.run(self)
+            # eraseStamp()
+        else:
+            sdist.run(self)
 
 # Ceci n'est qu'un appel de fonction. Mais il est trèèèèèèèèèèès long
 # et il comporte beaucoup de paramètres
 def setup_package():
-    setup(
-
-    # le nom de votre bibliothèque, tel qu'il apparaitre sur pypi
-    name='summit',
-
-    # la version du code
-    version=0.0,
-    python_requires = '>=3.5',
-    # Liste les packages à insérer dans la distribution
-    # plutôt que de le faire à la main, on utilise la foncton
-    # find_packages() de setuptools qui va cherche tous les packages
-    # python recursivement dans le dossier courant.
-    # C'est pour cette raison que l'on a tout mis dans un seul dossier:
-    # on peut ainsi utiliser cette fonction facilement
-    packages=find_packages(),
-
-    # votre pti nom
-    author="Baptiste Bauvin",
-
-    # Votre email, sachant qu'il sera publique visible, avec tous les risques
-    # que ça implique.
-    author_email="baptiste.bauvin@lis-lab.fr",
-
-    # Une description courte
-    description="Supervised MultiModal Integration Tool",
-
-    # Une description longue, sera affichée pour présenter la lib
-    # Généralement on dump le README ici
-    long_description=open('README.rst').read(),
-
-    # Vous pouvez rajouter une liste de dépendances pour votre lib
-    # et même préciser une version. A l'installation, Python essayera de
-    # les télécharger et les installer.
-    #
-    # Ex: ["gunicorn", "docutils >= 0.3", "lxml==0.5a7"]
-    #
-    # Dans notre cas on en a pas besoin, donc je le commente, mais je le
-    # laisse pour que vous sachiez que ça existe car c'est très utile.
-    # install_requires= ,
-
+    group = 'multi-learn'
+    name = group +'-summit'
+    version = get_version()
+    summit_dir = 'summit'
+    set_version(summit_dir, version)
+    here = os.path.abspath(os.path.dirname(__file__))
+    # Or 'README.rst', depending on your format
+    long_description_content_type = 'text/x-rst'
+    with open(os.path.join(here, 'README.rst'), encoding='utf-8') as readme:
+        long_description = readme.read()
+
+    #url = 'https://github.com/{}/{}'.format(group, name)
+    #project_urls = {
+    #    'Documentation': 'https://{}.github.io/{}/'.format(group, name),
+    #   'Source': url,
+    #    'Tracker': '{}/issues'.format(url)}
+    packages = find_packages(exclude=['*.test'])
+
+    setup(version=version,
+    packages=packages,
+    long_description=long_description,
     # Active la prise en compte du fichier MANIFEST.in
     include_package_data=True,
-    # dependency_links=['https://github.com/aldro61/pyscm.git#egg=pyscm'],
-    # Une url qui pointe vers la page officielle de votre lib
-    url='http://gitlab.lis-lab.fr/baptiste.bauvin/summit/',
-    install_requires=requirements,
-    extras_require={
-            'dev': ['pytest', 'pytest-cov'],
-            'doc': ['sphinx >= 3.0.2', 'numpydoc', 'docutils', 'sphinx-autoapi',
-                    'sphinx_rtd_theme']},
-
-    # Il est d'usage de mettre quelques metadata à propos de sa lib
-    # Pour que les robots puissent facilement la classer.
-    # La liste des marqueurs autorisées est longue:
-    # https://pypi.python.org/pypi?%3Aaction=list_classifiers.
-    #
-    # Il n'y a pas vraiment de règle pour le contenu. Chacun fait un peu
-    # comme il le sent. Il y en a qui ne mettent rien.
-    classifiers=[
-        "Programming Language :: Python",
-        "Development Status :: 1 - Planning",
-        "License :: OSI Approved",
-        "Natural Language :: French",
-        "Operating System :: OS Independent",
-        "Programming Language :: Python :: 2/3",
-        "Topic :: Machine Learning",
-    ],
-
-    # C'est un système de plugin, mais on s'en sert presque exclusivement
-    # Pour créer des commandes, comme "django-admin".
-    # Par exemple, si on veut créer la fabuleuse commande "proclame-sm", on
-    # va faire pointer ce nom vers la fonction proclamer(). La commande sera
-    # créé automatiquement.
-    # La syntaxe est "nom-de-commande-a-creer = package.module:fonction".
-    # entry_points={
-    #     'console_scripts': [
-    #         'exec_multiview = summit.execute:exec',
-    #     ],
-    # },
-
-    # A fournir uniquement si votre licence n'est pas listée dans "classifiers"
-    # ce qui est notre cas
-    license="GNUGPL",
-
-    # Il y a encore une chiée de paramètres possibles, mais avec ça vous
-    # couvrez 90% des besoins
-    # ext_modules=cythonize(
-    #     "summit/multiview_platform/monoview/additions/_custom_criterion.pyx"),
-)
+    license="BSD-3-Clause",
+    license_files="LICENSE"
+    )
 
 if __name__ == "__main__":
     setup_package()
diff --git a/summit/__init__.py b/summit/__init__.py
index b11a66d7..d3372ebd 100644
--- a/summit/__init__.py
+++ b/summit/__init__.py
@@ -1,5 +1,3 @@
 
-
-__version__ = "0.0.0.0"
-
 from . import multiview_platform, execute
+__version__ = "0.0.1"
-- 
GitLab