Skip to content

Commit

Permalink
Remove setup.cfg and pyscaffold. Use pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
andmat900 committed Sep 30, 2024
1 parent 46fab6f commit 8c83cea
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 149 deletions.
31 changes: 0 additions & 31 deletions python/requirements.txt

This file was deleted.

103 changes: 0 additions & 103 deletions python/setup.cfg

This file was deleted.

49 changes: 34 additions & 15 deletions python/setup.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,42 @@
# -*- coding: utf-8 -*-
"""Setup file for etos_api.
"""Setup file for etos-api."""
from setuptools import setup
from setuptools_scm.version import get_local_dirty_tag

Use setup.cfg to configure your project.

This file was generated with PyScaffold 3.2.3.
PyScaffold helps you to put up the scaffold of your new Python project.
Learn more under: https://pyscaffold.org/
"""
import sys
def version_scheme(version) -> str:
"""Get version component for the current commit.
from pkg_resources import VersionConflict, require
from setuptools import setup
Used by setuptools_scm.
"""
if version.tag and version.distance == 0:
# If the current commit has a tag, use the tag as version, regardless of branch.
# Note: Github CI creates releases from detached HEAD, not from a particular branch.
return f"{version.tag}"
elif version.branch == "main" and version.tag and version.distance > 0:
# For untagged commits on the release branch always add a distance like ".post3"
return f"{version.tag}.post{version.distance}"
else:
# For non-release branches, mark the version as dev and distance:
return f"{version.tag}.dev{version.distance}"


def local_scheme(version) -> str:
"""Get local version component for the current Git commit.
Used by setuptools_scm.
"""
# If current version is dirty, always add dirty suffix, regardless of branch.
dirty_tag = get_local_dirty_tag(version) if version.dirty else ""
if dirty_tag:
return f"{dirty_tag}.{version.node}"

try:
require("setuptools>=38.3")
except VersionConflict:
print("Error: version of setuptools is too old (<38.3)!")
sys.exit(1)
if version.distance == 0:
# If the current commit has a tag, do not add a local component, regardless of branch.
return ""
# For all other cases, always add the git reference (like "g7839952")
return f"+{version.node}"


if __name__ == "__main__":
setup(use_pyscaffold=True)
setup()

0 comments on commit 8c83cea

Please sign in to comment.