Closed pdiercks closed 1 year ago
Do you know if it is possible to build a c++ module with only pyproject.toml
? because as far as I remember, there is quite a bit of extra code in the setup.py
for the compilation of the package in dolfinx or in fenics-constitutive. Since we may want to add some functionality of fenics-constitutive in this package, we should keep this in mind
yes, I was also thinking about the c++ stuff. Currently, I would prefer to define metadata of the project via pyproject.toml
and move anything related to the build process to the conda recipe. The overall goal is the conda package isn't it? (as preferred/recommend way of installing fenicsxconcrete
)
I am not sure what's the best way to manage a package (that's pure python at the moment) but has non-python dependencies that cannot be installed via pip, so I would opt for the conda recipe as the most important file for defining this package and how it is build.
Looking at other packages (pymor) there seems to be some unavoidable redundancy (python project description (pyproject.toml
, setup.cfg
) but also the conda recipe, here .conda/meta.yaml
) when it comes to specifying dependencies.
Not sure if this is already working see this.
For a pure python package you do not need setup.py
and setup.cfg
. You could even use another backend like flit
instead of setuptools
. (As I understood PEP518 is basically about making it easier to use other backends that setuptools
)
Consider also this guide.
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
authors = [
{ name="Jörg F. Unger", email="joerg.unger@bam.de" },
]
classifiers = [
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
]
description = "Implementation of structural problems for concrete structures using FEniCSx"
license = {file = "LICENSE"}
name = "fenicsxconcrete"
readme = "REAMDE.md"
requires-python = ">=3.7"
version = "0.0.1"
[project.optional-dependencies]
tests = ["pytest", "coverage"]
[project.urls]
repository = "https://github.com/BAMresearch/FenicsXConcrete.git"
With this pyproject.toml
you shoud be able to pip install -e .
just fine, but this will install only fenicsxconcrete
and not its dependencies (none are listed here). Also, in the current setup.cfg
or setup.py
none of the dependencies are specified and the user would need to make sure that fenics is installed himself.
From my point of view, the essential question is how to resolve the dependencies and if these should automatically installed when one wants to install fenicsxconcrete
.
Options:
build.sh
to install eventual c++ stuff (using cmake). Use pip
to install the python part of fenicsxconcrete
with option --no-deps
. (see for example dolfinx-feedstock and the build scripts there)setuptools
and implement the logic how c++ coda is compiled via setup.py
(boils down to subprocess call to cmake
).With the second option the user could directly install c++ part and python part of the package with pip
, but would still need to manually install dependencies.
TL;DR we can just stick to setuptools
or use pyproject.toml
only. I just thought being in line with PEP518 would be a good thing to do.
I think it would be important, that the conda package installs all relevant dependencies.
yes, I think so too.
@eriktamsen , I think this can be closed?
With #26 merged, the conda package can be successfully build for now and the only sources of information are pyproject.toml
and .conda/meta.yaml
.
If we add c++ components in the future, the corresponding build instructions would go under .conda/build.sh
and .conda/meta.yaml
would be modified accordingly.
Hi All, I wanted to mention that there may be reasons for not using
setup.py
andsetup.cfg
and have a singlepyproject.toml
to manage the package. See e.g. PEP518 and note that "sticking withsetup.cfg
" is listed under the section "Rejected ideas". I am not an expert on this, but my guess would be that anything that is defined insetup.cfg
could also be specified viapyproject.toml
andsetup.py
should not be necessary at all.