Skip to content

Commit

Permalink
Merge pull request #216 from opendatahub-io/use-setuptools
Browse files Browse the repository at this point in the history
proposal: use setuptools/setuptools_scm for building
  • Loading branch information
gabe-l-hart committed Oct 17, 2023
2 parents 9a66789 + 56f09ea commit b750bd7
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 28 deletions.
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 }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,4 @@ prompt_prefixes
sample_prompt
transformers_cache
generated_interfaces
/caikit_nlp/_version.py
1 change: 1 addition & 0 deletions caikit_nlp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from .data_model import *
from .modules import *
from .resources import *
from .version import __version__, __version_tuple__

# Configure the library with library-specific configuration file
CONFIG_PATH = os.path.realpath(
Expand Down
7 changes: 7 additions & 0 deletions caikit_nlp/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: 10 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[build-system]
requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"
requires = [
"setuptools>=60",
"setuptools-scm>=8.0"]

[project]
name = "caikit-nlp"
# Not the actual current version: overwritten by CI
version = "0.0.1"
dynamic = ["version"]
description = "Caikit NLP"
license = {text = "Apache-2.0"}
readme = "README.md"
Expand Down Expand Up @@ -35,5 +35,11 @@ dependencies = [
"peft@git+https://github.com/huggingface/peft.git#8c17d556a8fe9522e10d73d7bd3fad46a6ecae14"
]

[tool.setuptools]
packages = ["caikit_nlp"]

[tool.setuptools_scm]
version_file = "caikit_nlp/_version.py"

[project.urls]
Source = "https://github.com/caikit/caikit-nlp"
28 changes: 12 additions & 16 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,17 @@ description = lint with pylint
deps = pylint>=2.16.2,<3.0
commands = pylint caikit_nlp

[testenv:publish]
description = publish wheel to pypi
deps = flit==3.8
passenv =
FLIT_PASSWORD
setenv =
FLIT_USERNAME = __token__
commands = flit publish
skip_install = True

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

[testenv:twinecheck]
description = check wheel
deps =
twine
commands = twine check dist/*
skip_install = True

0 comments on commit b750bd7

Please sign in to comment.