Skip to content

Commit

Permalink
Add pyproject stub for poetry
Browse files Browse the repository at this point in the history
Try to init scaffolding according to a github commit:

python-poetry/poetry#2740 (comment)
  • Loading branch information
steffeneemagine committed May 14, 2024
1 parent 0eb1ab3 commit ed8e9a8
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 16 deletions.
14 changes: 13 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,16 @@ wheel
htmlcov/*
.coverage
dist/*
.vscode/*

# Ignore lock file, it is meant to be an library
poetry.lock

# All tmp and build is meant to be ignored
*tmp*/
*build*/

# setup.py is created by poetry
setup.py

# Compilation results
python/libeep/pyeep.so
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ endif()
##########
# python #
##########
add_subdirectory(python/v2)
add_subdirectory(python/v3)
add_subdirectory(python/libeep/v2)
add_subdirectory(python/libeep/v3)

if(UNIX)
find_library(Math m)
Expand Down
16 changes: 16 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import subprocess
from pathlib import Path
from typing import Any


def build(setup_kwargs: Any) -> None:
build_dir = Path("./build-cmake")
build_dir.mkdir(exist_ok=True)

subprocess.check_call(["cmake", ".."], cwd=build_dir)
subprocess.check_call(["cmake", "--build", ".", "--config", "Release"], cwd=build_dir)

# copy the resulting files to the python package
libeep_dir = Path("./python/libeep")
for library_file in (build_dir / "python/libeep/v3/").glob("pyeep*"):
library_file.replace(libeep_dir / library_file.name)
25 changes: 25 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[tool.poetry]
name = "tool-libeep"
version = "0.1.0"
description = ""
authors = ["Steffen Heimes <sheimes@ant-neuro.com>"]
readme = "README.md"

packages = [
{ include = "libeep", from = "python" },
]

[tool.poetry.dependencies]
python = "^3.9"

[tool.poetry.build]
script = "build.py"
generate-setup-file = true

[tool.poetry.group.test.dependencies]
pytest = "^8.1.1"

[build-system]
# 1.5.2 required for https://github.com/python-poetry/poetry/issues/7505
requires = ['setuptools>=65.4.1', 'wheel', 'cmake>=3.29.2' , "poetry-core>=1.5.2"]
build-backend = "poetry.core.masonry.api"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 0 additions & 13 deletions setup.py

This file was deleted.

0 comments on commit ed8e9a8

Please sign in to comment.