Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade pip3 #986

Merged
merged 10 commits into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 27 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,25 @@ jobs:
xcode: "12.5.1"
# resource_class: macos.x86.medium.gen2
working_directory: ~/ocrd-core
environment:
PIP: pip3
PYTHON: python3
steps:
- checkout
- run: HOMEBREW_NO_AUTO_UPDATE=1 brew install imagemagick geos
- run: make deps-test install PIP=pip3
- run: make test benchmark PYTHON=python3
- run: make install
- run: make deps-test test benchmark

test-python36:
docker:
- image: python:3.6.15
working_directory: ~/ocrd-core
steps:
- checkout
- run: apt-get -y update
- run: pip install -U pip
- run: make deps-ubuntu install
- run: make deps-test test benchmark

test-python37:
docker:
Expand All @@ -23,8 +37,8 @@ jobs:
steps:
- checkout
- run: apt-get -y update
- run: make deps-ubuntu deps-test install
- run: make test benchmark
- run: make deps-ubuntu install
- run: make deps-test test benchmark

test-python38:
docker:
Expand All @@ -33,8 +47,8 @@ jobs:
steps:
- checkout
- run: apt-get -y update
- run: make deps-ubuntu deps-test install
- run: make test benchmark
- run: make deps-ubuntu install
- run: make deps-test test benchmark

test-python39:
docker:
Expand All @@ -43,8 +57,8 @@ jobs:
steps:
- checkout
- run: apt-get -y update
- run: make deps-ubuntu deps-test install
- run: make test benchmark
- run: make deps-ubuntu install
- run: make deps-test test benchmark

test-python310:
docker:
Expand All @@ -53,8 +67,8 @@ jobs:
steps:
- checkout
- run: apt-get -y update
- run: make deps-ubuntu deps-test install
- run: make test benchmark
- run: make deps-ubuntu install
- run: make deps-test test benchmark

test-python311:
docker:
Expand All @@ -63,8 +77,8 @@ jobs:
steps:
- checkout
- run: apt-get -y update
- run: make deps-ubuntu deps-test install
- run: make test benchmark
- run: make deps-ubuntu install
- run: make deps-test test benchmark

deploy:
docker:
Expand All @@ -90,6 +104,7 @@ workflows:
only: master
test-pull-request:
jobs:
- test-python36
- test-python37
- test-python38
- test-python39
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Docker Image CI

on:
push:
branches: [ "master" ]
workflow_dispatch: # run manually

jobs:

build:

runs-on: ubuntu-latest
permissions:
packages: write
contents: read

steps:
- uses: actions/checkout@v3
- # Activate cache export feature to reduce build time of images
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build the Docker image
run: make docker DOCKER_TAG=ghcr.io/ocrd/core
- name: Build the Docker image with GPU support
run: make docker-cuda DOCKER_TAG=ghcr.io/ocrd/core-cuda
#- name: Authenticate with ghcr.io
# run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push images to Github Container Registry
run: |
docker push ghcr.io/ocrd/core:latest
docker push ghcr.io/ocrd/core-cuda:latest

3 changes: 2 additions & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ checks:
python: true

build:
image: default-bionic
nodes:
analysis:
dependencies:
override:
- make deps-ubuntu
- sudo make deps-ubuntu
- make install
tests:
override:
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ENV DEBIAN_FRONTEND noninteractive
ENV PYTHONIOENCODING utf8
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
ENV PIP=pip3

WORKDIR /build-ocrd
COPY ocrd ./ocrd
Expand All @@ -31,7 +32,7 @@ RUN apt-get update && apt-get -y install software-properties-common \
sudo \
git \
&& make deps-ubuntu \
&& pip install --upgrade pip setuptools \
&& pip3 install --upgrade pip setuptools \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did try that already, that fixes this problem. But I stil fail locally to get opencv built.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgrading to a container which is based on Ubuntu > 18.04 would also have solved the problem because then python3-pip installs /usr/bin/pip, too.

&& make install \
&& apt-get remove -y gcc \
&& apt-get autoremove -y \
Expand Down
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export

SHELL = /bin/bash
PYTHON = python
PIP = pip
PYTHON ?= python
PIP ?= pip
LOG_LEVEL = INFO
PYTHONIOENCODING=utf8
TESTDIR = tests
Expand Down Expand Up @@ -55,7 +55,7 @@ DOCKER_BASE_IMAGE = ubuntu:20.04
DOCKER_ARGS =

# pip install command. Default: $(PIP_INSTALL)
PIP_INSTALL = pip install
PIP_INSTALL = $(PIP) install

# Dependencies for deployment in an ubuntu/debian linux
deps-ubuntu:
Expand All @@ -69,17 +69,19 @@ deps-test:
# (Re)install the tool
install:
$(PIP) install -U pip wheel setuptools fastentrypoints
@# speedup for end-of-life builds
if $(PYTHON) -V | fgrep -e 3.5 -e 3.6; then $(PIP) install --prefer-binary -U opencv-python-headless numpy; fi
for mod in $(BUILD_ORDER);do (cd $$mod ; $(PIP_INSTALL) .);done
@# workaround for shapely#1598
$(PIP) install --no-binary shapely --force-reinstall shapely

# Install with pip install -e
install-dev: uninstall
$(MAKE) install PIP_INSTALL="pip install -e"
$(MAKE) install PIP_INSTALL="$(PIP) install -e"

# Uninstall the tool
uninstall:
for mod in $(BUILD_ORDER);do pip uninstall -y $$mod;done
for mod in $(BUILD_ORDER);do $(PIP) uninstall -y $$mod;done

# Regenerate python code from PAGE XSD
generate-page: GDS_PAGE = ocrd_models/ocrd_models/ocrd_page_generateds.py
Expand Down
2 changes: 1 addition & 1 deletion ocrd_utils/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ Pillow >= 7.2.0
numpy
atomicwrites >= 1.3.0
importlib_metadata;python_version<'3.8'
importlib_resources;python_version<'3.8'
importlib_resources;python_version<'3.9'
frozendict>=2.3.4