Skip to content

Commit

Permalink
Merge pull request #203 from bluescarni/pr/sdist
Browse files Browse the repository at this point in the history
sdist
  • Loading branch information
bluescarni authored Dec 11, 2024
2 parents 93727f5 + 33d0041 commit 2084071
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 58 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/gh_actions_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@ jobs:
- uses: actions/checkout@v4
- name: Build
run: bash tools/gha_osx_heyoka_head_static.sh
manylinux228_x86_64-sdist:
runs-on: ubuntu-latest
container:
image: pagmo2/manylinux228_x86_64_with_deps:latest
env:
HEYOKA_PY_BUILD_TYPE: "Python312"
HEYOKA_PY_BUILD_SDIST: "yes"
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
steps:
- uses: actions/checkout@v4
- name: Build
run: bash tools/gha_manylinux.sh
- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
manylinux228_x86_64-py313:
runs-on: ubuntu-latest
container:
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if(NOT CMAKE_BUILD_TYPE)
FORCE)
endif()

project(heyoka.py VERSION 6.1.2 LANGUAGES CXX C)
project(heyoka.py VERSION 6.1.3 LANGUAGES CXX C)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/yacma")

Expand Down
9 changes: 9 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
Changelog
=========

6.1.3 (unreleased)
------------------

New
~~~

- Upload the source distribution to PyPI
(`#203 <https://github.com/bluescarni/heyoka.py/pull/203>`__).

6.1.2 (2024-10-10)
------------------

Expand Down
17 changes: 12 additions & 5 deletions doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ On the Python side, heyoka.py requires at least Python 3.5 and depends on:
* `NumPy <https://numpy.org/>`__ (version <2, **mandatory**),
* `cloudpickle <https://github.com/cloudpipe/cloudpickle>`__ (**mandatory**),
* `SymPy <https://www.sympy.org/en/index.html>`__ (version >=1.13.0) and `mpmath <https://mpmath.org/>`__
(*optional*, for converting heyoka.py expressions to/from SymPy expressions).
(*optional*, for converting heyoka.py expressions to/from SymPy expressions),
* `skyfield <https://rhodesmill.org/skyfield/>`__ (*optional*, needed by the
:ref:`SGP4 propagator <tut_sgp4_propagator>`).

The tested and supported CPU architectures at this time are x86-64, 64-bit ARM and 64-bit PowerPC.

Expand Down Expand Up @@ -58,16 +60,21 @@ your conda installation.
pip
^^^

A heyoka.py package for x86-64 Linux is available on `PyPI <https://pypi.org/project/heyoka/>`__.
You can install it via ``pip``:
heyoka.py packages are available on `PyPI <https://pypi.org/project/heyoka/>`__.
You can install them via ``pip``:

.. code-block:: console
$ pip install heyoka
.. warning::
We currently offer prebuilt binary wheels for x86-64 Linux, along with a source distribution (sdist).
When using the sdist for installation, you are responsible for managing the installation of the C++ dependencies.

We plan to add in the near future prebuilt wheels for additional operating systems and CPU architectures.

.. note::

heyoka.py relies on a stack of C++ dependencies which are bundled in the ``pip`` package.
heyoka.py relies on a stack of C++ dependencies which are bundled in the prebuilt binary wheels.
There is a non-negligible chance of conflicts with other packages which might also depend on and bundle
the same C++ libraries, which can lead to unpredictable runtime errors and hard-to-diagnose
issues.
Expand Down
39 changes: 21 additions & 18 deletions doc/notebooks/oppenheimer_volkoff.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@
"\n",
"The equations are then written as:\n",
"\n",
"$$\\Large\n",
"\\left\\{\n",
"\\begin{array}{ll}\n",
"$$\n",
"\\begin{cases}\n",
"\\frac{dx_0}{dh} &= -\\frac{2x_0 (1-2x_1)}{4\\pi x_0 P(h) + x_1}\\\\\n",
"\\frac{dx_1}{dh} &= \\left(2\\pi \\epsilon(h) - \\frac{x_1}{2x_0}\\right) \\frac{dx_0}{dh} \\\\\n",
"\\end{array}\\right. ,\n",
"\\end{cases},\n",
"$$\n",
"\n",
"where an equation of state is needed to define the pressure $P(h)$ and energy density $\\epsilon(h)$ expressions. \n",
Expand All @@ -47,19 +46,21 @@
"\n",
"where $\\rho$ is the (baryonic) mass density (following a [polytropic process](https://en.wikipedia.org/wiki/Polytropic_process)):\n",
"\n",
"$$\\Large\n",
"\\begin{array}{l}\n",
"\\rho = (\\frac{P}{K})^{1/\\Gamma} \\\\\n",
"\\epsilon = \\rho + P / (\\Gamma-1)\n",
"\\end{array}.\n",
"$$\n",
"\\begin{cases}\n",
"\\rho &= \\left(\\frac{P}{K}\\right)^{1/\\Gamma} \\\\\n",
"\\epsilon &= \\rho + \\frac{P}{\\Gamma-1}\n",
"\\end{cases}.\n",
"$$\n",
"\n",
"Hence, in this case the log-entalpy can be written as:\n",
"\n",
"$$\n",
"h = \\log\\left(1 + \\frac{\\Gamma}{\\Gamma-1} K^{\\frac 1\\Gamma} P^{1-\\frac 1\\Gamma}\\right),\n",
"$$\n",
"\n",
"which can be inverted to yield the $P(h)$ form:\n",
"\n",
"$$\n",
"P(h) = K^{-\\frac{1}{\\Gamma-1}}\\left[\\frac{\\Gamma-1}{\\Gamma}\\left(e^h-1\\right)\\right]^{\\frac{\\Gamma}{\\Gamma-1}}.\n",
"$$\n",
Expand Down Expand Up @@ -321,26 +322,28 @@
"source": [
"In order to obtain the expressions seeked, a variational equation for the initial value of the entalpy (the independent variable) $h_0$ is also needed. We thus introduce a last variable change $\\overline h_0 s = h$ so that the differential equations become:\n",
"\n",
"$$\\Large\n",
"\\left\\{\n",
"\\begin{array}{ll}\n",
"$$\n",
"\\begin{cases}\n",
"\\frac{dx_0}{ds} &= - \\overline h_0 \\frac{2x_0 (1-2x_1)}{4\\pi x_0 P(s) + x_1}\\\\\n",
"\\frac{dx_1}{ds} &= \\left(2\\pi \\epsilon(s) - \\frac{x_1}{2x_0}\\right) \\frac{dx_0}{ds} \\\\\n",
"\\end{array}\\right.,\n",
"\\end{cases},\n",
"$$\n",
"\n",
"with:\n",
"\n",
"$$\n",
"P(s) = K^{-\\frac{1}{\\Gamma-1}}\\left[\\frac{\\Gamma-1}{\\Gamma}\\left(e^{\\overline h_0 s}-1\\right)\\right]^{\\frac{\\Gamma}{\\Gamma-1}},\n",
"$$\n",
"\n",
"and:\n",
"$$\\Large\n",
"\\begin{array}{l}\n",
"\\rho(s) = \\left(\\frac{P(s)}{K}\\right)^{1/\\Gamma} \\\\\n",
"\\epsilon(s) = \\rho + P(s) / (\\Gamma-1)\n",
"\\end{array},\n",
"\n",
"$$\n",
"\\begin{cases}\n",
"\\rho(s) &= \\left(\\frac{P(s)}{K}\\right)^{1/\\Gamma} \\\\\n",
"\\epsilon(s) &= \\rho + \\frac{P(s)}{\\Gamma-1}\n",
"\\end{cases},\n",
"$$\n",
"\n",
"and must be integrated for $s \\in [1, 0]$, which will correspond to $h \\in [\\overline h_0, 0]$."
]
},
Expand Down
4 changes: 2 additions & 2 deletions doc/notebooks/tmap_pendulum.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"source": [
"# Jet transport in the simple pendulum\n",
"\n",
"In this tutorial, which is inspired by an [example](https://docs.sciml.ai/TaylorIntegration/stable/pendulum/) in the documentation of the [TaylorIntegration.jl package](https://docs.sciml.ai/TaylorIntegration/stable/), we will be using the [variational equations](<./var_ode_sys.ipynb>) to propagate a small neighbourhood of initial conditions in the [simple pendulum](https://en.wikipedia.org/wiki/Pendulum). This technique is called \"jet transport\" in the original example, in heyoka.py we call it {ref}`evaluation of the Taylor map <taylor_map>`.\n",
"In this tutorial, which is inspired by an [example](https://perezhz.github.io/TaylorIntegration.jl/stable/pendulum/) in the documentation of the [TaylorIntegration.jl package](https://perezhz.github.io/TaylorIntegration.jl/stable/), we will be using the [variational equations](<./var_ode_sys.ipynb>) to propagate a small neighbourhood of initial conditions in the [simple pendulum](https://en.wikipedia.org/wiki/Pendulum). This technique is called \"jet transport\" in the original example, in heyoka.py we call it {ref}`evaluation of the Taylor map <taylor_map>`.\n",
"\n",
"Let us begin with the formulation of the simple pendulum dynamics:"
]
Expand Down Expand Up @@ -256,7 +256,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.12.4"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[build-system]
build-backend = 'scikit_build_core.build'
requires = ['scikit-build-core', 'numpy >= 1.22, < 2']
requires = ['scikit-build-core', 'pybind11 >= 2.10', 'numpy >= 1.22, < 2']

[project]
name = 'heyoka'
version = '6.1.2'
version = '6.1.3'
description = "Python library for ODE integration via Taylor's method and LLVM"
readme = 'README.md'
requires-python = '>=3.5'
Expand Down
7 changes: 0 additions & 7 deletions tools/circleci_conda_heyoka_head_310.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,5 @@ cd ../tools

python ci_test_runner.py

cd $HEYOKA_PY_PROJECT_DIR

cd doc

# make html linkcheck doctest
make html doctest

set +e
set +x
7 changes: 0 additions & 7 deletions tools/circleci_conda_heyoka_head_39.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,5 @@ cd ../tools

python ci_test_runner.py

cd $HEYOKA_PY_PROJECT_DIR

cd doc

#make html linkcheck doctest
make html doctest

set +e
set +x
50 changes: 34 additions & 16 deletions tools/gha_manylinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,27 +70,45 @@ cmake -DHEYOKA_WITH_MPPP=yes \
-DCMAKE_BUILD_TYPE=Release ../;
make -j4 install

# Build the heyoka.py wheel.
cd ${GITHUB_WORKSPACE}
/opt/python/${PYTHON_DIR}/bin/pip wheel . -v
# Repair it.

# NOTE: this is temporary because some libraries in the docker
# image are installed in lib64 rather than lib and they are
# not picked up properly by the linker.
export LD_LIBRARY_PATH="/usr/local/lib64:/usr/local/lib"
auditwheel repair ./heyoka*.whl -w ./repaired_wheel
# Try to install it and run the tests.
unset LD_LIBRARY_PATH
cd /
/opt/python/${PYTHON_DIR}/bin/pip install ${GITHUB_WORKSPACE}/repaired_wheel/heyoka*
cd ${GITHUB_WORKSPACE}/tools
/opt/python/${PYTHON_DIR}/bin/python ci_test_runner.py
cd /

# Upload to PyPI.
if [[ "${HEYOKA_PY_RELEASE_BUILD}" == "yes" ]]; then
/opt/python/${PYTHON_DIR}/bin/pip install twine
/opt/python/${PYTHON_DIR}/bin/twine upload -u __token__ ${GITHUB_WORKSPACE}/repaired_wheel/heyoka*

if [[ "${HEYOKA_PY_BUILD_SDIST}" == "yes" ]]; then
# Build the heyoka.py sdist.
/opt/python/${PYTHON_DIR}/bin/python -m build . --sdist
# Try to install it and run the tests.
/opt/python/${PYTHON_DIR}/bin/pip install dist/heyoka*
cd ${GITHUB_WORKSPACE}/tools
/opt/python/${PYTHON_DIR}/bin/python ci_test_runner.py
cd /

# Upload to PyPI.
if [[ "${HEYOKA_PY_RELEASE_BUILD}" == "yes" ]]; then
/opt/python/${PYTHON_DIR}/bin/pip install twine
/opt/python/${PYTHON_DIR}/bin/twine upload -u __token__ ${GITHUB_WORKSPACE}/dist/heyoka*
fi
else
# Build the heyoka.py wheel.
/opt/python/${PYTHON_DIR}/bin/pip wheel . -v
# Repair it.
auditwheel repair ./heyoka*.whl -w ./repaired_wheel
# Try to install it and run the tests.
unset LD_LIBRARY_PATH
cd /
/opt/python/${PYTHON_DIR}/bin/pip install ${GITHUB_WORKSPACE}/repaired_wheel/heyoka*
cd ${GITHUB_WORKSPACE}/tools
/opt/python/${PYTHON_DIR}/bin/python ci_test_runner.py
cd /

# Upload to PyPI.
if [[ "${HEYOKA_PY_RELEASE_BUILD}" == "yes" ]]; then
/opt/python/${PYTHON_DIR}/bin/pip install twine
/opt/python/${PYTHON_DIR}/bin/twine upload -u __token__ ${GITHUB_WORKSPACE}/repaired_wheel/heyoka*
fi
fi

set +e
Expand Down

0 comments on commit 2084071

Please sign in to comment.