Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

use setuptools/setuptools-scm #18

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions .github/workflows/publish-library.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ jobs:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
- name: Release
env:
FLIT_PASSWORD: ${{ secrets.PYPI_TOKEN }}
- name: Build and check package
run: |
pip install tox
RELEASE_VERSION=${GITHUB_REF#refs/*/}
RELEASE_VERSION=${RELEASE_VERSION#v*}
sed -i "s/^version = .*/version = \"${RELEASE_VERSION}\"/" pyproject.toml
tox -e publish
tox -e build,twinecheck
- name: Upload package
if: github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ test

# Virtual Env
venv/
.venv/

# Mac personalization files
*.DS_Store

Expand All @@ -30,3 +32,6 @@ tests/protos/*

# Sphinx generated files
_build/


/caikit/_version.py
1 change: 1 addition & 0 deletions caikit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@

# Expose model management at the top level
from .core import extract, get_model_future, load, module, resolve_and_load, train
from .version import __version__, __version_tuple__
7 changes: 7 additions & 0 deletions caikit/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# pylint: disable=unused-import
try:
# Local
from ._version import __version__, __version_tuple__
except ImportError:
__version__ = "unknown"
version_tuple = (0, 0, __version__)
14 changes: 9 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
[build-system]
requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"
requires = ["setuptools>=60", "setuptools-scm>=8.0"]

[project]
name = "caikit"
# Not the actual current version: overwritten by CI
version = "0.0.1"
dynamic = ["version"]
description = "AI toolkit that enables AI users to consume stable task-specific model APIs and enables AI developers build algorithms and models in a modular/composable framework"
license = {text = "Apache-2.0"}
readme = "README.md"
requires-python = ">=3.8"
classifiers=[
"License :: OSI Approved :: Apache Software License"
]

dependencies = [
"alchemy-config>=1.1.1,<2.0.0",
"alchemy-logging>=1.0.4,<2.0.0",
Expand Down Expand Up @@ -91,6 +88,13 @@ all-dev = [
"caikit[all, dev-test, dev-docs, dev-fmt, dev-build]"
]

[tool.setuptools.packages.find]
where = [""]
include = ["caikit", "caikit*"]

[tool.setuptools_scm]
write_to = "caikit/_version.py"

[project.urls]
Source = "https://github.com/caikit/caikit"

Expand Down
23 changes: 9 additions & 14 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,16 @@ allowlist_externals = ./scripts/check_deps.sh

[testenv:build]
description = build wheel
extras = dev-build
passenv =
FLIT_PASSWORD
setenv =
FLIT_USERNAME = __token__
commands = flit build
deps =
build
setuptools
commands = python -m build
skip_install = True

[testenv:publish]
description = publish wheel to pypi
extras = dev-build
passenv =
FLIT_PASSWORD
setenv =
FLIT_USERNAME = __token__
commands = flit publish
[testenv:twinecheck]
description = check wheel
deps = twine
commands = twine check dist/*

# Ensure compatibility is maintained with protobuf 3.X
[testenv:proto3]
Expand Down