From f70719217c192cff70c9bd39fe1268c7e83400d2 Mon Sep 17 00:00:00 2001 From: Max Hoffmann Date: Thu, 25 Dec 2025 06:35:22 -0300 Subject: [PATCH 1/3] Add GitHub Actions CI workflow to run pytest on PRs This workflow will: - Run on every pull request - Run on pushes to master and python3 branches - Use Python 3.9 with uv for dependency management - Execute pytest with PYTHONPATH set correctly --- .github/workflows/ci.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..fec0546d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: CI + +on: + pull_request: + push: + branches: + - master + - python3 + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.9' + + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + enable-cache: true + + - name: Install dependencies + run: uv sync + + - name: Run tests + run: PYTHONPATH=. uv run pytest tests/ + env: + PYTHONHASHSEED: 0 From 527f5aa5f6f0b004e71e2d54dfce7cf64c15198a Mon Sep 17 00:00:00 2001 From: Max Hoffmann Date: Thu, 25 Dec 2025 06:39:54 -0300 Subject: [PATCH 2/3] Added pyproject.toml --- pyproject.toml | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..b2630f90 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,45 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "kmos" +version = "0.1.0" +description = "kMC modeling on steroids" +readme = "README.md" +requires-python = ">=3.9" +authors = [ + {name = "Max J. Hoffmann", email = "mjhoffmann@gmail.com"} +] +maintainers = [ + {name = "Max J. Hoffmann", email = "mjhoffmann@gmail.com"} +] +dependencies = [ + "ase", + "ipython", + "lxml", + "numpy>=2.0.2", + "pytest>=8.4.2", +] + +[project.scripts] +kmos = "kmos.cli:main" + +[tool.setuptools.packages.find] +where = ["."] +include = ["kmos*"] + +[tool.setuptools.package-data] +kmos = [ + "fortran_src/*.f90", + "fortran_src/*.mpy", + "kmc_editor.glade", + "fortran_src/assert.ppc", + "kmc_project_v0.1.dtd", + "kmc_project_v0.2.dtd", + "kmc_project_v0.3.dtd" +] + +[tool.pytest.ini_options] +# Tests now run deterministically without requiring PYTHONHASHSEED=0 +# Example: PYTHONPATH=. uv run pytest tests/ From c9ddbda2d47b09490a56600b9893febbf7cfc264 Mon Sep 17 00:00:00 2001 From: Max Hoffmann Date: Thu, 25 Dec 2025 06:51:55 -0300 Subject: [PATCH 3/3] Switch to pyproject.toml versioning --- kmos/__init__.py | 8 ++++- pyproject.toml | 28 ++++++++++++++- setup.py | 89 ------------------------------------------------ 3 files changed, 34 insertions(+), 91 deletions(-) delete mode 100755 setup.py diff --git a/kmos/__init__.py b/kmos/__init__.py index 1aabcc64..8afcdbef 100644 --- a/kmos/__init__.py +++ b/kmos/__init__.py @@ -50,7 +50,13 @@ #import kmos.types #import kmos.io -__version__ = "0.3.21" +# Version is managed in pyproject.toml and read from package metadata +try: + from importlib.metadata import version + __version__ = version("kmos") +except Exception: + # Fallback for development installations + __version__ = "0.0.0+unknown" VERSION = __version__ diff --git a/pyproject.toml b/pyproject.toml index b2630f90..b8890a44 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,16 +4,38 @@ build-backend = "setuptools.build_meta" [project] name = "kmos" -version = "0.1.0" +version = "0.4.0" # Managed by bump-my-version description = "kMC modeling on steroids" readme = "README.md" requires-python = ">=3.9" +license = {text = "GPL-3.0-or-later"} authors = [ {name = "Max J. Hoffmann", email = "mjhoffmann@gmail.com"} ] maintainers = [ {name = "Max J. Hoffmann", email = "mjhoffmann@gmail.com"} ] +keywords = ["kmc", "kinetic monte carlo", "lattice", "chemistry", "physics", "surface science"] +classifiers = [ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Intended Audience :: Science/Research", + "Intended Audience :: Developers", + "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", + "Natural Language :: English", + "Operating System :: POSIX :: Linux", + "Operating System :: Microsoft :: Windows", + "Programming Language :: Fortran", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Education", + "Topic :: Scientific/Engineering :: Chemistry", + "Topic :: Scientific/Engineering :: Physics", + "Topic :: Scientific/Engineering :: Visualization", +] dependencies = [ "ase", "ipython", @@ -22,6 +44,10 @@ dependencies = [ "pytest>=8.4.2", ] +[project.urls] +Homepage = "https://github.com/mhoffman/kmos" +Repository = "https://github.com/mhoffman/kmos" + [project.scripts] kmos = "kmos.cli:main" diff --git a/setup.py b/setup.py deleted file mode 100755 index fd13bbbb..00000000 --- a/setup.py +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/env python -"""kMC modeling on steroids""" - -import os -from distutils.core import setup -from kmos import __version__ as version - -maintainer = 'Max J. Hoffmann' -maintainer_email = 'mjhoffmann@gmail.com' -author = 'Max J. Hoffmann' -author_email = 'mjhoffmann@gmail.com' -description = __doc__ -classifiers = [ - 'Development Status :: 4 - Beta', - 'Environment :: Console', - 'Environment :: X11 Applications :: GTK', - 'Intended Audience :: Science/Research', - 'Intended Audience :: Developers', - 'OSI Approved :: GNU General Public License (GPL)', - 'Natural Language :: English', - 'Operating System :: POSIX :: Linux', - 'Operating System :: POSIX :: Windows', - 'Programming Language :: Fortran', - 'Programming Language :: Python', - 'Topic :: Education', - 'Topic :: Scientific/Engineering :: Chemistry', - 'Topic :: Scientific/Engineering :: Physics', - 'Topic :: Scientific/Engineering :: Visualization', - ] -requires = [ - 'ase', - 'cairo', - 'gobject', - 'goocanvas', - 'gtk', - 'kiwi', - 'lxml', - 'matplotlib', - 'pygtk', - ] -license = 'COPYING' -long_description = file('README.rst').read() -name='python-kmos' -packages = [ - 'kmos', - 'kmos.utils', - 'kmos.run', - 'kmos.gui', - ] -package_dir = {'kmos':'kmos'} -package_data = {'kmos':['fortran_src/*f90', - 'fortran_src/*.mpy', - 'kmc_editor.glade', - 'fortran_src/assert.ppc', - 'kmc_project_v0.1.dtd', - 'kmc_project_v0.2.dtd', - 'kmc_project_v0.3.dtd']} -platforms = ['linux', 'windows'] -if os.name == 'nt': - scripts = [ - 'tools/kmos.bat' - ] -else: - scripts = [ - 'tools/kmos-build-standalone', - 'tools/kmos', - 'tools/kmos-install-dependencies-ubuntu', - ] -url = 'https://github.com/mhoffman/kmos' - -setup( - author=author, - author_email=author_email, - description=description, - #requires=requires, - license=license, - long_description=long_description, - maintainer=maintainer, - maintainer_email=maintainer_email, - name=name, - package_data=package_data, - package_dir=package_dir, - packages=packages, - platforms=platforms, - #requires=requires, - scripts=scripts, - url=url, - version=version, - )