This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch TINKERPOP-3199 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 0d70ef3d19baa5b18425af37319d6d36b795c97f Author: Ken Hu <[email protected]> AuthorDate: Fri Oct 10 15:37:36 2025 -0700 TINKERPOP-3199 Updated build system to work with setuptools>=60 Moved from setup.py and setup.cfg to pyproject.toml to conform to current Python build setup. Version needs to be manually set now as scripts aren't allowed to run during build process. Decided this was best for now but could move to setuptools-scm later to make it more automated like it was before. --- docs/src/dev/developer/release.asciidoc | 2 + gremlin-python/docker-compose.yml | 11 +-- gremlin-python/pom.xml | 6 +- .../src/main/python/gremlin_python/__init__.py | 1 + gremlin-python/src/main/python/pyproject.toml | 76 ++++++++++++++++++ gremlin-python/src/main/python/setup.cfg | 22 ------ gremlin-python/src/main/python/setup.py | 91 ---------------------- 7 files changed, 84 insertions(+), 125 deletions(-) diff --git a/docs/src/dev/developer/release.asciidoc b/docs/src/dev/developer/release.asciidoc index 6788a7b5c5..57a1d719c1 100644 --- a/docs/src/dev/developer/release.asciidoc +++ b/docs/src/dev/developer/release.asciidoc @@ -147,6 +147,7 @@ deployment. . `docker/build.sh -t -i -n` . `bin/publish-docs.sh <username>` - note that under a release candidate the documentation is published as SNAPSHOT . `mvn versions:set -DnewVersion=xx.yy.zz -DgenerateBackupPoms=false` to update the project files to reference a non-SNAPSHOT version +.. Manually update the `__version__` for `gremlin-python` in `gremlin-python/src/main/python/gremlin_python/__init__.py` . `mvn clean install -DskipTests` to update GLV versions .. Review `Gremlin.Net.csproj`, `Gremlin.Net.Template.csproj` and `Gremlin.Net.Template.nuspec` in `gremlin-dotnet` .. Review `package.json` and `package-lock.json` in `gremlin-javascript` and in `gremlint` @@ -156,6 +157,7 @@ deployment. . `git tag -a -m "TinkerPop xx.yy.zz release" xx.yy.zz` and `git push --tags` . `mvn clean install` . `mvn versions:set -DnewVersion=xx.yy.zz-SNAPSHOT -DgenerateBackupPoms=false` to go back to SNAPSHOT +.. Manually update the `__version__` for `gremlin-python` in `gremlin-python/src/main/python/gremlin_python/__init__.py` to a dev version like `xx.yy.zz.dev1` . `mvn clean install -DskipTests` to update GLV versions .. Review `Gremlin.Net.csproj`, `Gremlin.Net.Template.csproj` and `Gremlin.Net.Template.nuspec` in `gremlin-dotnet` .. Review `package.json` and `package-lock.json` in `gremlin-javascript` and in `gremlint` diff --git a/gremlin-python/docker-compose.yml b/gremlin-python/docker-compose.yml index 9b5172e519..a1f17c5b88 100644 --- a/gremlin-python/docker-compose.yml +++ b/gremlin-python/docker-compose.yml @@ -62,7 +62,6 @@ services: - GREMLIN_SERVER_URL_HTTP=http://gremlin-server-test-python:{}/ - GREMLIN_SERVER_BASIC_AUTH_URL_HTTP=https://gremlin-server-test-python:{}/ - KRB_HOSTNAME=${KRB_HOSTNAME:-gremlin-server-test} - - VERSION=${VERSION} - GREMLIN_SOCKET_SERVER_URL=ws://gremlin-socket-server-python:{}/gremlin - GREMLIN_SOCKET_SERVER_CONFIG_PATH=/python_app/gremlin-socket-server/conf/test-ws-gremlin.yaml working_dir: /python_app @@ -71,9 +70,9 @@ services: && echo 'password' | kinit stephen && klist && pip install wheel radish-bdd PyHamcrest aenum isodate kerberos - && python3 ./setup.py build - && python3 ./setup.py test - && python3 ./setup.py install + && pip install -e .[test] + && pytest + && pip install . && radish -f dots -e -t -b ./radish ./gremlin-test --user-data='serializer=application/vnd.gremlin-v3.0+json' && radish -f dots -e -t -b ./radish ./gremlin-test --user-data='serializer=application/vnd.graphbinary-v1.0'; EXIT_CODE=$$?; chown -R `stat -c "%u:%g" .` .; exit $$EXIT_CODE" @@ -87,10 +86,8 @@ services: volumes: - ${PACKAGE_DIR:-./src/main/python}:/python_package working_dir: /python_package - environment: - - VERSION=${VERSION} command: > - bash -c "python3 setup.py sdist bdist_wheel; + bash -c "pip install build && python -m build; EXIT_CODE=$$?; chown -R `stat -c "%u:%g" .` .; exit $$EXIT_CODE" gremlin-socket-server: diff --git a/gremlin-python/pom.xml b/gremlin-python/pom.xml index 223ca9c326..0c910dc5cf 100644 --- a/gremlin-python/pom.xml +++ b/gremlin-python/pom.xml @@ -123,9 +123,7 @@ limitations under the License. </configuration> </execution> <!-- - build/package python source distribution and wheel archive. the version is bound to an - environment variable that gets used in setup.py to dynamically construct a module - __version__file + build/package python source distribution and wheel archive. --> <execution> <id>package-py</id> @@ -137,7 +135,6 @@ limitations under the License. <target> <exec executable="docker" failonerror="true"> <env key="PACKAGE_DIR" value="${project.build.directory}/python-packaged"/> - <env key="VERSION" value="${project.version}"/> <env key="PYTHONPATH" value=""/> <arg line="compose up --build --abort-on-container-exit gremlin-python-package"/> </exec> @@ -168,7 +165,6 @@ limitations under the License. <skip>${skipTests}</skip> <target> <exec executable="docker" failonerror="true"> - <env key="VERSION" value="${project.version}"/> <env key="PYTHONPATH" value=""/> <env key="GREMLIN_SERVER" value="${project.version}"/> <env key="ABS_PROJECT_HOME" value="${project.basedir}/../"/> diff --git a/gremlin-python/src/main/python/gremlin_python/__init__.py b/gremlin-python/src/main/python/gremlin_python/__init__.py index af990d3088..b7502b6210 100644 --- a/gremlin-python/src/main/python/gremlin_python/__init__.py +++ b/gremlin-python/src/main/python/gremlin_python/__init__.py @@ -18,3 +18,4 @@ # __author__ = 'Marko A. Rodriguez (http://markorodriguez.com)' +__version__ = '3.7.5.dev1' diff --git a/gremlin-python/src/main/python/pyproject.toml b/gremlin-python/src/main/python/pyproject.toml new file mode 100644 index 0000000000..4410d5082f --- /dev/null +++ b/gremlin-python/src/main/python/pyproject.toml @@ -0,0 +1,76 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +[build-system] +requires = ["setuptools>=60", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "gremlinpython" +dynamic = ["version"] +description = "Gremlin-Python for Apache TinkerPop" +readme = {file = "README.rst", content-type = "text/x-rst"} +license = {text = "Apache 2"} +maintainers = [{name = "Apache TinkerPop", email = "[email protected]"}] +requires-python = ">=3.9" +dependencies = [ + "nest_asyncio", + "aiohttp>=3.8.0,<4.0.0", + "aenum>=1.4.5,<4.0.0", + "isodate>=0.6.0,<1.0.0", + "async-timeout>=4.0.3,<5.0.0" +] +classifiers = [ + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Natural Language :: English", + "Programming Language :: Python :: 3" +] + +[project.urls] +Homepage = "https://tinkerpop.apache.org" + +[project.optional-dependencies] +kerberos = ["kerberos>=1.3.0,<2.0.0"] +ujson = ["ujson>=2.0.0"] +test = [ + "pytest>=4.6.4,<7.2.0", + "radish-bdd==0.13.4", + "PyHamcrest>=1.9.0,<3.0.0", + "PyYAML>=5.3" +] + +[tool.pytest.ini_options] +addopts = "--junitxml=./python-reports/TEST-native-python.xml -sv" +norecursedirs = [".*", "build", "dist", "CVS", "_darcs", "{arch}", "*.egg", "lib", "lib64"] +testpaths = ["tests"] + +[tool.setuptools.dynamic] +version = {attr = "gremlin_python.__version__"} + +[tool.setuptools.package-data] +"*" = ["LICENSE", "NOTICE"] + +[tool.setuptools] +packages = [ + "gremlin_python", + "gremlin_python.driver", + "gremlin_python.driver.aiohttp", + "gremlin_python.process", + "gremlin_python.structure", + "gremlin_python.structure.io" +] \ No newline at end of file diff --git a/gremlin-python/src/main/python/setup.cfg b/gremlin-python/src/main/python/setup.cfg deleted file mode 100644 index d63f2e1510..0000000000 --- a/gremlin-python/src/main/python/setup.cfg +++ /dev/null @@ -1,22 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -[aliases] -test=pytest - -[tool:pytest] -addopts = --junitxml=./python-reports/TEST-native-python.xml -sv -norecursedirs = '.*', 'build', 'dist', 'CVS', '_darcs', '{arch}', '*.egg' lib lib64 diff --git a/gremlin-python/src/main/python/setup.py b/gremlin-python/src/main/python/setup.py deleted file mode 100644 index 3fce91c278..0000000000 --- a/gremlin-python/src/main/python/setup.py +++ /dev/null @@ -1,91 +0,0 @@ -""" -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. -""" -import codecs -import os -import time -from setuptools import setup - -# Folder containing the setup.py -root = os.path.dirname(os.path.abspath(__file__)) - -# Path to __version__ module -version_file = os.path.join(root, 'gremlin_python', '__version__.py') - -# Check if this is a source distribution. -# If not create the __version__ module containing the version -if not os.path.exists(os.path.join(root, 'PKG-INFO')): - timestamp = int(os.getenv('TIMESTAMP', time.time() * 1000)) / 1000 - fd = codecs.open(version_file, 'w', 'utf-8') - fd.write("'''") - fd.write(__doc__) - fd.write("'''\n") - fd.write('version = %r\n' % os.getenv('VERSION', '999.999.999.dev0').replace('-SNAPSHOT', '.dev-%d' % timestamp)) - fd.write('timestamp = %d\n' % timestamp) - fd.close() -# Load version -from gremlin_python import __version__ - -version = __version__.version - -install_requires = [ - 'nest_asyncio', - 'aiohttp>=3.8.0,<4.0.0', - 'aenum>=1.4.5,<4.0.0', - 'isodate>=0.6.0,<1.0.0', - 'async-timeout>=4.0.3,<5.0.0' -] - -setup( - name='gremlinpython', - version=version, - packages=['gremlin_python', 'gremlin_python.driver', - 'gremlin_python.driver.aiohttp', 'gremlin_python.process', - 'gremlin_python.structure', 'gremlin_python.structure.io'], - license='Apache 2', - url='https://tinkerpop.apache.org', - description='Gremlin-Python for Apache TinkerPop', - maintainer='Apache TinkerPop', - maintainer_email='[email protected]', - long_description=codecs.open("README.rst", "r", "UTF-8").read(), - long_description_content_type='text/x-rst', - test_suite="tests", - data_files=[("", ["LICENSE", "NOTICE"])], - setup_requires=[ - 'pytest-runner==6.0.0', - 'importlib-metadata<5.0.0' - ], - tests_require=[ - 'pytest>=4.6.4,<7.2.0', - 'radish-bdd==0.13.4', - 'PyHamcrest>=1.9.0,<3.0.0', - 'PyYAML>=5.3' - ], - install_requires=install_requires, - extras_require={ - 'kerberos': 'kerberos>=1.3.0,<2.0.0', # Does not install in Microsoft Windows - 'ujson': 'ujson>=2.0.0' - }, - classifiers=[ - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Natural Language :: English", - "Programming Language :: Python :: 3" - ], - python_requires='>=3.9' -)
