diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..ecde5f4 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,79 @@ +name: Update Version, Test, Publish to PyPI, and Upload Release Artifacts + +on: + release: + types: [created, edited] + +jobs: + build-test-publish-upload: + runs-on: ubuntu-latest + environment: release + permissions: + # IMPORTANT: this permission is mandatory for trusted publishing + id-token: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install hatch + - name: Set release version + run: | + # Get the tag from the GitHub release + TAG=${GITHUB_REF#refs/tags/} + # Remove 'v' prefix if present + VERSION=${TAG#v} + hatch version $VERSION + - name: Build package + run: hatch build + - name: Run tests + run: hatch run test:pytest + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + - name: Verify PyPI Release + run: | + # Verify PyPI release + PACKAGE_NAME="mesa_frames" + CURRENT_VERSION=$(hatch version) + pip install $PACKAGE_NAME==$CURRENT_VERSION + python -c "import mesa_frames; print(mesa_frames.__version__)" + - name: Create or recreate version branch + - name: Create or recreate version branch + run: | + CURRENT_VERSION=$(hatch version) + BRANCH_NAME="v$CURRENT_VERSION" + + git config user.name github-actions + git config user.email github-actions@github.com + + # Delete the branch if it exists (both locally and remotely) + git branch -D $BRANCH_NAME || true + git push origin --delete $BRANCH_NAME || true + + # Create and push the new branch + git checkout -b $BRANCH_NAME + git push -u origin $BRANCH_NAME + + # Switch back to the main branch + git checkout main + - name: Update to Next Version + run: | + # Bump to next development version + hatch version patch + hatch version dev + + # Get the new version + NEW_VERSION=$(hatch version) + + # Commit and push the version bump + git config user.name github-actions + git config user.email github-actions@github.com + git add mesa-frames/__init__.py + git commit -m "Bump version to $NEW_VERSION [skip ci]" + git push \ No newline at end of file diff --git a/mesa_frames/__init__.py b/mesa_frames/__init__.py index 9914980..07b86f9 100644 --- a/mesa_frames/__init__.py +++ b/mesa_frames/__init__.py @@ -57,3 +57,5 @@ def __init__(self, width, height): "GridPandas", "GridPolars", ] + +__version__ = "0.1.0alpha" diff --git a/pyproject.toml b/pyproject.toml index 5ff7a09..f769264 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,28 +4,56 @@ build-backend = "hatchling.build" [project] name = "mesa_frames" -version = "0.1.0-alpha1" description = "An extension to the Mesa framework which uses pandas/Polars DataFrames for enhanced performance" authors = [ - { name = "Adam Amer" }, + { name = "Adam Amer"}, ] license = { text = "MIT" } +readme = "README.md" +keywords = [ + "simulation", + "simulation-environment", + "gis", + "pandas", + "simulation-framework", + "agent-based-modeling", + "complex-systems", + "spatial-models", + "mesa", + "complexity-analysis", + "modeling-agents", + "agent-based-modelling" +] +classifiers = [ + "Development Status :: 3 - Alpha", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "Topic :: Scientific/Engineering :: Artificial Life", +] dependencies = [ "numpy~=1.26", - "typing-extensions>=4.9" #typing-extensions.Self added in 4.9 -] - -[project.optional-dependencies] -pandas = [ - "pandas~=2.2", - "pyarrow", + "typing-extensions>=4.9", #typing-extensions.Self added in 4.9 + ## pandas + "pandas>=2.2", + "pyarrow", #for conversion to pandas #"geopandas" (only after GeoGrid / ContinousSpace is implemented) -] -polars = [ + ## polars "polars>=1.0.0", #polars._typing (see mesa_frames.types) added in 1.0.0 #"geopolars" (currently in pre-alpha) ] +requires-python = ">=3.8" +dynamic = [ + "version" +] + + +[project.urls] +Documentation = "https://adamamer20.github.io/mesa-frames" +Repository = "https://github.com/adamamer20/mesa-frames.git" + +[project.optional-dependencies] mkdocs = [ "mkdocs-material", "mkdocs-jupyter", @@ -44,26 +72,35 @@ sphinx = [ ] docs = [ - "mesa_frames[pandas, polars, mkdocs, sphinx]", + "mesa_frames[mkdocs, sphinx]", # Readme Script "perfplot", "seaborn" ] -dev = [ - "mesa_frames[pandas, polars, docs]", +test = [ "pytest", "pytest-cov", "typeguard", +] + +dev = [ + "mesa_frames[test, docs]", "mesa", ] +[tool.hatch.envs.test] +features = ["test"] + [tool.hatch.envs.dev] #Allows installing dev as virtual env features = ["dev"] [tool.hatch.build.targets.wheel] packages = ["mesa_frames"] +[tool.hatch.version] +path = "mesa_frames/__init__.py" + [tool.ruff.lint] select = ["D"] ignore = ["D101", "D102", "D105"] @@ -74,4 +111,5 @@ convention = "numpy" [tool.ruff.lint.per-file-ignores] "tests/*" = ["D"] "examples/*" = ["D"] -"docs/*" = ["D"] \ No newline at end of file +"docs/*" = ["D"] +