From 5270177d42768dd22483f0b2458fe27c8cccb129 Mon Sep 17 00:00:00 2001 From: rht Date: Mon, 1 Jul 2024 22:07:24 -0400 Subject: [PATCH 1/2] Merge requirements.txt into pyproject.toml (#15) --- README.md | 28 +++++++++++++++++++--------- pyproject.toml | 13 +++++++++++++ requirements.txt | 4 ---- 3 files changed, 32 insertions(+), 13 deletions(-) delete mode 100644 requirements.txt diff --git a/README.md b/README.md index 843a059..908d891 100644 --- a/README.md +++ b/README.md @@ -31,16 +31,21 @@ cd mesa_frames If you want to install it into a new environment: ```bash -conda create -n myenv -f requirements.txt -pip install -e . +conda create -n myenv ``` If you want to install it into an existing environment: ```bash conda activate myenv -conda install -f requirements.txt -pip install -e . +``` + +Then, to install mesa-frames itself: +```bash +# For pandas backend +pip install -e .[pandas] +# Alternatively, for Polars backend +pip install -e .[polars] ``` ### Installing in a Python Virtual Environment @@ -50,18 +55,23 @@ If you want to install it into a new environment: ```bash python3 -m venv myenv source myenv/bin/activate # On Windows, use `myenv\Scripts\activate` -pip install -r requirements.txt -pip install -e . ``` If you want to install it into an existing environment: ```bash source myenv/bin/activate # On Windows, use `myenv\Scripts\activate` -pip install -r requirements.txt -pip install -e . ``` +Then, to install mesa-frames itself: +```bash +# For pandas backend +pip install -e .[pandas] +# Alternatively, for Polars backend +pip install -e .[polars] +``` + + ## Usage **Note:** mesa-frames is currently in its early stages of development. As such, the usage patterns and API are subject to change. Breaking changes may be introduced. Reports of feedback and issues are encouraged. @@ -143,4 +153,4 @@ mesa-frames is made available under the MIT License. This license allows you to - The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - The software is provided "as is", without warranty of any kind. -For the full license text, see the [LICENSE](https://github.com/adamamer20/mesa_frames/blob/main/LICENSE) file in the GitHub repository. \ No newline at end of file +For the full license text, see the [LICENSE](https://github.com/adamamer20/mesa_frames/blob/main/LICENSE) file in the GitHub repository. diff --git a/pyproject.toml b/pyproject.toml index 2f1e080..b714647 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,6 +10,19 @@ authors = [ { name = "Adam Amer" }, ] license = { text = "MIT" } +dependencies = [ + "numpy~=1.26", +] + +[project.optional-dependencies] +pandas = [ + "pandas~=2.2", + "geopandas", + "pyarrow", +] +polars = [ + "polars", +] [tool.hatch.build.targets.wheel] packages = ["mesa_frames"] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index f45d0f0..0000000 --- a/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -geopandas == 0.14.1 -pandas == 2.1.4 -numpy == 1.26.3 -pyarrow == 16.1.0 \ No newline at end of file From dc41b47bb5f1542843691ffd71b09e046858c659 Mon Sep 17 00:00:00 2001 From: rht Date: Tue, 2 Jul 2024 03:17:53 -0400 Subject: [PATCH 2/2] ci: Add GA for tests (#17) * ci: Add GA for tests * Add typeguard and mesa dependency for .[dev] --- .github/workflows/build.yml | 61 +++++++++++++++++++++++++++++++++++++ pyproject.toml | 17 ++++++++--- 2 files changed, 73 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..96808a8 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,61 @@ +name: build + +on: + push: + branches: + - main + - release** + paths-ignore: + - '**.md' + pull_request: + paths-ignore: + - '**.md' + workflow_dispatch: + schedule: + - cron: '0 6 * * 1' + +# This will cancel previous run if a newer job that obsoletes the said previous +# run, is started. +# Based on https://github.com/zulip/zulip/commit/4a11642cee3c8aec976d305d51a86e60e5d70522 +concurrency: + group: "${{ github.workflow }}-${{ github.head_ref || github.run_id }}" + cancel-in-progress: true + +jobs: + build: + runs-on: ${{ matrix.os }}-latest + # We need an explicit timeout because sometimes the batch_runner test never + # completes. + timeout-minutes: 6 + strategy: + fail-fast: False + matrix: + os: [windows, ubuntu, macos] + python-version: ["3.12"] + include: + - os: ubuntu + python-version: "3.11" + - os: ubuntu + python-version: "3.10" + # Disabled for now. See https://github.com/projectmesa/mesa/issues/1253 + #- os: ubuntu + # python-version: 'pypy-3.8' + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + - name: Install uv + run: pip install uv + - name: Install mesa-frames + # See https://github.com/astral-sh/uv/issues/1945 + run: | + uv pip install --system .[dev] + - name: Test with pytest + run: pytest --durations=10 --cov=mesa_frames tests/ --cov-report=xml + - if: matrix.os == 'ubuntu' + name: Codecov + uses: codecov/codecov-action@v4 diff --git a/pyproject.toml b/pyproject.toml index b714647..05ac9ad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ 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" } dependencies = [ @@ -16,12 +16,19 @@ dependencies = [ [project.optional-dependencies] pandas = [ - "pandas~=2.2", - "geopandas", - "pyarrow", + "pandas~=2.2", + "geopandas", + "pyarrow", ] polars = [ - "polars", + "polars", +] +dev = [ + "mesa_frames[pandas,polars]", + "pytest", + "pytest-cov", + "typeguard", + "mesa", ] [tool.hatch.build.targets.wheel]