Skip to content

Commit

Permalink
Generate version with setuptools_scm and migrate to pyproject.toml (#…
Browse files Browse the repository at this point in the history
…4799)

* Generate version with setuptools_scm and migrate to pyproject.toml

Signed-off-by: Kevin Su <[email protected]>

* nit

Signed-off-by: Kevin Su <[email protected]>

* nit

Signed-off-by: Kevin Su <[email protected]>

* nit

Signed-off-by: Kevin Su <[email protected]>

* nit

Signed-off-by: Kevin Su <[email protected]>

* add tag rege

Signed-off-by: Kevin Su <[email protected]>

* update makefile

Signed-off-by: Kevin Su <[email protected]>

* update flyteidl-release.yml

Signed-off-by: Kevin Su <[email protected]>

* package-data

Signed-off-by: Kevin Su <[email protected]>

---------

Signed-off-by: Kevin Su <[email protected]>
  • Loading branch information
pingsutw authored Feb 6, 2024
1 parent 7abb38a commit 6a2ce3f
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 55 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/flyteidl-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Set version in python package
run: |
# from refs/tags/v1.2.3 get 1.2.3
VERSION=$(echo $GITHUB_REF | sed 's#.*/v##')
VERSION=$VERSION make update_pyversion
shell: bash
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
Expand Down
6 changes: 0 additions & 6 deletions flyteidl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,8 @@ doc_gen_deps:
doc-requirements.txt: doc-requirements.in install-piptools
$(call PIP_COMPILE,doc-requirements.in)

PLACEHOLDER := "__version__\ =\ \"0.0.0+develop\""
PLACEHOLDER_NPM := \"version\": \"0.0.0-develop\"

.PHONY: update_pyversion
update_pyversion:
grep "$(PLACEHOLDER)" "setup.py"
sed -i "s/$(PLACEHOLDER)/__version__ = \"${VERSION}\"/g" "setup.py"

.PHONY: update_npmversion
update_npmversion:
grep "$(PLACEHOLDER_NPM)" "package.json"
Expand Down
78 changes: 78 additions & 0 deletions flyteidl/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
[build-system]
requires = ["setuptools", "setuptools_scm"]
build-backend = "setuptools.build_meta"

[project]
name = "flyteidl"
dynamic = ["version"]
authors = [{ name = "Flyte Contributors", email = "[email protected]" }]
description = "IDL for Flyte Platform"
license = { text = "Apache-2.0" }
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.8,<3.13"
dependencies = [
'googleapis-common-protos',
'protoc_gen_swagger',
'protobuf>=4.21.1,<5.0.0'
# Packages in here should rarely be pinned. This is because these
# packages (at the specified version) are required for project
# consuming this library. By pinning to a specific version you are the
# number of projects that can consume this or forcing them to
# upgrade/downgrade any dependencies pinned here in their project.
#
# Generally packages listed here are pinned to a major version range.
#
# e.g.
# Python FooBar package for foobaring
# pyfoobar>=1.0, <2.0
#
# This will allow for any consuming projects to use this library as
# long as they have a version of pyfoobar equal to or greater than 1.x
# and less than 2.x installed.
]
classifiers = [
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Software Development",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules"
]

[project.urls]
Homepage = "https://github.com/flyteorg/flyte/tree/master/flyteidl"

[tool.setuptools_scm]
root = "../"
tag_regex = '^(?:[\w-]+/)?(?P<version>[vV]?\d+(?:\.\d+){0,2}[^\+]*)(?:\+.*)?$'

# https://github.com/pypa/setuptools/issues/3136 describes an extension to
# setuptools that would involve a simpler way to specify this, but while
# that does not happen we have to package the pyi files manually like so:
[tool.setuptools.package-data]
flyteidl = ["*.pyi", "**/*pyi"]

[tool.setuptools.packages.find]
include = ["gen/pb_python/*"]
exclude = [
"_templates",
"tmp",
"boilerplate",
"clients",
"docs",
"jsonschema",
"protos",
"scripts",
"gen/pb-cpp",
"gen/pb-go",
"gen/pb-java",
"gen/pb-js",
"gen/pb-rust",
]
44 changes: 1 addition & 43 deletions flyteidl/setup.py
Original file line number Diff line number Diff line change
@@ -1,45 +1,3 @@
from setuptools import setup, find_packages

__version__ = "0.0.0+develop"

setup(
name='flyteidl',
version=__version__,
description='IDL for Flyte Platform',
url='https://github.com/flyteorg/flyte/tree/master/flyteidl',
long_description=open("README.md", encoding="utf-8").read(),
long_description_content_type="text/markdown",
maintainer='FlyteOrg',
maintainer_email='[email protected]',
packages=find_packages('gen/pb_python'),
package_dir={'': 'gen/pb_python'},
# https://github.com/pypa/setuptools/issues/3136 describes an extension to
# setuptools that would involve a simpler way to specify this, but while
# that does not happen we have to package the pyi files manually like so:
package_data={'flyteidl': ["*.pyi", "**/*.pyi"]},
dependency_links=[],
install_requires=[
'googleapis-common-protos',
'protoc_gen_swagger',
'protobuf>=4.21.1,<5.0.0',
# Packages in here should rarely be pinned. This is because these
# packages (at the specified version) are required for project
# consuming this library. By pinning to a specific version you are the
# number of projects that can consume this or forcing them to
# upgrade/downgrade any dependencies pinned here in their project.
#
# Generally packages listed here are pinned to a major version range.
#
# e.g.
# Python FooBar package for foobaring
# pyfoobar>=1.0, <2.0
#
# This will allow for any consuming projects to use this library as
# long as they have a version of pyfoobar equal to or greater than 1.x
# and less than 2.x installed.
],
extras_require={
':python_version=="2.7"': ['typing>=3.6'], # allow typehinting PY2
},
license='Apache-2.0',
)
setup()

0 comments on commit 6a2ce3f

Please sign in to comment.