Skip to content

Commit

Permalink
Fix pypi action (#222)
Browse files Browse the repository at this point in the history
* force packaging upgrade to 24.2 for twine

* Bump version to 0.5.0rc2

* remove universal compatibility option

* revert tag

* adapt files to new wheel name due to py3
  • Loading branch information
stes authored Feb 3, 2025
1 parent bea2c04 commit c32ed67
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 13 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/release-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ jobs:
path: ~/.cache/pip
key: ${{ runner.os }}-pip

- name: Install dependencies
run: |
pip install --upgrade pip
pip install wheel
# NOTE(stes) see https://github.com/pypa/twine/issues/1216#issuecomment-2629069669
pip install "packaging>=24.2"
- name: Checkout code
uses: actions/checkout@v3

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ RUN make dist
FROM cebra-base

# install the cebra wheel
ENV WHEEL=cebra-0.5.0rc1-py2.py3-none-any.whl
ENV WHEEL=cebra-0.5.0rc1-py3-none-any.whl
WORKDIR /build
COPY --from=wheel /build/dist/${WHEEL} .
RUN pip install --no-cache-dir ${WHEEL}'[dev,integrations,datasets]'
Expand Down
2 changes: 1 addition & 1 deletion PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ build() {

package() {
cd $srcdir/${_pkgname}-${pkgver}
pip install --ignore-installed --no-deps --root="${pkgdir}" dist/${_pkgname}-${pkgver}-py2.py3-none-any.whl
pip install --ignore-installed --no-deps --root="${pkgdir}" dist/${_pkgname}-${pkgver}-py3-none-any.whl
find ${pkgdir} -iname __pycache__ -exec rm -r {} \; 2>/dev/null || echo
install -Dm 644 LICENSE.md $pkgdir/usr/share/licenses/${pkgname}/LICENSE
}
Expand Down
4 changes: 2 additions & 2 deletions docs/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,13 @@ Enter the build environment and build the package:
host $ make interact
docker $ make build
# ... outputs ...
Successfully built cebra-X.X.XaX-py2.py3-none-any.whl
Successfully built cebra-X.X.XaX-py3-none-any.whl
The built package can be found in ``dist/`` and can be installed locally with

.. code:: bash
pip install dist/cebra-X.X.XaX-py2.py3-none-any.whl
pip install dist/cebra-X.X.XaX-py3-none-any.whl
**Please do not distribute this package prior to the public release of the CEBRA repository, because it also
contains parts of the source code.**
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[build-system]
requires = [
"setuptools>=43",
"wheel"
"wheel",
"packaging>=24.2"
]
build-backend = "setuptools.build_meta"

Expand Down
2 changes: 1 addition & 1 deletion reinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ python3 -m pip install --upgrade build
python3 -m build --sdist --wheel .

# Reinstall the package with most recent version
pip install --upgrade --no-cache-dir "dist/cebra-${VERSION}-py2.py3-none-any.whl[datasets,integrations]"
pip install --upgrade --no-cache-dir "dist/cebra-${VERSION}-py3-none-any.whl[datasets,integrations]"
3 changes: 0 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,3 @@ dev =
# docformatter[tomli]
codespell
cffconvert

[bdist_wheel]
universal=1
4 changes: 2 additions & 2 deletions tools/build_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ FROM python:3.9
RUN python -m pip install --upgrade pip setuptools wheel \
&& apt-get update -y && apt-get install -y pandoc git
RUN pip install torch --extra-index-url=https://download.pytorch.org/whl/cpu
COPY dist/cebra-0.4.0-py2.py3-none-any.whl .
RUN pip install 'cebra-0.4.0-py2.py3-none-any.whl[docs]'
COPY dist/cebra-0.5.0rc1-py3-none-any.whl .
RUN pip install 'cebra-0.5.0rc1-py3-none-any.whl[docs]'
EOF

checkout_cebra_figures
Expand Down
8 changes: 6 additions & 2 deletions tools/bump_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ $SED_CMD "s/CEBRA_VERSION := .*/CEBRA_VERSION := ${version}/" Makefile
$SED_CMD "s/pkgver=.*/pkgver=${version}/" PKGBUILD

# Dockerfile
$SED_CMD "s/ENV WHEEL=cebra-.*\.whl/ENV WHEEL=cebra-${version}-py2.py3-none-any.whl/" Dockerfile
$SED_CMD "s/ENV WHEEL=cebra-.*\.whl/ENV WHEEL=cebra-${version}-py3-none-any.whl/" Dockerfile

# build_docs.sh
$SED_CMD "s/COPY dist\/cebra-.*-py3-none-any\.whl/COPY dist\/cebra-${version}-py3-none-any.whl/" tools/build_docs.sh
$SED_CMD "s/RUN pip install 'cebra-.*-py3-none-any\.whl/RUN pip install 'cebra-${version}-py3-none-any.whl/" tools/build_docs.sh

# Remove backup files
if [[ "$OSTYPE" == "darwin"* ]]; then
rm cebra/__init__.py.bkp reinstall.sh.bkp Makefile.bkp PKGBUILD.bkp Dockerfile.bkp
rm cebra/__init__.py.bkp reinstall.sh.bkp Makefile.bkp PKGBUILD.bkp Dockerfile.bkp tools/build_docs.sh.bkp
fi

0 comments on commit c32ed67

Please sign in to comment.