Skip to content
Open
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
65 changes: 36 additions & 29 deletions .github/workflows/release-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,54 @@
name: Update release
name: Release

on:
push:
tags:
- 'v*.*.*'
pull_request:
branches:
- main
types:
- labeled
- opened
- edited
- synchronize
- reopened
push:
tags:
- "v*.*.*"
workflow_dispatch:

permissions:
contents: read

concurrency:
group: release-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
release:
build-and-publish:
runs-on: ubuntu-latest

steps:
- name: Cache dependencies
id: pip-cache
uses: actions/cache@v4
- name: Check out source
uses: actions/checkout@v6
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip
fetch-depth: 0

- name: Install dependencies
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
cache: "pip"

- name: Install build tooling
run: |
pip install --upgrade pip
pip install wheel twine
pip install "packaging>=24.2"
python -m pip install --upgrade pip
python -m pip install build twine setuptools-scm

- name: Show SCM-derived version
run: python -m setuptools_scm

- name: Checkout code
uses: actions/checkout@v3
- name: Build distributions
run: python -m build

- name: Build and publish to PyPI
if: ${{ github.event_name == 'push' }}
- name: Check built distributions
run: python -m twine check dist/*

- name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/v')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }}
run: |
python3 setup.py sdist bdist_wheel
ls dist/
tar tvf dist/dlclibrary-*.tar.gz
python3 -m twine upload dist/*
run: python -m twine upload --non-interactive dist/*
8 changes: 7 additions & 1 deletion dlclibrary/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@
#
# Licensed under GNU Lesser General Public License v3.0
#
from importlib.metadata import version, PackageNotFoundError

try:
__version__ = version("dlclibrary")
except PackageNotFoundError: # pragma: no cover
__version__ = "0+unknown"

VERSION = __version__
Comment thread
C-Achard marked this conversation as resolved.
from dlclibrary.dlcmodelzoo.modelzoo_download import (
download_huggingface_model,
get_available_datasets,
get_available_detectors,
get_available_models,
parse_available_supermodels,
)
from dlclibrary.version import __version__, VERSION
Empty file.
46 changes: 33 additions & 13 deletions dlclibrary/version.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
#
# DeepLabCut Toolbox (deeplabcut.org)
# © A. & M.W. Mathis Labs
# https://github.com/DeepLabCut/DeepLabCut
#
# Please see AUTHORS for contributors.
# https://github.com/DeepLabCut/DeepLabCut/blob/master/AUTHORS
#
# Licensed under GNU Lesser General Public License v3.0
#

__version__ = "0.0.12"
VERSION = __version__
# Backwards compatibility shim only. Consider deprecated.
import warnings

from . import __version__ as _PACKAGE_VERSION
from . import VERSION as _PACKAGE_VERSION_ALIAS

__all__ = ["__version__", "VERSION"]


def __getattr__(name):
if name == "__version__":
warnings.warn(
(
"'dlclibrary.version.__version__' is deprecated and will be removed "
"in a future release. Use 'dlclibrary.__version__' instead."
),
DeprecationWarning,
stacklevel=2,
)
return _PACKAGE_VERSION

if name == "VERSION":
warnings.warn(
(
"'dlclibrary.version.VERSION' is deprecated and will be removed "
"in a future release. Use 'dlclibrary.VERSION' instead."
),
DeprecationWarning,
stacklevel=2,
)
return _PACKAGE_VERSION_ALIAS

raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
47 changes: 47 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[build-system]
requires = [
"setuptools>=80",
"setuptools-scm>=8",
"wheel",
]
build-backend = "setuptools.build_meta"

[project]
name = "dlclibrary"
dynamic = ["version"]
description = "Lightweight library supporting universal functions for the DeepLabCut ecosystem"
readme = { file = "README.md", content-type = "text/markdown" }
authors = [
{ name = "The DeepLabCut team", email = "admin@deeplabcut.org" }
]
license = { text = "GNU Lesser General Public License v3.0" }
requires-python = ">=3.9"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
"Operating System :: OS Independent",
]
dependencies = [
"huggingface_hub>=0.11.1",
"ruamel.yaml>=0.15.0",
]

[project.urls]
Homepage = "https://github.com/DeepLabCut/DLClib"
Repository = "https://github.com/DeepLabCut/DLClib"

[tool.setuptools]
include-package-data = false
license-files = ["LICENSE", "NOTICE.yml"]

[tool.setuptools.packages.find]
include = ["dlclibrary*"]

[tool.setuptools.package-data]
"dlclibrary.dlcmodelzoo" = [
"*.yaml",
"*.json",
"superanimal_configs/*.yaml",
]

[tool.setuptools_scm]
2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

48 changes: 0 additions & 48 deletions setup.py

This file was deleted.