Skip to content

Commit a97ee04

Browse files
authored
Refactor project structure to follow Python module conventions (#5)
* Refactor project structure to follow Python module conventions * Add pytest-cov in requirements.txt * Add coverage conf * Remove code duplication: extension relies on design space base classes from smt * Update license * Expose only required symbols to work with smt at module level * numpy has to be installed for CI tests * Avoid importing version from main module * Bump version 0.2.1 * Use smt master in CI tests * Take into account smt changes (ext dep removal) * Use smt master in requirements * Bump 0.2.2
1 parent a259e4c commit a97ee04

11 files changed

Lines changed: 91 additions & 763 deletions

File tree

.coveragerc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[paths]
2+
source =
3+
smt_design_space_ext
4+
5+
[html]
6+
directory = coverage_html_report
7+
8+
[run]
9+
relative_files = True
10+
omit =
11+
*/tests/*
12+
*/examples/*
13+
*/__init__.py
14+
*/setup.py

.github/workflows/build_release.yml

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,6 @@ on:
66
tags: ['v*']
77

88
jobs:
9-
build_wheels:
10-
name: Build wheels on ${{ matrix.os }}
11-
runs-on: ${{ matrix.os }}
12-
strategy:
13-
matrix:
14-
os: [ubuntu-latest, windows-latest, macos-latest]
15-
16-
steps:
17-
- uses: actions/checkout@v4
18-
19-
- name: Build wheels
20-
uses: pypa/cibuildwheel@v2.21.3
21-
env:
22-
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-*
23-
CIBW_SKIP: cp*_i686
24-
25-
- uses: actions/upload-artifact@v4
26-
with:
27-
name: smt-${{ matrix.os }}
28-
path: ./wheelhouse/*.whl
299

3010
build_sdist:
3111
name: Build source distribution
@@ -38,20 +18,18 @@ jobs:
3818

3919
- uses: actions/upload-artifact@v4
4020
with:
41-
name: smt-src
21+
name: smt-design-space-ext-src
4222
path: dist/*.tar.gz
4323

4424
upload_pypi:
45-
needs: [build_wheels, build_sdist]
25+
needs: [build_sdist]
4626
runs-on: ubuntu-latest
4727
environment: pypi
4828
permissions:
4929
id-token: write
5030
steps:
5131
- uses: actions/download-artifact@v4
5232
with:
53-
pattern: smt-*
54-
merge-multiple: true
5533
path: dist
5634

5735
- uses: pypa/gh-action-pypi-publish@release/v1

README.md

Lines changed: 2 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,3 @@
1-
![SMT Logo](./doc/smt_logo.png)
2-
# Surrogate Modeling Toolbox
1+
# SMT Design Space Extension
32

4-
[![Tests](https://github.com/SMTOrg/smt/workflows/Tests/badge.svg)](https://github.com/SMTorg/smt/actions?query=workflow%3ATests)
5-
[![Coverage Status](https://coveralls.io/repos/github/SMTorg/smt/badge.svg?branch=master)](https://coveralls.io/github/SMTorg/smt?branch=master)
6-
[![Documentation Status](https://readthedocs.org/projects/smt/badge/?version=latest)](https://smt.readthedocs.io/en/latest/?badge=latest)
7-
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
8-
9-
The surrogate modeling toolbox (SMT) is a Python package that contains a collection of surrogate modeling methods, sampling techniques, and benchmarking functions. This package provides a library of surrogate models that is simple to use and facilitates the implementation of additional methods.
10-
11-
SMT is different from existing surrogate modeling libraries because of its emphasis on derivatives, including training derivatives used for gradient-enhanced modeling, prediction derivatives, and derivatives with respect to the training data.
12-
13-
It also includes new surrogate models that are not available elsewhere: kriging by partial-least squares reduction and energy-minimizing spline interpolation.
14-
SMT is documented using custom tools for embedding automatically-tested code and dynamically-generated plots to produce high-quality user guides with minimal effort from contributors.
15-
16-
SMT is distributed under the New BSD license.
17-
18-
To cite SMT 2.0: P. Saves and R. Lafage and N. Bartoli and Y. Diouane and J. H. Bussemaker and T. Lefebvre and J. T. Hwang and J. Morlier and J. R. R. A. Martins. SMT 2.0: A Surrogate Modeling Toolbox with a focus on Hierarchical and Mixed Variables Gaussian Processes. Advances in Engineering Software, 2024.
19-
20-
```
21-
@article{saves2024smt,
22-
author = {P. Saves and R. Lafage and N. Bartoli and Y. Diouane and J. Bussemaker and T. Lefebvre and J. T. Hwang and J. Morlier and J. R. R. A. Martins},
23-
title = {{SMT 2.0: A} Surrogate Modeling Toolbox with a focus on Hierarchical and Mixed Variables Gaussian Processes},
24-
journal = {Advances in Engineering Sofware},
25-
year = {2024},
26-
volume = {188},
27-
pages = {103571},
28-
doi = {https://doi.org/10.1016/j.advengsoft.2023.103571}}
29-
```
30-
31-
To cite SMT legacy: M. A. Bouhlel and J. T. Hwang and N. Bartoli and R. Lafage and J. Morlier and J. R. R. A. Martins. A Python surrogate modeling framework with derivatives. Advances in Engineering Software, 2019.
32-
33-
```
34-
@article{SMT2019,
35-
Author = {Mohamed Amine Bouhlel and John T. Hwang and Nathalie Bartoli and Rémi Lafage and Joseph Morlier and Joaquim R. R. A. Martins},
36-
Journal = {Advances in Engineering Software},
37-
Title = {A Python surrogate modeling framework with derivatives},
38-
pages = {102662},
39-
issn = {0965-9978},
40-
doi = {https://doi.org/10.1016/j.advengsoft.2019.03.005},
41-
Year = {2019}}
42-
```
43-
44-
# Required packages
45-
SMT depends on the following modules: numpy, scipy, scikit-learn, pyDOE3 and Cython.
46-
47-
# Installation
48-
If you want to install the latest release
49-
50-
```
51-
pip install smt
52-
```
53-
54-
or else if you want to install from the current master branch
55-
56-
```
57-
pip install git+https://github.com/SMTOrg/smt.git@master
58-
```
59-
60-
# Usage
61-
For examples demonstrating how to use SMT, you can take a look at the [tutorial notebooks](https://github.com/SMTorg/smt/tree/master/tutorial#readme) or go to the 'smt/examples' folder.
62-
63-
# Documentation
64-
[Documentation of Surrogate Modeling Toolbox](http://smt.readthedocs.io/en/stable).
65-
66-
# Contributing
67-
To contribute to SMT refer to the [contributing section](https://smt.readthedocs.io/en/latest/_src_docs/dev_docs.html#contributing-to-smt) of the documentation.
3+
This module allows to use advanced design space implementation for hierachical variables handling.

__version__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

requirements.txt

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
1-
Cython
2-
numpy
3-
scipy
4-
scikit-learn
5-
pyDOE3
6-
numba # JIT compiler
7-
matplotlib # used in examples and tests
8-
pytest # tests runner
9-
pytest-xdist # allows running parallel testing with pytest -n <num_workers>
10-
pytest-cov # allows to get coverage report
11-
ruff # format and lint code
12-
smt
13-
jenn >= 1.0.2, <2.0
14-
egobox ~= 0.20.0
1+
smt @ git+https://github.com/SMTorg/smt@master
152
ConfigSpace==0.6.1
16-
adsg-core==1.1.1
3+
adsg-core==1.1.1
4+
pytest # tests runner
5+
pytest-cov # allows to get coverage report
6+
ruff # format and lint code

setup.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,29 @@
88

99
from setuptools import setup
1010

11-
version = {}
12-
with open("./__version__.py") as fp:
13-
exec(fp.read(), version)
14-
11+
# Import __version__ without importing the module in setup
12+
exec(open("./smt_design_space_ext/version.py").read())
1513

1614
setup(
17-
name="smt_design_space",
15+
name="smt_design_space_ext",
16+
version=__version__, # noqa
1817
author="Paul Saves et al.",
1918
author_email="paul.saves@onera.fr",
2019
keywords=["SMT, DesignSpace, Graph"],
21-
license="ONERA",
22-
description="SMT Design Space",
20+
license="BSD-3",
21+
description="SMT design space extension for hierarchical variables handling",
2322
install_requires=[
24-
"scipy",
2523
"numpy",
26-
"scikit-learn",
24+
"smt",
2725
"ConfigSpace==0.6.1",
2826
"adsg-core==1.1.1",
2927
],
3028
maintainer="Paul Saves",
3129
maintainer_email="paul.saves@onera.fr",
3230
packages=[
33-
"smt_design_space",
31+
"smt_design_space_ext",
3432
],
35-
include_package_data=True,
36-
python_requires=">=3.8",
37-
version=version["__version__"],
38-
zip_safe=False,
33+
python_requires=">=3.9",
3934
url="https://github.com/SMTorg/smt-design-space", # use the URL to the github repo
4035
download_url="https://github.com/SMTorg/smt-design-space/releases",
4136
)

smt_design_space_ext/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from .version import __version__
2+
3+
# Symbols imported in smt to handle hierarchical variables
4+
from smt_design_space_ext.design_space import (
5+
DesignSpace,
6+
ensure_design_space,
7+
)
8+
9+
__all__ = ["__version__", "DesignSpace", "ensure_design_space"]

0 commit comments

Comments
 (0)