-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Packaging support; first steps towards PyPi
This will also let us fix readthedocs, since it cannot build our C++ code, but it _CAN_ install from pip.
- Loading branch information
Showing
6 changed files
with
105 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
FROM ubuntu:20.04 | ||
|
||
RUN apt update && \ | ||
DEBIAN_FRONTEND=noninteractive apt install -y python3 python3.8-venv python3.9 python3.9-venv python3-setuptools python3-pip git build-essential cmake wget python3.9-dev | ||
RUN cd /tmp \ | ||
&& wget https://github.com/Kitware/CMake/releases/download/v3.30.4/cmake-3.30.4-linux-x86_64.tar.gz \ | ||
&& tar -xf cmake-3.30.4-linux-x86_64.tar.gz \ | ||
&& cp -r cmake-3.30.4-linux-x86_64/bin/* /usr/local/bin/ \ | ||
&& cp -r cmake-3.30.4-linux-x86_64/man/* /usr/local/man/ \ | ||
&& cp -r cmake-3.30.4-linux-x86_64/share/* /usr/local/share/ | ||
|
||
COPY . /grgl_src | ||
|
||
ENV PATH="/grgl_src/Env38/bin:$PATH" | ||
# Build the Python 3.8 wheel | ||
RUN cd /grgl_src \ | ||
&& python3.8 -m venv Env38 \ | ||
&& pip3 install wheel \ | ||
&& GRGL_GSL=1 GRGL_BGEN=1 python setup.py bdist_wheel | ||
ENV PATH="/grgl_src/Env39/bin:$PATH" | ||
# Build the Python 3.9 wheel | ||
RUN cd /grgl_src \ | ||
&& python3.9 -m venv Env39 \ | ||
&& pip3 install wheel \ | ||
&& GRGL_GSL=1 GRGL_BGEN=1 python setup.py bdist_wheel | ||
# Copy to an easily accesible location | ||
RUN mkdir /output && cp /grgl_src/dist/*.whl /output/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM ubuntu:22.04 | ||
|
||
RUN apt update && \ | ||
DEBIAN_FRONTEND=noninteractive apt install -y python3.10 python3.10-venv python3.10-dev python3.11 python3.11-venv python3.11-dev python3-setuptools python3-pip git build-essential cmake wget | ||
|
||
COPY . /grgl_src | ||
|
||
ENV PATH="/grgl_src/Env310/bin:$PATH" | ||
# Build the Python 3.10 wheel | ||
RUN cd /grgl_src \ | ||
&& python3.10 -m venv Env310 \ | ||
&& pip3 install wheel \ | ||
&& GRGL_GSL=1 GRGL_BGEN=1 python setup.py bdist_wheel | ||
ENV PATH="/grgl_src/Env311/bin:$PATH" | ||
# Build the Python 3.11 wheel | ||
RUN cd /grgl_src \ | ||
&& python3.11 -m venv Env311 \ | ||
&& pip3 install wheel \ | ||
&& GRGL_GSL=1 GRGL_BGEN=1 python setup.py bdist_wheel | ||
# Copy to an easily accesible location | ||
RUN mkdir /output && cp /grgl_src/dist/*.whl /output/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Releasing new GRGL versions | ||
|
||
This outlines the steps for releasing a new GRGL version. | ||
|
||
## Version numbering | ||
|
||
Bug fixes and minor non-breaking changes do not require a version number bump. Yes, this means that folks who installed via `pip` will not get an updated version unless they `--force-reinstall` or remove and then reinstall. If the bug/change is significant, then bump the minor version. | ||
|
||
* Minor version number bump occurs for non-breaking changes. | ||
* Major version number bump occurs for breaking changes. Breaking changes are considered non-backwards-compatible file format changes or breaking changes to the Python API. Breaking changes are allowed to the C++ API without bumping the major version number. | ||
|
||
Steps: | ||
* Update `include/grgl/version.h` | ||
* Update `setup.py` to have the new version | ||
* After merging to `main` and ensuring all CI passes (and testing prior to that), run the steps for PyPi below | ||
|
||
## Packaging for PyPi | ||
|
||
Build the package distributions for PyPi. We build a source dist and then Linux binary distributions for recent Python versions. | ||
|
||
``` | ||
# Remove dist/ to start fresh | ||
rm -rf dist | ||
# Build the source distribution (for MacOS, mostly) | ||
python setup.py sdist | ||
# Build the Python3.8 and Python3.9 packages on an older Docker image | ||
docker build . -f Dockerfile.pkg1 -t grgl_pkg1:latest | ||
docker run -v $PWD/dist:/dist -it grgl_pkg1:latest bash -c "cp /output/*.whl /dist/" | ||
# Build the Python3.10+ packages on a newer Docker image | ||
docker build . -f Dockerfile.pkg2 -t grgl_pkg2:latest | ||
docker run -v $PWD/dist:/dist -it grgl_pkg2:latest bash -c "cp /output/*.whl /dist/" | ||
# Fix file permissions from Docker | ||
sudo chown ddehaas dist/*.whl | ||
sudo chgrp ddehaas dist/*.whl | ||
``` | ||
|
||
To upload to PyPi, ensure that your dist directory is clean (only has the packages you _just_ built), then upload via twine: | ||
``` | ||
python3 -m twine upload dist/* | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
breathe | ||
sphinx-rtd-theme | ||
pygrgl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
#define GRGL_MAJOR_VERSION 1 | ||
#define GRGL_MINOR_VERSION 0 | ||
#define GRGL_MINOR_VERSION 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters