From a2fc7a4de1ec69851b34961ddf92225e77facab9 Mon Sep 17 00:00:00 2001 From: Stephen Smith Date: Thu, 12 Nov 2026 19:46:12 +0000 Subject: [PATCH] Package for 1.0.0: move to pyproject.toml, update metadata and CI Pythons - Version 1.0.0 (Python package and CMake project) - Replace setup.py/setup.cfg with pyproject.toml (setuptools >= 77): SPDX license expression, Production/Stable status, Python 3.9-3.14 classifiers, requires-python >= 3.9 (list[...] annotations need 3.9), OS classifiers, project URLs. Wheel contents are unchanged. - MANIFEST.in: keep local CMake build dirs and bytecode out of the sdist - CI/publish: build with `python -m build`; test matrix 3.9-3.14 instead of 3.7-3.9 so the classifiers match what is tested; actions/checkout@v4 and actions/setup-python@v5 (v2/v3 run on retired Node versions) - Read the Docs builds with Python 3.12 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01X8Wmw797DJpgrMFmT6n8CG --- .github/workflows/main.yml | 18 +++--- .github/workflows/publish.yml | 12 ++-- .readthedocs.yaml | 2 +- MANIFEST.in | 3 + pyproject.toml | 70 ++++++++++++++++++++++ pythonfmu3/_version.py | 2 +- pythonfmu3/pythonfmu-export/CMakeLists.txt | 2 +- setup.cfg | 52 ---------------- setup.py | 4 -- 9 files changed, 91 insertions(+), 74 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c84166b..e628e24 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,10 +17,10 @@ jobs: os: [ubuntu-22.04, windows-2022] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Python 3.x - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: '3.x' architecture: 'x64' @@ -56,10 +56,10 @@ jobs: needs: build-wrapper runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Python 3.x - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: '3.x' architecture: 'x64' @@ -73,8 +73,8 @@ jobs: - name: Build distribution artifacts run: | - python -m pip install setuptools wheel - python setup.py sdist bdist_wheel + python -m pip install build + python -m build - name: Archive production artifacts uses: actions/upload-artifact@v4 @@ -89,14 +89,14 @@ jobs: fail-fast: false matrix: os: [ubuntu-22.04, windows-2022] - python-version: [3.7, 3.8, 3.9] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14'] timeout-minutes: 15 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Python 3.x - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} architecture: 'x64' diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index db95256..0ca1e21 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -13,9 +13,9 @@ jobs: os: [ubuntu-22.04, windows-2022] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup Python 3.x - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: '3.x' architecture: 'x64' @@ -48,9 +48,9 @@ jobs: needs: build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: '3.x' - name: Download wrappers @@ -62,11 +62,11 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine + pip install build twine - name: Build and publish env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.PYPI_PYTHONFMU_API_TOKEN }} run: | - python setup.py sdist bdist_wheel + python -m build twine upload dist/* diff --git a/.readthedocs.yaml b/.readthedocs.yaml index dd818e8..3570df3 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -9,7 +9,7 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "3.8" + python: "3.12" mkdocs: configuration: mkdocs.yml diff --git a/MANIFEST.in b/MANIFEST.in index a07d13b..b66ca12 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,3 +6,6 @@ recursive-include pythonfmu3/tests/slaves * recursive-include pythonfmu3/resources * recursive-include pythonfmu3/pythonfmu-export * + +prune pythonfmu3/pythonfmu-export/build +global-exclude __pycache__ *.py[cod] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..229ea73 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,70 @@ +[build-system] +# >= 77 for the SPDX `license` expression (PEP 639) +requires = ["setuptools>=77"] +build-backend = "setuptools.build_meta" + +[project] +name = "pythonfmu3" +dynamic = ["version"] +description = "A lightweight framework that enables the packaging of Python 3 code as FMI 3.0 co-simulation and model exchange FMUs." +readme = "README.md" +requires-python = ">=3.9" +license = "MIT" +license-files = ["LICENSE"] +authors = [{ name = "Stephen Smith" }] +keywords = ["FMI", "FMI3", "FMU", "co-simulation", "model exchange", "simulation"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: End Users/Desktop", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "Natural Language :: English", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX :: Linux", + "Operating System :: MacOS", + "Programming Language :: C++", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + "Topic :: Scientific/Engineering", +] +dependencies = [] + +[project.optional-dependencies] +tests = ["pytest", "fmpy"] + +[project.urls] +Homepage = "https://github.com/StephenSmith25/PythonFMU3" +Documentation = "https://pythonfmu3.readthedocs.io/" +Issues = "https://github.com/StephenSmith25/PythonFMU3/issues" + +[project.scripts] +pythonfmu3 = "pythonfmu3.__main__:cli_main" + +[tool.setuptools.dynamic] +version = { attr = "pythonfmu3._version.__version__" } + +[tool.setuptools.packages.find] +include = ["pythonfmu3*"] + +[tool.setuptools.package-data] +# Prebuilt wrapper libraries, the wrapper sources (embedded in every FMU) and test data +pythonfmu3 = [ + "resources/binaries/*/*", + "pythonfmu-export/**/*", + "tests/data/*", + "tests/slaves/*", +] + +[tool.setuptools.exclude-package-data] +pythonfmu3 = ["pythonfmu-export/build/**", "**/__pycache__/*"] + +[tool.pytest.ini_options] +markers = [ + "integration: marks integration tests", + "doc: marks documentation tests", +] diff --git a/pythonfmu3/_version.py b/pythonfmu3/_version.py index 334b899..5becc17 100644 --- a/pythonfmu3/_version.py +++ b/pythonfmu3/_version.py @@ -1 +1 @@ -__version__ = "0.3.4" +__version__ = "1.0.0" diff --git a/pythonfmu3/pythonfmu-export/CMakeLists.txt b/pythonfmu3/pythonfmu-export/CMakeLists.txt index 8b48b84..7dba5b8 100644 --- a/pythonfmu3/pythonfmu-export/CMakeLists.txt +++ b/pythonfmu3/pythonfmu-export/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.10) -project(pythonfmu-export VERSION 0.2.0) +project(pythonfmu-export VERSION 1.0.0) # ============================================================================== # Build settings diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 59751ff..0000000 --- a/setup.cfg +++ /dev/null @@ -1,52 +0,0 @@ -[metadata] -name = pythonfmu3 -version = attr: pythonfmu3._version.__version__ -author = Stephen Smith -home-page = https://github.com/stephensmith25/PythonFMU3 -description = A lightweight framework that enables the packaging of Python3.x code as co-simulation FMUs. -long_description = file: README.md -long_description_content_type = text/markdown -license = MIT -license-file = LICENSE -keywords = FMI -classifiers = - Development Status :: 3 - Alpha - Intended Audience :: End Users/Desktop - Intended Audience :: Developers - Intended Audience :: Science/Research - License :: OSI Approved :: MIT License - Natural Language :: English - Programming Language :: C++ - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Topic :: Scientific/Engineering -tests_require = - pytest - fmpy - -[options] -include_package_data = True -packages = find: -zip_safe = False - -[options.package_data] -pythonfmu3 = - resources/*.dll - resources/*.dylib - resources/*.so - -[options.entry_points] -console_scripts = - pythonfmu3 = pythonfmu3.__main__:cli_main - -[options.extras_require] -tests = - pytest - fmpy - -[tool:pytest] -markers = - integration: marks integration tests - doc: marks documentation tests diff --git a/setup.py b/setup.py deleted file mode 100644 index efb959f..0000000 --- a/setup.py +++ /dev/null @@ -1,4 +0,0 @@ -from setuptools import setup - -# See setup.cfg for Python package parameters -setup()