Przeglądaj źródła

Convert to pyproject.toml

Lutz Roeder 1 rok temu
rodzic
commit
4fbb9d6f16
4 zmienionych plików z 70 dodań i 46 usunięć
  1. 1 1
      package.js
  2. 6 2
      package.py
  3. 63 0
      publish/pyproject.toml
  4. 0 43
      publish/setup.py

+ 1 - 1
package.js

@@ -299,7 +299,7 @@ const build = async (target) => {
             writeLine('build python');
             await exec('python package.py build version');
             await exec('python -m pip install --user build wheel --quiet');
-            await exec('python -m build --no-isolation --wheel --outdir dist/pypi dist/pypi');
+            await exec('python -m build --wheel --outdir dist/pypi dist/pypi');
             if (read('install')) {
                 await exec('python -m pip install --force-reinstall dist/pypi/*.whl');
             }

+ 6 - 2
package.py

@@ -33,7 +33,9 @@ def _build():
     shutil.rmtree(os.path.join(source_dir, '__pycache__'), ignore_errors=True)
     shutil.rmtree(dist_pypi_dir, ignore_errors=True)
     shutil.copytree(source_dir, os.path.join(dist_pypi_dir, 'netron'))
-    shutil.copyfile(os.path.join(publish_dir, 'setup.py'), os.path.join(dist_pypi_dir, 'setup.py'))
+    shutil.copyfile(
+        os.path.join(publish_dir, 'pyproject.toml'),
+        os.path.join(dist_pypi_dir, 'pyproject.toml'))
     os.remove(os.path.join(dist_pypi_dir, 'netron', 'electron.mjs'))
     os.remove(os.path.join(dist_pypi_dir, 'netron', 'app.js'))
 
@@ -48,7 +50,9 @@ def _install():
 def _version():
     ''' Update version '''
     package = json.loads(_read('./package.json'))
-    _update('./dist/pypi/setup.py', '(    version=")(.*)(",)', package['version'])
+    _update('./dist/pypi/pyproject.toml',
+        '(version\\s*=\\s*")(.*)(")',
+        package['version'])
     _update('./dist/pypi/netron/server.py',
         "(__version__ = ')(.*)(')",
         package['version'])

+ 63 - 0
publish/pyproject.toml

@@ -0,0 +1,63 @@
+
+[build-system]
+requires = ["setuptools>=42", "wheel"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "netron"
+version = "0.0.0"
+description = "Viewer for neural network, deep learning and machine learning models."
+authors = [
+    { name = "Lutz Roeder", email = "[email protected]" }
+]
+keywords = [
+    "onnx", "keras", "tensorflow", "tflite", "coreml", "mxnet", "caffe", "caffe2",
+    "torchscript", "pytorch", "ncnn", "mnn", "openvino", "darknet", "paddlepaddle", "chainer",
+    "artificial intelligence", "machine learning", "deep learning", "neural network",
+    "visualizer", "viewer"
+]
+classifiers = [
+    "Intended Audience :: Developers",
+    "Intended Audience :: Education",
+    "Intended Audience :: Science/Research",
+    "Programming Language :: Python :: 3",
+    "Programming Language :: Python :: 3.6",
+    "Topic :: Software Development",
+    "Topic :: Software Development :: Libraries",
+    "Topic :: Software Development :: Libraries :: Python Modules",
+    "Topic :: Scientific/Engineering",
+    "Topic :: Scientific/Engineering :: Mathematics",
+    "Topic :: Scientific/Engineering :: Artificial Intelligence",
+    "Topic :: Scientific/Engineering :: Visualization"
+]
+
+[project.urls]
+homepage = "https://github.com/lutzroeder/netron"
+
+[project.readme]
+text = """
+Netron is a viewer for neural network, deep learning and machine learning models.
+
+Netron supports ONNX, TensorFlow Lite, Core ML, Keras, Caffe, Darknet, MXNet, PaddlePaddle, ncnn, MNN, TensorFlow.js, Safetensors and NumPy.
+
+Netron has experimental support for PyTorch, TorchScript, TensorFlow, OpenVINO, RKNN, ML.NET, GGUF and scikit-learn.
+"""
+content-type = "text/markdown"
+
+[project.license]
+text = "MIT"
+
+[project.scripts]
+netron = "netron:main"
+
+[tool.setuptools]
+package-dir = { "netron" = "netron" }
+
+[tool.setuptools.packages.find]
+namespaces = false
+
+[tool.setuptools.package-data]
+netron = ["*.*"]
+
+[tool.setuptools.exclude-package-data]
+netron = ["app.js", "electron.*"]

+ 0 - 43
publish/setup.py

@@ -1,43 +0,0 @@
-''' Python Server setup script '''
-
-import setuptools
-
-setuptools.setup(
-    name="netron",
-    version="0.0.0",
-    description="Viewer for neural network, deep learning, and machine learning models",
-    long_description=
-        'Netron is a viewer for neural network, deep learning, and machine learning models.\n\n'
-        'Netron supports ONNX, TensorFlow Lite, Core ML, Keras, Caffe, Darknet, MXNet, PaddlePaddle, ncnn, MNN, TensorFlow.js, Safetensors and NumPy.' # pylint: disable=line-too-long
-        'Netron has experimental support for PyTorch, TorchScript, TensorFlow, OpenVINO, RKNN, ML.NET, GGUF and scikit-learn.', # pylint: disable=line-too-long
-    keywords=[
-        'onnx', 'keras', 'tensorflow', 'tflite', 'coreml', 'mxnet', 'caffe', 'caffe2',
-        'torchscript', 'pytorch', 'ncnn', 'mnn', 'openvino', 'darknet', 'paddlepaddle', 'chainer',
-        'artificial intelligence', 'machine learning', 'deep learning', 'neural network',
-        'visualizer', 'viewer'
-    ],
-    license="MIT",
-    package_dir={ 'netron': 'netron' },
-    packages=[ 'netron' ],
-    package_data={ 'netron': [ '*.*' ] },
-    exclude_package_data={ 'netron': [ 'app.js', 'electron.*' ] },
-    install_requires=[],
-    author='Lutz Roeder',
-    author_email='[email protected]',
-    url='https://github.com/lutzroeder/netron',
-    entry_points={ 'console_scripts': [ 'netron = netron:main' ] },
-    classifiers=[
-        'Intended Audience :: Developers',
-        'Intended Audience :: Education',
-        'Intended Audience :: Science/Research',
-        'Programming Language :: Python :: 3',
-        'Programming Language :: Python :: 3.6',
-        'Topic :: Software Development',
-        'Topic :: Software Development :: Libraries',
-        'Topic :: Software Development :: Libraries :: Python Modules',
-        'Topic :: Scientific/Engineering',
-        'Topic :: Scientific/Engineering :: Mathematics',
-        'Topic :: Scientific/Engineering :: Artificial Intelligence',
-        'Topic :: Scientific/Engineering :: Visualization'
-    ]
-)