From 412f3487d75d7c5f72fddca2df71bd787c75c3d6 Mon Sep 17 00:00:00 2001 From: Jonathan Shi <149419494+sfc-gh-joshi@users.noreply.github.com> Date: Mon, 13 Jan 2025 16:06:46 -0800 Subject: [PATCH] SNOW-1877354: Add pyproject.toml and tox dev dependency (#2843) 1. Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR. Fixes SNOW-1877354 2. Fill out the following pre-review checklist: - [ ] I am adding a new automated test(s) to verify correctness of my new code - [ ] If this test skips Local Testing mode, I'm requesting review from @snowflakedb/local-testing - [ ] I am adding new logging messages - [ ] I am adding a new telemetry message - [ ] I am adding new credentials - [ ] I am adding a new dependency - [ ] If this is a new feature/behavior, I'm adding the Local Testing parity changes. - [x] I acknowledge that I have ensured my changes to be thread-safe. Follow the link for more information: [Thread-safe Developer Guidelines](https://github.com/snowflakedb/snowpark-python/blob/main/CONTRIBUTING.md#thread-safe-development) 3. Please describe how your code solves the related issue. As described in the linked JIRA, the `protoc-wheel-0` and `mypy-protobuf` dev dependencies must be installed _before_ `setup.py` is run, so a clean `pip install snowflake-snowpark-python[development]` will error if these packages were not installed beforehand. By adding `pyproject.toml` according to [these instructions](https://packaging.python.org/en/latest/guides/modernize-setup-py-project/#how-to-handle-additional-build-time-dependencies), we're able to specify these dependencies before `setup.py` is invoked, thereby removing the need to explicitly `pip install` those packages first. This can be verified by attempting to install the repository from a new conda environment, which fails on current main without first installing `protoc-wheel-0` and `mypy-protobuf`. This PR also incidentally adds `tox` as a dev dependency, as we use it frequently for testing environments. --- pyproject.toml | 7 +++++++ setup.py | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000000..6b87735de36 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,7 @@ +[build-system] +requires = [ + "setuptools", + "protoc-wheel-0==21.1", # Protocol buffer compiler for Snowpark IR + "mypy-protobuf", # used in generating typed Python code from protobuf for Snowpark IR +] +build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index 24f1dbe15ef..1ea499c6001 100644 --- a/setup.py +++ b/setup.py @@ -58,9 +58,8 @@ "graphviz", # used in plot tests "pytest-assume", # sql counter check "decorator", # sql counter check - "protoc-wheel-0==21.1", # Protocol buffer compiler, for Snowpark IR - "mypy-protobuf", # used in generating typed Python code from protobuf for Snowpark IR "lxml", # used in read_xml tests + "tox", # used for setting up testing environments ] # read the version