Skip to content

Commit

Permalink
Migrate setup.py to pyproject.toml (thoth-station#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChandanChainani committed Oct 22, 2022
1 parent 8c93a47 commit 57ec808
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 80 deletions.
20 changes: 20 additions & 0 deletions _custom_build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from setuptools import Extension
from setuptools.command.build_py import build_py as _build_py

class build_py(_build_py):
def run(self):
self.run_command("build_ext")
return super().run()

def initialize_options(self):
super().initialize_options()
if self.distribution.ext_modules == None:
self.distribution.ext_modules = []

self.distribution.ext_modules.append(
Extension(
"termial_random.random",
sources=["termial_random/random.c"],
extra_compile_args=["-std=c17", "-lm"],
)
)
33 changes: 33 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "termial-random"
description = "Extensions to standard Python's heapq for performance applications"
authors = [
{ name="Fridolin Pokorny", email="[email protected]" },
]
license = {text = "GPLv3+"}
readme = "README.rst"
dynamic = ["version"]

[tool.setuptools.dynamic]
version = {attr = "termial_random.__version__"}

[tool.setuptools]
py-modules = ["_custom_build"]
packages = ["termial_random"]

[tool.setuptools.cmdclass]
build_py = "_custom_build.build_py"

[tool.setuptools.exclude-package-data]
termial_random = ["*.c"]

[tool.pytest.ini_options]
minversion = "6.0"
addopts = "-l -s -vvv"
testpaths = [
"tests",
]
5 changes: 5 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[pytest]
minversion = 6.0
addopts = -l -s -vvv
testpaths =
tests
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[metadata]
url = "https://github.com/thoth-station/termial-random"
download_url = "https://pypi.org/project/termial-random"
80 changes: 0 additions & 80 deletions setup.py

This file was deleted.

0 comments on commit 57ec808

Please sign in to comment.