diff --git a/.gitignore b/.gitignore index 2481fb5df5..388d7380aa 100644 --- a/.gitignore +++ b/.gitignore @@ -85,9 +85,6 @@ tests/tools.mk tools/lib tools/version-info -## Python -python/setup.py - ## Fortran files diagnostics/Diagnostic_Fields_New.F90 preprocessor/check_options.F90 diff --git a/Makefile.in b/Makefile.in index 303a22b96e..8c10866c76 100755 --- a/Makefile.in +++ b/Makefile.in @@ -213,18 +213,6 @@ fltools: fluidity_library manual: @cd manual; $(MAKE) -python_build: -ifeq (@HAVE_PYTHON@,yes) - @echo " MAKE python" - @cd python; python3 setup.py build > build.log 2>&1 - @cd python/fluidity; find ../build/lib* -name '*.so' -exec ln -sf {} . \; -endif - -python_clean: - @echo " CLEAN python" - @cd python; rm -rf build - @cd python/fluidity; find . -type l -name '*.so' -exec rm -f {} \; - .PHONY: scripts scripts: @@ -232,7 +220,7 @@ scripts: @cd tools ; $(MAKE) scripts fluidity_library: lib/lib$(FLUIDITY).a -lib/lib$(FLUIDITY).a: $(OBJS) python_build sub_system scripts +lib/lib$(FLUIDITY).a: $(OBJS) sub_system scripts @echo "BUILD libfluidity" @echo " MKDIR lib" @mkdir -p lib diff --git a/configure b/configure index b8b8f3d150..f9d7cdd27e 100755 --- a/configure +++ b/configure @@ -17484,7 +17484,7 @@ printf "%s\n" "$ac_cv_path_GREP" >&6; } -ac_config_files="$ac_config_files Makefile debug/Makefile bathymetry/Makefile ocean_forcing/Makefile ocean_forcing/tests/Makefile sediments/Makefile population_balance/Makefile hyperlight/Makefile femtools/Makefile femtools/tests/Makefile forward_interfaces/Makefile horizontal_adaptivity/Makefile horizontal_adaptivity/tests/Makefile preprocessor/Makefile error_measures/Makefile error_measures/tests/Makefile parameterisation/Makefile parameterisation/tests/Makefile fldecomp/Makefile assemble/Makefile assemble/tests/Makefile diagnostics/Makefile main/Makefile tools/Makefile tools/version-info python/setup.py climatology/Makefile libmba2d/Makefile libmba3d/Makefile libjudy/Makefile libjudy/src/Makefile libjudy/src/JudyCommon/Makefile libjudy/src/Judy1/Makefile libjudy/src/JudyL/Makefile libjudy/src/JudySL/Makefile libjudy/src/JudyHS/Makefile libwm/Makefile libvtkfortran/Makefile tests/tools.mk" +ac_config_files="$ac_config_files Makefile debug/Makefile bathymetry/Makefile ocean_forcing/Makefile ocean_forcing/tests/Makefile sediments/Makefile population_balance/Makefile hyperlight/Makefile femtools/Makefile femtools/tests/Makefile forward_interfaces/Makefile horizontal_adaptivity/Makefile horizontal_adaptivity/tests/Makefile preprocessor/Makefile error_measures/Makefile error_measures/tests/Makefile parameterisation/Makefile parameterisation/tests/Makefile fldecomp/Makefile assemble/Makefile assemble/tests/Makefile diagnostics/Makefile main/Makefile tools/Makefile tools/version-info climatology/Makefile libmba2d/Makefile libmba3d/Makefile libjudy/Makefile libjudy/src/Makefile libjudy/src/JudyCommon/Makefile libjudy/src/Judy1/Makefile libjudy/src/JudyL/Makefile libjudy/src/JudySL/Makefile libjudy/src/JudyHS/Makefile libwm/Makefile libvtkfortran/Makefile tests/tools.mk" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure diff --git a/configure.in b/configure.in index 594a6621f2..59ede1ae0b 100644 --- a/configure.in +++ b/configure.in @@ -1859,7 +1859,6 @@ AC_CONFIG_FILES([Makefile main/Makefile tools/Makefile tools/version-info - python/setup.py climatology/Makefile libmba2d/Makefile libmba3d/Makefile diff --git a/docker/actions/Dockerfile.actions.noble b/docker/actions/Dockerfile.actions.noble index 08d68cdde4..9596c7235d 100644 --- a/docker/actions/Dockerfile.actions.noble +++ b/docker/actions/Dockerfile.actions.noble @@ -32,6 +32,7 @@ RUN test -z "$(git status --porcelain */Makefile.dependencies)" RUN make RUN make fltools RUN make manual +RUN sudo make install # Python module 'assess' is required for some longtests RUN python3 -m pip install --break-system-packages assess diff --git a/manual/examples.tex b/manual/examples.tex index 304a4441b2..31bf718bb8 100644 --- a/manual/examples.tex +++ b/manual/examples.tex @@ -175,7 +175,8 @@ \subsection{Results} Alternatively the results can be plotted using python. An example python script using pylab and the vtktools python module, is provided with this example. The vtktools module is located in -\texttt{\fluiditysourcepath/python/}; this path needs to be added to the \texttt{PYTHONPATH} environment +\texttt{\fluiditysourcepath/python/}. It will be available in the default Python installation after +fluidity is installed; alternatively, this path can be added to the \texttt{PYTHONPATH} environment variable. As can be seen in the numerical result using the CG method leads, to over and diff --git a/manual/python.tex b/manual/python.tex index b252c8a9f3..fa2d968c60 100644 --- a/manual/python.tex +++ b/manual/python.tex @@ -33,9 +33,10 @@ \section{System requirements} \lstinline[language=Bash]+python-numpy+ package. \fluidity\ also requires access to its own Python modules which are stored in -the python directory in the \fluidity\ source tree. To ensure that these are -visible to \fluidity\ at runtime, users should add this directory to the -\lstinline[language=Bash]+PYTHONPATH+ environment variable. For example:\ +the python directory in the \fluidity\ source tree. These will be installed +to the default Python installation along with Fluidity, but users can add this +directory to the \lstinline[language=Bash]+PYTHONPATH+ environment variable. +For example:\ \begin{lstlisting}[language=Bash] export PYTHONPATH=/python/:$PYTHONPATH \end{lstlisting}%$ diff --git a/python/pyproject.toml b/python/pyproject.toml new file mode 100644 index 0000000000..9d942cb0e9 --- /dev/null +++ b/python/pyproject.toml @@ -0,0 +1,43 @@ +[build-system] +requires = ["setuptools>=61.0", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "fluidity" +version = "0.2" +description = "Fluidity python files" +requires-python = ">=3.8" +authors = [ + {name = "Patrick Farrell"}, + {name = "Stephan Kramer"} +] +maintainers = [ + {name = "Ben Fulton"}, +] +license = {text = "See LICENSE file"} +classifiers = [ + "Development Status :: 5 - Production", + "Intended Audience :: Science/Research", + "License :: Other/Proprietary License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering", +] + +[project.urls] +Homepage = "https://fluidity-project.org" +Documentation = "https://figshare.com/articles/journal_contribution/Fluidity_Manual/1387713?file=2031637" +Repository = "https://github.com/FluidityProject/fluidity" +Issues = "https://github.com/FluidityProject/fluidity/issues" + +[tool.setuptools] +packages = ["fluidity", "fluidity.diagnostics"] +py-modules = ["fluidity_tools", "vtktools"] + +[tool.setuptools.package-dir] +fluidity = "fluidity" diff --git a/python/setup.py b/python/setup.py new file mode 100644 index 0000000000..606849326a --- /dev/null +++ b/python/setup.py @@ -0,0 +1,3 @@ +from setuptools import setup + +setup() diff --git a/python/setup.py.in b/python/setup.py.in deleted file mode 100644 index ff1cee0c20..0000000000 --- a/python/setup.py.in +++ /dev/null @@ -1,21 +0,0 @@ -from distutils.core import setup -from distutils.extension import Extension -import os -import os.path - -try: - destdir = os.environ["DESTDIR"] -except KeyError: - destdir = "" - -setup( - name='fluidity', - version='0.1', - description="Fluidity python files", - author = "The ICOM team", - author_email = "patrick.farrell06@imperial.ac.uk", - url = "http://amcg.ese.ic.ac.uk", - packages = ['fluidity', 'fluidity.diagnostics'], - package_dir = {'fluidity': 'fluidity'}, - py_modules = ['fluidity_tools', 'vtktools'] - )