From 998b4a0c8ab6cef636aa7388e8ae9f2377e24da1 Mon Sep 17 00:00:00 2001 From: Xander Date: Mon, 14 Apr 2025 17:24:27 -0400 Subject: [PATCH 01/10] Create requirements.txt --- requirements.txt | 89 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..29f70a2 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,89 @@ +# This file was autogenerated by uv via the following command: +# uv pip compile pyproject.toml -o requirements.txt +contourpy==1.3.1 + # via matplotlib +coverage==7.8.0 + # via pytest-cov +cycler==0.12.1 + # via matplotlib +flexcache==0.3 + # via pint +flexparser==0.4 + # via pint +fonttools==4.57.0 + # via matplotlib +iniconfig==2.1.0 + # via pytest +kiwisolver==1.4.8 + # via matplotlib +matplotlib==3.10.1 + # via pycalphad +numpy==1.26.4 + # via + # ammber (pyproject.toml) + # contourpy + # matplotlib + # pandas + # pycalphad + # scipy + # xarray +packaging==24.2 + # via + # matplotlib + # pytest + # setuptools-scm + # xarray +pandas==2.2.3 + # via xarray +pillow==11.2.1 + # via matplotlib +pint==0.24.4 + # via pycalphad +platformdirs==4.3.7 + # via pint +pluggy==1.5.0 + # via pytest +pycalphad==0.11.0 + # via ammber (pyproject.toml) +pyparsing==3.2.3 + # via + # matplotlib + # pycalphad +pytest==8.3.5 + # via + # pycalphad + # pytest-cov +pytest-cov==6.1.1 + # via pycalphad +python-dateutil==2.9.0.post0 + # via + # matplotlib + # pandas +pytz==2025.2 + # via pandas +runtype==0.5.3 + # via pycalphad +scipy==1.15.2 + # via + # ammber (pyproject.toml) + # pycalphad +setuptools==78.1.0 + # via setuptools-scm +setuptools-scm==8.2.0 + # via pycalphad +six==1.17.0 + # via python-dateutil +symengine==0.14.0 + # via pycalphad +tinydb==4.8.2 + # via pycalphad +typing-extensions==4.13.2 + # via + # flexcache + # flexparser + # pint + # pycalphad +tzdata==2025.2 + # via pandas +xarray==2025.3.1 + # via pycalphad From 3750dfe079e6a79bca696e5ca5766ecd6db601d6 Mon Sep 17 00:00:00 2001 From: Xander <102053371+fractalsbyx@users.noreply.github.com> Date: Fri, 11 Apr 2025 13:18:13 -0400 Subject: [PATCH 02/10] Create python-package.yml --- .github/workflows/python-package.yml | 40 ++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/python-package.yml diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..e56abb6 --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,40 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python package + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.9", "3.10", "3.11"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest From 78ec4844bc2341dac57a297b61e210fd6e78767d Mon Sep 17 00:00:00 2001 From: Xander Date: Mon, 14 Apr 2025 17:52:08 -0400 Subject: [PATCH 03/10] Update python-package.yml --- .github/workflows/python-package.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index e56abb6..b832550 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -35,6 +35,8 @@ jobs: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Install package + run: pip install -e . - name: Test with pytest run: | pytest From d4652f4c9ea38b79f1f3925fe12dcb00eeed1949 Mon Sep 17 00:00:00 2001 From: Xander Date: Mon, 14 Apr 2025 18:15:46 -0400 Subject: [PATCH 04/10] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 29f70a2..e177e12 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ # This file was autogenerated by uv via the following command: # uv pip compile pyproject.toml -o requirements.txt -contourpy==1.3.1 +contourpy==1.3.0 # via matplotlib coverage==7.8.0 # via pytest-cov From 2f3b4d93bc195b13b40d56b77925483001c90379 Mon Sep 17 00:00:00 2001 From: Xander Date: Mon, 14 Apr 2025 18:22:28 -0400 Subject: [PATCH 05/10] Update pyproject.toml --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 99fb886..5a7fb1e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,5 +58,8 @@ classifiers=[ 'Programming Language :: Python :: 3.5', ] +[tool.setuptools.packages.find] +include = ["ammber"] + [project.urls] Homepage = "https://github.com/UMThorntongroup/" From 7f55d9d779ed50f4683353b0c182dd324e7cc487 Mon Sep 17 00:00:00 2001 From: Xander Date: Mon, 14 Apr 2025 18:28:25 -0400 Subject: [PATCH 06/10] Update pyproject.toml --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5a7fb1e..5e134fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,8 @@ authors = [ { name = "Xander Mensah", email = "xmen@umich.edu" }, { name = "Katsuyo Thornton", email = "kthorn@umich.edu" } ] -license = { file = "LICENSE.md" } +license = "MIT" +license-files = ["LICENSE.md"] readme = "README.md" requires-python = ">=2.7, <4" @@ -50,7 +51,6 @@ dependencies = [ classifiers=[ 'Development Status :: 1 - Planning', 'Intended Audience :: Science/Research', - 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', From ad6287f10f634289c8956891adb60d495271cf41 Mon Sep 17 00:00:00 2001 From: Xander <102053371+fractalsbyx@users.noreply.github.com> Date: Tue, 15 Apr 2025 12:38:08 -0400 Subject: [PATCH 07/10] Package with 3.13 (#10) * Update python-package.yml * Update python-package.yml * Update python-package.yml * Change some names in the workflow --- .github/workflows/python-package.yml | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index b832550..21020d0 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -5,18 +5,32 @@ name: Python package on: push: - branches: [ "main" ] + branches: + - main pull_request: - branches: [ "main" ] + branches: + - main + - devel + - packaging-updates + types: + - opened + - reopened + - synchronize + - ready_for_review + + +concurrency: + group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request'}} jobs: - build: + build-lint-pytest: runs-on: ubuntu-latest strategy: fail-fast: false matrix: - python-version: ["3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 @@ -27,7 +41,9 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip + python -m pip install uv python -m pip install flake8 pytest + uv pip compile pyproject.toml -o requirements.txt if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Lint with flake8 run: | From aa3b40ac9e080aada26e428edb3a18ccba6d26aa Mon Sep 17 00:00:00 2001 From: Xander Date: Tue, 15 Apr 2025 12:42:52 -0400 Subject: [PATCH 08/10] Update .gitignore --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 1c01d4a..2c3d1e6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,7 @@ __pycache__ ../build dist *egg-info -*.pyc \ No newline at end of file +*.pyc + +*.DS_Store +*.vscode \ No newline at end of file From 7a567bed3f155064f97b498a303a45f09f9824bb Mon Sep 17 00:00:00 2001 From: Xander <102053371+fractalsbyx@users.noreply.github.com> Date: Fri, 11 Apr 2025 13:08:49 -0400 Subject: [PATCH 09/10] Create python-publish.yml --- .github/workflows/python-publish.yml | 70 ++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/python-publish.yml diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..46f94a2 --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,70 @@ +# This workflow will upload a Python Package to PyPI when a release is created +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Upload Python Package + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + release-build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.x" + + - name: Build release distributions + run: | + # NOTE: put your own distribution build steps here. + python -m pip install build + python -m build + + - name: Upload distributions + uses: actions/upload-artifact@v4 + with: + name: release-dists + path: dist/ + + pypi-publish: + runs-on: ubuntu-latest + needs: + - release-build + permissions: + # IMPORTANT: this permission is mandatory for trusted publishing + id-token: write + + # Dedicated environments with protections for publishing are strongly recommended. + # For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules + environment: + name: pypi + # OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status: + url: https://pypi.org/p/ammber + # + # ALTERNATIVE: if your GitHub Release name is the PyPI project version string + # ALTERNATIVE: exactly, uncomment the following line instead: + # url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }} + + steps: + - name: Retrieve release distributions + uses: actions/download-artifact@v4 + with: + name: release-dists + path: dist/ + + - name: Publish release distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: dist/ From 455f75001e91b4f45f0565a481d833fdfdf9bf0e Mon Sep 17 00:00:00 2001 From: Xander Date: Tue, 15 Apr 2025 14:32:01 -0400 Subject: [PATCH 10/10] release to GH and publish on PyPI only python3 --- .github/workflows/python-publish.yml | 59 ++++++++++++++-------------- pyproject.toml | 2 - 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 46f94a2..e85cd73 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -1,23 +1,37 @@ -# This workflow will upload a Python Package to PyPI when a release is created -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries - -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -name: Upload Python Package +name: Publish Python Package on: - release: - types: [published] + push: + tags: + - '[0-9]*.[0-9]*.[0-9]*' + - 'v[0-9]*.[0-9]*.[0-9]*' permissions: - contents: read + contents: write # Required for creating a GitHub release + id-token: write # Required for trusted publishing to PyPI jobs: + create-release: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Create GitHub Release + id: create_release + uses: actions/create-release@v1 + with: + tag_name: ${{ github.ref_name }} + release_name: Release ${{ github.ref_name }} + body: | + This is an automated release for version ${{ github.ref_name }}. + draft: false + prerelease: false + release-build: runs-on: ubuntu-latest + needs: create-release steps: - uses: actions/checkout@v4 @@ -28,7 +42,6 @@ jobs: - name: Build release distributions run: | - # NOTE: put your own distribution build steps here. python -m pip install build python -m build @@ -40,22 +53,10 @@ jobs: pypi-publish: runs-on: ubuntu-latest - needs: - - release-build - permissions: - # IMPORTANT: this permission is mandatory for trusted publishing - id-token: write - - # Dedicated environments with protections for publishing are strongly recommended. - # For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules + needs: release-build environment: - name: pypi - # OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status: - url: https://pypi.org/p/ammber - # - # ALTERNATIVE: if your GitHub Release name is the PyPI project version string - # ALTERNATIVE: exactly, uncomment the following line instead: - # url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }} + name: release + url: https://pypi.org/project/ammber steps: - name: Retrieve release distributions @@ -67,4 +68,4 @@ jobs: - name: Publish release distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: - packages-dir: dist/ + packages-dir: dist/ \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 5e134fe..6209228 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,8 +51,6 @@ dependencies = [ classifiers=[ 'Development Status :: 1 - Planning', 'Intended Audience :: Science/Research', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5',