From 41c621e1b1ec9fca70b8d4b8e238988b3a3d7edc Mon Sep 17 00:00:00 2001 From: swryan Date: Mon, 18 Mar 2024 12:31:31 -0400 Subject: [PATCH 1/3] replace setup.py with pyproject.toml using hatchling backend --- pyproject.toml | 173 ++++++++++++++++++++++++++++++ setup.py | 282 ------------------------------------------------- 2 files changed, 173 insertions(+), 282 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000..b72d46ccef --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,173 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "openmdao" +dynamic = ["version"] +description = "OpenMDAO framework infrastructure" +readme = "README.md" +license = "Apache-2.0" +requires-python = ">=3.8" +authors = [ + { name = "OpenMDAO Team", email = "openmdao@openmdao.org" }, +] +keywords = [ + "analysis", + "multi-disciplinary", + "multidisciplinary", + "optimization", +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: Apache Software License", + "Natural Language :: English", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: Implementation :: CPython", + "Topic :: Scientific/Engineering", +] +dependencies = [ + "networkx>=2.0", + "numpy", + "packaging", + "requests", + "scipy", +] + +[project.optional-dependencies] +all = [ + "openmdao[docs,doe,jax,notebooks,visualization,test]", +] +docs = [ + "ipyparallel", + "jupyter-book==0.14", + "matplotlib", + "numpydoc>=1.1", + "sphinx-sitemap", +] +doe = [ + "pyDOE3", +] +jax = [ + "jax>=0.4.0", + "jaxlib>=0.4.0", +] +notebooks = [ + "ipympl", + "notebook", +] +test = [ + "aiounittest", + "num2words", + "numpydoc>=1.1", + "parameterized", + "playwright>=1.20", + "pycodestyle>=2.4.0", + "pydocstyle==2.0.0", + "testflo>=1.3.6", + "websockets>8", +] +visualization = [ + "bokeh>=2.4.0", + "colorama", + "matplotlib", +] + +[project.scripts] +openmdao = "openmdao.utils.om:openmdao_cmd" +reset_notebook = "openmdao.devtools.docutils:reset_notebook_cmd" +run_om_test = "openmdao.devtools.run_test:run_test" +webview = "openmdao.utils.webview:webview_argv" +wingproj = "openmdao.devtools.wingproj:run_wing" + +[project.entry-points.openmdao_case_reader] +sqlitereader = "openmdao.recorders.sqlite_reader:SqliteCaseReader" + +[project.entry-points.openmdao_case_recorder] +sqliterecorder = "openmdao.recorders.sqlite_recorder:SqliteRecorder" + +[project.entry-points.openmdao_component] +addsubtractcomp = "openmdao.components.add_subtract_comp:AddSubtractComp" +balancecomp = "openmdao.components.balance_comp:BalanceComp" +crossproductcomp = "openmdao.components.cross_product_comp:CrossProductComp" +dotproductcomp = "openmdao.components.dot_product_comp:DotProductComp" +eqconstraintcomp = "openmdao.components.eq_constraint_comp:EQConstraintComp" +execcomp = "openmdao.components.exec_comp:ExecComp" +explicitfunccomp = "openmdao.components.explicit_func_comp:ExplicitFuncComp" +externalcodecomp = "openmdao.components.external_code_comp:ExternalCodeComp" +externalcodeimplicitcomp = "openmdao.components.external_code_comp:ExternalCodeImplicitComp" +implicitfunccomp = "openmdao.components.implicit_func_comp:ImplicitFuncComp" +indepvarcomp = "openmdao.core.indepvarcomp:IndepVarComp" +kscomp = "openmdao.components.ks_comp:KSComp" +linearsystemcomp = "openmdao.components.linear_system_comp:LinearSystemComp" +matrixvectorproductcomp = "openmdao.components.matrix_vector_product_comp:MatrixVectorProductComp" +metamodelsemistructuredcomp = "openmdao.components.meta_model_semi_structured_comp:MetaModelSemiStructuredComp" +metamodelstructuredcomp = "openmdao.components.meta_model_structured_comp:MetaModelStructuredComp" +metamodelunstructuredcomp = "openmdao.components.meta_model_unstructured_comp:MetaModelUnStructuredComp" +multifimetamodelunstructuredcomp = "openmdao.components.multifi_meta_model_unstructured_comp:MultiFiMetaModelUnStructuredComp" +muxcomp = "openmdao.components.mux_comp:MuxComp" +splinecomp = "openmdao.components.spline_comp:SplineComp" +submodelcomp = "openmdao.components.submodel_comp:SubmodelComp" +vectormagnitudecomp = "openmdao.components.vector_magnitude_comp:VectorMagnitudeComp" + +[project.entry-points.openmdao_driver] +differentialevolutiondriver = "openmdao.drivers.differential_evolution_driver:DifferentialEvolutionDriver" +doedriver = "openmdao.drivers.doe_driver:DOEDriver" +driver = "openmdao.core.driver:Driver" +pyoptsparsedriver = "openmdao.drivers.pyoptsparse_driver:pyOptSparseDriver" +scipydriver = "openmdao.drivers.scipy_optimizer:ScipyOptimizeDriver" +simplegadriver = "openmdao.drivers.genetic_algorithm_driver:SimpleGADriver" + +[project.entry-points.openmdao_group] +group = "openmdao.core.group:Group" +parallelgroup = "openmdao.core.parallel_group:ParallelGroup" + +[project.entry-points.openmdao_lin_solver] +directsolver = "openmdao.solvers.linear.direct:DirectSolver" +linearblockgs = "openmdao.solvers.linear.linear_block_gs:LinearBlockGS" +linearblockjac = "openmdao.solvers.linear.linear_block_jac:LinearBlockJac" +linearrunoncec = "openmdao.solvers.linear.linear_runonce:LinearRunOnce" +petsckrylov = "openmdao.solvers.linear.petsc_ksp:PETScKrylov" +scipykrylov = "openmdao.solvers.linear.scipy_iter_solver:ScipyKrylov" +userdefined = "openmdao.solvers.linear.user_defined:LinearUserDefined" + +[project.entry-points.openmdao_nl_solver] +armijogoldsteinls = "openmdao.solvers.linesearch.backtracking:ArmijoGoldsteinLS" +boundsenforcels = "openmdao.solvers.linesearch.backtracking:BoundsEnforceLS" +broydensolver = "openmdao.solvers.nonlinear.broyden:BroydenSolver" +newtonsolver = "openmdao.solvers.nonlinear.newton:NewtonSolver" +nonlinearblockgs = "openmdao.solvers.nonlinear.nonlinear_block_gs:NonlinearBlockGS" +nonlinearblockjac = "openmdao.solvers.nonlinear.nonlinear_block_jac:NonlinearBlockJac" +nonlinearrunonce = "openmdao.solvers.nonlinear.nonlinear_runonce:NonlinearRunOnce" + +[project.entry-points.openmdao_report] +checks = "openmdao.error_checking.check_config:_check_report_register" +connections = "openmdao.visualization.connection_viewer.viewconns:_connections_report_register" +inputs = "openmdao.visualization.inputs_report.inputs_report:_inputs_report_register" +n2 = "openmdao.visualization.n2_viewer.n2_viewer:_n2_report_register" +optimizer = "openmdao.visualization.opt_report.opt_report:_optimizer_report_register" +scaling = "openmdao.visualization.scaling_viewer.scaling_report:_scaling_report_register" +summary = "openmdao.devtools.debug:_summary_report_register" +total_coloring = "openmdao.utils.coloring:_total_coloring_report_register" + +[project.entry-points.openmdao_surrogate_model] +krigingsurrogate = "openmdao.surrogate_models.kriging:KrigingSurrogate" +multificokrigingsurrogate = "openmdao.surrogate_models.multifi_cokriging:MultiFiCoKrigingSurrogate" +nearestneighbor = "openmdao.surrogate_models.nearest_neighbor:NearestNeighbor" +responsesurface = "openmdao.surrogate_models.response_surface:ResponseSurface" + +[project.urls] +Homepage = "http://openmdao.org" + +[tool.hatch.version] +path = "openmdao/__init__.py" + +[tool.hatch.build.targets.sdist] +include = [ + "/openmdao", +] diff --git a/setup.py b/setup.py deleted file mode 100644 index 61445c71d5..0000000000 --- a/setup.py +++ /dev/null @@ -1,282 +0,0 @@ -from setuptools import setup - -from pathlib import Path -from io import open - -import re - -__version__ = re.findall( - r"""__version__ = ["']+([0-9\.\-dev]*)["']+""", - open('openmdao/__init__.py').read(), -)[0] - -with open(Path(__file__).parent / "README.md", encoding="utf-8") as f: - long_description = f.read() - - -optional_dependencies = { - 'docs': [ - 'matplotlib', - 'numpydoc>=1.1', - 'jupyter-book==0.14', - 'sphinx-sitemap', - 'ipyparallel' - ], - 'doe': [ - 'pyDOE3' - ], - 'jax': [ - 'jax>=0.4.0', - 'jaxlib>=0.4.0' - ], - 'notebooks': [ - 'notebook', - 'ipympl' - ], - 'visualization': [ - 'bokeh>=2.4.0', - 'matplotlib', - 'colorama' - ], - 'test': [ - 'parameterized', - 'numpydoc>=1.1', - 'pycodestyle>=2.4.0', - 'pydocstyle>=2.0.0', - 'testflo>=1.3.6', - 'websockets>8', - 'aiounittest', - 'playwright>=1.20', - 'num2words' - ] -} - -# Add an optional dependency that concatenates all others -optional_dependencies['all'] = sorted([ - dependency - for dependencies in optional_dependencies.values() - for dependency in dependencies -]) - -setup( - name='openmdao', - version=__version__, - description="OpenMDAO framework infrastructure", - long_description=long_description, - long_description_content_type='text/markdown', - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Science/Research', - 'License :: OSI Approved :: Apache Software License', - 'Natural Language :: English', - 'Operating System :: MacOS :: MacOS X', - 'Operating System :: POSIX :: Linux', - 'Operating System :: Microsoft :: Windows', - 'Topic :: Scientific/Engineering', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: Implementation :: CPython', - ], - keywords='optimization multidisciplinary multi-disciplinary analysis', - author='OpenMDAO Team', - author_email='openmdao@openmdao.org', - url='http://openmdao.org', - license='Apache License, Version 2.0', - packages=[ - 'openmdao', - 'openmdao.approximation_schemes', - 'openmdao.code_review', - 'openmdao.components', - 'openmdao.components.interp_util', - 'openmdao.core', - 'openmdao.devtools', - 'openmdao.devtools.iprofile_app', - 'openmdao.docs', - 'openmdao.docs.openmdao_book', - 'openmdao.drivers', - 'openmdao.error_checking', - 'openmdao.jacobians', - 'openmdao.jax', - 'openmdao.matrices', - 'openmdao.proc_allocators', - 'openmdao.recorders', - 'openmdao.solvers', - 'openmdao.solvers.linear', - 'openmdao.solvers.linesearch', - 'openmdao.solvers.nonlinear', - 'openmdao.surrogate_models', - 'openmdao.surrogate_models.nn_interpolators', - 'openmdao.test_suite', - 'openmdao.test_suite.components', - 'openmdao.test_suite.groups', - 'openmdao.test_suite.test_examples', - 'openmdao.test_suite.test_examples.beam_optimization', - 'openmdao.test_suite.test_examples.beam_optimization.components', - 'openmdao.test_suite.test_examples.cannonball', - 'openmdao.test_suite.test_examples.meta_model_examples', - 'openmdao.utils', - 'openmdao.vectors', - 'openmdao.visualization', - 'openmdao.visualization.case_viewer', - 'openmdao.visualization.connection_viewer', - 'openmdao.visualization.inputs_report', - 'openmdao.visualization.timing_viewer', - 'openmdao.visualization.scaling_viewer', - 'openmdao.visualization.n2_viewer', - 'openmdao.visualization.meta_model_viewer', - 'openmdao.visualization.opt_report', - 'openmdao.visualization.tables', - ], - package_data={ - 'openmdao.devtools': ['*.wpr', ], - 'openmdao.visualization': [ - 'common/libs/*.js', - 'common/libs/*.js.map', - 'common/style/*.css', - 'common/style/*.css.map' - ], - 'openmdao.visualization.n2_viewer': [ - 'assets/*png*', - 'libs/*.js', - 'src/*.js', - 'gen/*.js', - 'style/*', - 'tests/*.js', - 'tests/*.json', - 'tests/*.html', - 'tests/gui_test_models/*.py', - '*.html' - ], - 'openmdao.visualization.connection_viewer': [ - '*.html', - ], - 'openmdao.visualization.tables': [ - '*.template', - ], - 'openmdao.visualization.timing_viewer': [ - '*.html', - ], - 'openmdao.visualization.scaling_viewer': [ - '*.html', - ], - 'openmdao.visualization.opt_report': [ - '*.html', - ], - 'openmdao.visualization.meta_model_viewer': [ - 'tests/known_data_point_files/*.csv', - ], - 'openmdao.devtools.iprofile_app': [ - 'static/*.html', - 'templates/*.html' - ], - 'openmdao.docs': ['*.py', 'openmdao_book/test/*.py', 'openmdao_book/other/*.py', - 'openmdao_book/*.md', - 'openmdao_book/*/*.md', - 'openmdao_book/*.ipynb', - 'openmdao_book/*/*.ipynb', - 'openmdao_book/*/*/*.ipynb', - 'openmdao_book/*/*/*/*.ipynb'], - 'openmdao.recorders': ['tests/legacy_sql/*.sql'], - 'openmdao.utils': ['unit_library.ini', 'scaffolding_templates/*'], - 'openmdao.test_suite': [ - '*.py', - '*/*.py', - 'matrices/*.npz' - ], - 'openmdao': ['*/tests/*.py', '*/*/tests/*.py', '*/*/*/tests/*.py'] - }, - python_requires=">=3.8", - install_requires=[ - 'networkx>=2.0', - 'numpy', - 'scipy', - 'requests', - 'packaging' - ], - entry_points={ - 'console_scripts': [ - 'wingproj=openmdao.devtools.wingproj:run_wing', - 'webview=openmdao.utils.webview:webview_argv', - 'run_om_test=openmdao.devtools.run_test:run_test', - 'reset_notebook=openmdao.devtools.docutils:reset_notebook_cmd', - 'openmdao=openmdao.utils.om:openmdao_cmd', - ], - 'openmdao_case_reader': [ - 'sqlitereader=openmdao.recorders.sqlite_reader:SqliteCaseReader', - ], - 'openmdao_case_recorder': [ - 'sqliterecorder=openmdao.recorders.sqlite_recorder:SqliteRecorder', - ], - 'openmdao_component': [ - 'addsubtractcomp=openmdao.components.add_subtract_comp:AddSubtractComp', - 'balancecomp=openmdao.components.balance_comp:BalanceComp', - 'crossproductcomp=openmdao.components.cross_product_comp:CrossProductComp', - 'dotproductcomp=openmdao.components.dot_product_comp:DotProductComp', - 'eqconstraintcomp=openmdao.components.eq_constraint_comp:EQConstraintComp', - 'execcomp=openmdao.components.exec_comp:ExecComp', - 'explicitfunccomp=openmdao.components.explicit_func_comp:ExplicitFuncComp', - 'implicitfunccomp=openmdao.components.implicit_func_comp:ImplicitFuncComp', - 'externalcodecomp=openmdao.components.external_code_comp:ExternalCodeComp', - 'externalcodeimplicitcomp=openmdao.components.external_code_comp:ExternalCodeImplicitComp', - 'kscomp=openmdao.components.ks_comp:KSComp', - 'linearsystemcomp=openmdao.components.linear_system_comp:LinearSystemComp', - 'matrixvectorproductcomp=openmdao.components.matrix_vector_product_comp:MatrixVectorProductComp', - 'metamodelstructuredcomp=openmdao.components.meta_model_structured_comp:MetaModelStructuredComp', - 'metamodelsemistructuredcomp=openmdao.components.meta_model_semi_structured_comp:MetaModelSemiStructuredComp', - 'metamodelunstructuredcomp=openmdao.components.meta_model_unstructured_comp:MetaModelUnStructuredComp', - 'multifimetamodelunstructuredcomp=openmdao.components.multifi_meta_model_unstructured_comp:MultiFiMetaModelUnStructuredComp', - 'muxcomp=openmdao.components.mux_comp:MuxComp', - 'splinecomp=openmdao.components.spline_comp:SplineComp', - 'vectormagnitudecomp=openmdao.components.vector_magnitude_comp:VectorMagnitudeComp', - 'indepvarcomp=openmdao.core.indepvarcomp:IndepVarComp', - 'submodelcomp=openmdao.components.submodel_comp:SubmodelComp' - ], - 'openmdao_driver': [ - 'doedriver=openmdao.drivers.doe_driver:DOEDriver', - 'driver=openmdao.core.driver:Driver', - 'simplegadriver=openmdao.drivers.genetic_algorithm_driver:SimpleGADriver', - 'differentialevolutiondriver=openmdao.drivers.differential_evolution_driver:DifferentialEvolutionDriver', - 'pyoptsparsedriver=openmdao.drivers.pyoptsparse_driver:pyOptSparseDriver', - 'scipydriver=openmdao.drivers.scipy_optimizer:ScipyOptimizeDriver', - ], - 'openmdao_group': [ - 'group=openmdao.core.group:Group', - 'parallelgroup=openmdao.core.parallel_group:ParallelGroup', - ], - 'openmdao_lin_solver': [ - 'directsolver=openmdao.solvers.linear.direct:DirectSolver', - 'linearblockgs=openmdao.solvers.linear.linear_block_gs:LinearBlockGS', - 'linearblockjac=openmdao.solvers.linear.linear_block_jac:LinearBlockJac', - 'linearrunoncec=openmdao.solvers.linear.linear_runonce:LinearRunOnce', - 'petsckrylov=openmdao.solvers.linear.petsc_ksp:PETScKrylov', - 'scipykrylov=openmdao.solvers.linear.scipy_iter_solver:ScipyKrylov', - 'userdefined=openmdao.solvers.linear.user_defined:LinearUserDefined', - ], - 'openmdao_nl_solver': [ - 'broydensolver=openmdao.solvers.nonlinear.broyden:BroydenSolver', - 'newtonsolver=openmdao.solvers.nonlinear.newton:NewtonSolver', - 'nonlinearblockgs=openmdao.solvers.nonlinear.nonlinear_block_gs:NonlinearBlockGS', - 'nonlinearblockjac=openmdao.solvers.nonlinear.nonlinear_block_jac:NonlinearBlockJac', - 'nonlinearrunonce=openmdao.solvers.nonlinear.nonlinear_runonce:NonlinearRunOnce', - 'armijogoldsteinls=openmdao.solvers.linesearch.backtracking:ArmijoGoldsteinLS', - 'boundsenforcels=openmdao.solvers.linesearch.backtracking:BoundsEnforceLS', - ], - 'openmdao_report': [ - 'n2=openmdao.visualization.n2_viewer.n2_viewer:_n2_report_register', - 'scaling=openmdao.visualization.scaling_viewer.scaling_report:_scaling_report_register', - 'optimizer=openmdao.visualization.opt_report.opt_report:_optimizer_report_register', - 'connections=openmdao.visualization.connection_viewer.viewconns:_connections_report_register', - 'inputs=openmdao.visualization.inputs_report.inputs_report:_inputs_report_register', - 'total_coloring=openmdao.utils.coloring:_total_coloring_report_register', - 'summary=openmdao.devtools.debug:_summary_report_register', - 'checks=openmdao.error_checking.check_config:_check_report_register', - ], - 'openmdao_surrogate_model': [ - 'krigingsurrogate=openmdao.surrogate_models.kriging:KrigingSurrogate', - 'nearestneighbor=openmdao.surrogate_models.nearest_neighbor:NearestNeighbor', - 'responsesurface=openmdao.surrogate_models.response_surface:ResponseSurface', - 'multificokrigingsurrogate=openmdao.surrogate_models.multifi_cokriging:MultiFiCoKrigingSurrogate', - ] - }, - extras_require=optional_dependencies, -) From cce64c33bdbebfd3a2193f9b5e942457780389f7 Mon Sep 17 00:00:00 2001 From: swryan Date: Tue, 19 Mar 2024 15:29:36 -0400 Subject: [PATCH 2/3] add PEP517 wheel testing to GitHub workflow --- .github/workflows/openmdao_test_workflow.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/openmdao_test_workflow.yml b/.github/workflows/openmdao_test_workflow.yml index dbaa4c2619..1b925c18bb 100644 --- a/.github/workflows/openmdao_test_workflow.yml +++ b/.github/workflows/openmdao_test_workflow.yml @@ -36,6 +36,7 @@ jobs: OPTIONAL: '[all]' JAX: '0.4.14' BANDIT: true + PEP517: true TESTS: true # set DEBUG to create an interactive debugging session just before testflo is run. # Note that the workflow will run until you cancel the debugging session. @@ -151,7 +152,16 @@ jobs: echo "=============================================================" echo "Install OpenMDAO" echo "=============================================================" - python -m pip install .${{ matrix.OPTIONAL }} + if [[ "${{ matrix.PEP517 }}" == "true" ]]; then + pip wheel --no-deps --use-pep517 . + WHEEL=`find openmdao-*.whl` + echo "-----------------------------------------------------------" + echo "Installing from wheel: $WHEEL" + echo "-----------------------------------------------------------" + python -m pip install $WHEEL${{ matrix.OPTIONAL }} + else + python -m pip install .${{ matrix.OPTIONAL }} + fi - name: Install PETSc if: matrix.PETSc From fd8f236e6d7291a2ea6d95f3ff564861dca4a849 Mon Sep 17 00:00:00 2001 From: swryan Date: Fri, 22 Mar 2024 12:14:24 -0400 Subject: [PATCH 3/3] remove pin from jupyter-book --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b72d46ccef..05d701ea28 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,7 @@ all = [ ] docs = [ "ipyparallel", - "jupyter-book==0.14", + "jupyter-book", "matplotlib", "numpydoc>=1.1", "sphinx-sitemap",