Skip to content

Commit

Permalink
Merge pull request #6 from clinssen/v2.3.1-docs
Browse files Browse the repository at this point in the history
Cleanup and Docker image (release version 2.3.2)
  • Loading branch information
PierreSchnizer committed Dec 8, 2021
2 parents 793585c + a8167b1 commit ad33a72
Show file tree
Hide file tree
Showing 15 changed files with 15,566 additions and 15,610 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pygsl-ci.yml
Expand Up @@ -29,13 +29,13 @@ jobs:
- name: Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest numpy scipy matplotlib
python -m pip install pytest numpy scipy matplotlib wheel setuptools
python -m pip install pycodestyle
# Static code analysis
#- name: Static code style analysis
# run: |
# python3 extras/codeanalysis/check_copyright_headers.py && python3 -m pycodestyle $GITHUB_WORKSPACE -v --ignore=E241,E501,E303,E714,E713,E714,E252,W503 --exclude=$GITHUB_WORKSPACE/doc,$GITHUB_WORKSPACE/.github
# python3 -m pycodestyle $GITHUB_WORKSPACE -v --ignore=E241,E501,E303,E714,E713,E714,E252,W503 --exclude=$GITHUB_WORKSPACE/doc,$GITHUB_WORKSPACE/.github

- name: config
run: |
Expand Down
5 changes: 4 additions & 1 deletion ChangeLog
@@ -1,4 +1,7 @@
2016-04 Pierre Schnizer <schnizer@user.sourceforge.net>
v2.3.2 (2021-12) Charl Linssen <c.linssen@fz-juelich.de>
* Support for pip installing pygsl on Linux systems.

2016-04 Pierre Schnizer <schnizer@user.sourceforge.net>
* Started refurbishment of gsl sf interface generators
* Added sf tests: translated from gsl source
* Added interpolation2d
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Expand Up @@ -53,3 +53,4 @@ include MANIFEST.in
include MANIFEST
include COPYING

include testing/src/sf/sf.i
3 changes: 2 additions & 1 deletion README.rst
Expand Up @@ -66,10 +66,11 @@ PyGSL is installed to the Python packages path, and can be uninstalled by typing
Installation via PyPI
---------------------

PyGSL can also be installed using the pip package installer. Simply type:
PyGSL can also be installed using the pip package installer. This requires the Python packages ``setuptools`` and ``wheel`` to be already installed. Simply type:

.. code-block:: sh
python -m pip install setuptools wheel
python -m pip install pygsl
To remove PyGSL, use:
Expand Down
26 changes: 26 additions & 0 deletions doc/release_checklist.rst
@@ -0,0 +1,26 @@
Checklist for releasing a new version on PyPI
---------------------------------------------

- Adapt the version numbers in ``pygsl/_version.py`` and ``setup.cfg``

- Build the wheels

.. code-block:: sh
python setup.py sdist
- Do a test upload

.. code-block:: sh
twine upload --repository testpypi dist/*
- Try to install it from a docker image

.. code-block:: sh
python3 -m pip install --index-url https://test.pypi.org/simple/ pygsl
- Clone the repository and run the tests via pytest

- Happy? Push to non-testing repository
40 changes: 40 additions & 0 deletions docker/Dockerfile
@@ -0,0 +1,40 @@
FROM ubuntu:focal
LABEL maintainer="https://github.com/pygsl/pygsl"

ENV TERM=xterm \
TZ=Europe/Berlin \
DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential libtool automake autotools-dev \
nano \
swig \
libgsl-dev \
python3-dev \
python3-ipython \
python3-matplotlib \
python3-numpy \
python3-pip \
python3-scipy \
python3-setuptools \
cmake wget git curl && \
rm -rf /var/lib/apt/lists/* && \
update-alternatives --install /usr/bin/python python /usr/bin/python3 10 && \
update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 10

RUN python3 -m pip install --upgrade pip setuptools wheel pytest
#RUN python3 -m pip install --index-url https://test.pypi.org/simple/ pygsl
RUN python3 -m pip install pygsl

# add user 'user'
RUN adduser --disabled-login --gecos 'USER' --home /home/user user && \
chown user:user /home/user

# copy entrypoint to user home folder
COPY entrypoint.sh /home/user
RUN chown user:user /home/user/entrypoint.sh && \
chmod +x /home/user/entrypoint.sh

WORKDIR /home/user
USER user
ENTRYPOINT ["/home/user/entrypoint.sh"]
4 changes: 4 additions & 0 deletions docker/entrypoint.sh
@@ -0,0 +1,4 @@
#!/bin/bash

/bin/bash

2 changes: 1 addition & 1 deletion pygsl/_version.py
@@ -1 +1 @@
version = "2.3.1"
version = "2.3.2"
6 changes: 3 additions & 3 deletions setup.cfg
Expand Up @@ -7,15 +7,15 @@ doc_files = ChangeLog
TODO
doc/
examples/
requires = python >= 2.2, python-numeric, gsl >= 1.2
requires = python >= 3, python-numeric, gsl >= 1.2
build_requires = python-numeric-devel, gsl-devel >= 1.2
vendor = https://github.com/pygsl/pygsl
description = This project provides a python interface for the GNU scientific library (gsl).

[build_sphinx]
project = 'pygsl'
version = 2.3.1
release = 2.3.1
version = 2.3.2
release = 2.3.2

[egg_info]
tag_build =
Expand Down
47 changes: 34 additions & 13 deletions setup.py
Expand Up @@ -76,6 +76,7 @@
# Add the gsldist path
import os
pygsldir = os.path.dirname("__name__")

# Get the version information
versionfile = open(os.path.join(pygsldir, "pygsl", "_version.py"))
versiontext = versionfile.read()
Expand All @@ -88,21 +89,19 @@
gsldist_path = os.path.join(pygsldir, "gsl_dist")
sys.path.insert(0, gsldist_path)

from wheel.bdist_wheel import bdist_wheel as _bdist_wheel

#import distutils
#from distutils.core import setup, Extension
import setuptools
import setuptools.command
import setuptools.command.install
import setuptools.command.bdist_egg
from setuptools import setup, Extension

# used to read array object ... do not need that any more
# import gsl_numobj

from gsl_Extension import gsl_Extension
from swig_extension import SWIG_Extension as _SWIG_Extension
from swig_extension import SWIG_Extension_Nop as _SWIG_Extension_Nop

from distutils import sysconfig
#from common_objects import libpygsl



if USE_SWIG == 0:
Expand Down Expand Up @@ -160,7 +159,7 @@ def SWIG_Extension(*args, **kws):
pass
else:
assert(_has_gsl_config)
#Just checking that the module is there
#Just checking that the module is there
gsl_features

# now gsl_packages can be loaded. Using gsl_features only the available ones
Expand All @@ -172,9 +171,27 @@ def SWIG_Extension(*args, **kws):
del text
t_file.close()
del t_file



class CustomInstallCommand(setuptools.command.install.install):
def run(self):
# first re-generate GSL wrappers using SWIG
self.run_command('gsl_wrappers')
# then configure
self.run_command('config')
# then install
setuptools.command.install.install.run(self)
#super().run()

class CustomBdistWheelCommand(_bdist_wheel):
def run(self):
# first re-generate GSL wrappers using SWIG
self.run_command('gsl_wrappers')
# then configure
self.run_command('config')
# then install
_bdist_wheel.run(self)
#super().run()

py_module_names = ['errors',
'statistics.__init__',
Expand Down Expand Up @@ -222,19 +239,20 @@ def SWIG_Extension(*args, **kws):
headers = glob.glob("Include/pygsl/*.h")
gsldist = ['gsl_dist.' + os.path.basename(x)[:-3] for x in glob.glob("gsl_dist/*.py")]

py_modules = ['pygsl.' + x for x in py_module_names] + gsldist
py_modules = ['pygsl.' + x for x in py_module_names] + gsldist

if sys.version_info[0] <= 2:
exts = exts + extsOnly2
sys.stdout.write("Bulding for '%s'\n" %(sys.version,))


class gsl_Config_Path(gsl_Config.gsl_Config):
"""
Only required here to set the pygsl directory
"""
_pygsl_dir = pygsldir


print("#%d extension modules" %(len(exts),))

proj_name ="pygsl"
Expand All @@ -252,8 +270,10 @@ class gsl_Config_Path(gsl_Config.gsl_Config):
ext_package = 'pygsl',
ext_modules = exts,
headers = headers,
cmdclass = {'config' : gsl_Config_Path,
cmdclass = {'bdist_wheel': CustomBdistWheelCommand,
'config' : gsl_Config_Path,
'gsl_wrappers': gsl_CodeGenerator.gsl_CodeGenerator,
'install': CustomInstallCommand,
#'build_sphinx': BuildDoc
},
install_requires = ['numpy'],
Expand All @@ -262,5 +282,6 @@ class gsl_Config_Path(gsl_Config.gsl_Config):
'project': ('setup.py', proj_name),
'version': ('setup.py', version),
}
}
},
package_data={"pygsl": ["testing/src/sf/sf.i"]}
)
136 changes: 136 additions & 0 deletions testing/src/sf/sf.i
@@ -0,0 +1,136 @@
%module sf

#include <pygsl/pygsl_features_config.h>
%ignore gsl_sf_angle_restrict_pos_e; // use a double * for input and output. not properly recognized.
// use gsl_sf_angle_restricted_pos_err_e complies to the usual interface
%ignore gsl_sf_result_smash_e; // the only one to use a const pointer as input. Not recognized by the tool.


%include <gsl/gsl_sf_result.h>

//Deprecated functions
%ignore gsl_sf_coupling_6j_INCORRECT_e;
%ignore gsl_sf_coupling_6j_INCORRECT;

// Not a direct map
%ignore gsl_sf_polar_to_rect;
%ignore gsl_sf_rect_to_polar;

// Functions returning arrays are not mapped currently.

%ignore gsl_sf_gegenpoly_array;


%include <gsl/gsl_sf_airy.h>

%ignore gsl_sf_bessel_sequence_Jnu_e;
%ignore gsl_sf_bessel_Jn_array;
%ignore gsl_sf_bessel_Yn_array;
%ignore gsl_sf_bessel_In_array;
%ignore gsl_sf_bessel_In_scaled_array;
%ignore gsl_sf_bessel_Kn_array;
%ignore gsl_sf_bessel_Kn_scaled_array;
%ignore gsl_sf_bessel_jl_array;
%ignore gsl_sf_bessel_jl_steed_array;
%ignore gsl_sf_bessel_yl_array;
%ignore gsl_sf_bessel_il_scaled_array;
%ignore gsl_sf_bessel_kl_scaled_array;
%include <gsl/gsl_sf_bessel.h>
%include <gsl/gsl_sf_clausen.h>

%ignore gsl_sf_coulomb_wave_F_array;
%ignore gsl_sf_coulomb_wave_FG_array;
%ignore gsl_sf_coulomb_wave_FGp_array;
%ignore gsl_sf_coulomb_wave_sphF_array;
%ignore gsl_sf_coulomb_CL_array;
%include <gsl/gsl_sf_coulomb.h>

%include <gsl/gsl_sf_coupling.h>
%include <gsl/gsl_sf_dawson.h>
%include <gsl/gsl_sf_debye.h>
%include <gsl/gsl_sf_dilog.h>
%include <gsl/gsl_sf_elementary.h>
%include <gsl/gsl_sf_ellint.h>
%include <gsl/gsl_sf_elljac.h>
%include <gsl/gsl_sf_erf.h>
%include <gsl/gsl_sf_exp.h>
%include <gsl/gsl_sf_expint.h>
%include <gsl/gsl_sf_fermi_dirac.h>
%include <gsl/gsl_sf_gamma.h>
%include <gsl/gsl_sf_gegenbauer.h>
%include <gsl/gsl_sf_hyperg.h>
%include <gsl/gsl_sf_laguerre.h>
%include <gsl/gsl_sf_lambert.h>


%ignore gsl_sf_legendre_Pl_array;
%ignore gsl_sf_legendre_Pl_deriv_array;
%ignore gsl_sf_legendre_Plm_array;
%ignore gsl_sf_legendre_Plm_deriv_array;
%ignore gsl_sf_legendre_sphPlm_array;
%ignore gsl_sf_legendre_sphPlm_deriv_array;
%ignore gsl_sf_legendre_array_size;
%ignore gsl_sf_legendre_H3d_array;
%ignore gsl_sf_legendre_array;
%ignore gsl_sf_legendre_array_e;
%ignore gsl_sf_legendre_deriv_array_e;
%ignore gsl_sf_legendre_deriv_array;
%ignore gsl_sf_legendre_deriv_alt_array;
%ignore gsl_sf_legendre_deriv_alt_array_e;
%ignore gsl_sf_legendre_deriv2_array;
%ignore gsl_sf_legendre_deriv2_array_e;
%ignore gsl_sf_legendre_deriv2_alt_array;
%ignore gsl_sf_legendre_deriv2_alt_array_e;
%ignore gsl_sf_legendre_array_n;
%ignore gsl_sf_legendre_array_index;
%ignore gsl_sf_legendre_nlm;
%include <gsl/gsl_sf_legendre.h>
%include <gsl/gsl_sf_log.h>

/* */
#ifdef _PYGSL_GSL_HAS_SF_MATHIEU
%ignore gsl_sf_mathieu_ce_array;
%ignore gsl_sf_mathieu_se_array;
%ignore gsl_sf_mathieu_Mc_array;
%ignore gsl_sf_mathieu_Ms_array;
%ignore gsl_sf_mathieu_a_array;
%ignore gsl_sf_mathieu_b_array;
%ignore gsl_sf_mathieu_workspace;
%ignore gsl_sf_mathieu_free;
%ignore gsl_sf_mathieu_alloc;
%ignore gsl_sf_mathieu_a_coeff;
%ignore gsl_sf_mathieu_b_coeff;

%include <gsl/gsl_sf_mathieu.h>
#endif

/* */
%include <gsl/gsl_sf_pow_int.h>
%include <gsl/gsl_sf_psi.h>
%include <gsl/gsl_sf_synchrotron.h>
%include <gsl/gsl_sf_transport.h>
%include <gsl/gsl_sf_trig.h>
%include <gsl/gsl_sf_zeta.h>



// Complex Functions are wrapped manually.
//%ignore gsl_sf_complex_dilog_e; // polar to rect
//%ignore gsl_sf_lngamma_complex_e; // rect to polar
//%ignore gsl_sf_complex_log_e; // rect to polar
//%ignore gsl_sf_complex_sin_e; // rect to rect
//%ignore gsl_sf_complex_cos_e; // rect to rect
//%ignore gsl_sf_complex_logsin_e;



#define INLINE_DECL
%include <gsl/gsl_complex_math.h>
//%ignore gsl_complex_sqrt_real;
//%ignore gsl_complex_polar;
//%ignore gsl_complex_polar;

%ignore gsl_coerce_float;
%ignore gsl_coerce_long_double;
%include <gsl/gsl_sys.h>
%ignore gsl_coerce_float;

0 comments on commit ad33a72

Please sign in to comment.