Skip to content

Commit

Permalink
feat: Adds conda recipe & corresponding CI jobs (#1414)
Browse files Browse the repository at this point in the history
  • Loading branch information
frgfm authored Feb 6, 2024
1 parent 98cd0e9 commit 13dd377
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 6 deletions.
49 changes: 49 additions & 0 deletions .conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{% set pyproject = load_file_data('../pyproject.toml', from_recipe_dir=True) %}
{% set project = pyproject.get('project') %}
{% set urls = pyproject.get('project', {}).get('urls') %}
{% set version = environ.get('BUILD_VERSION', '0.8.0a0') %}
package:
name: {{ project.get('name') }}
version: {{ version }}

source:
fn: {{ project.get('name') }}-{{ version }}.tar.gz
url: ../dist/{{ project.get('name') }}-{{ version }}.tar.gz

build:
noarch: python
script: python setup.py install --single-version-externally-managed --record=record.txt

requirements:
host:
- python>=3.8, <4.0
- setuptools

run:
- importlib_metadata
- numpy >=1.16.0, <2.0.0
- scipy >=1.4.0, <2.0.0
- pillow >=9.2.0
- matplotlib >=3.1.0
- h5py >=3.1.0, <4.0.0
- opencv >=4.5.0, <5.0.0
- pypdfium2_helpers >=4.0.0, <5.0.0
- pyclipper >=1.2.0, <2.0.0
- shapely >=1.6.0, <3.0.0
- langdetect >=1.0.9, <2.0.0
- rapidfuzz >=3.0.0, <4.0.0
- matplotlib >=3.1.0
- weasyprint >=55.0
- defusedxml >=0.7.0
- mplcursors >=0.3
- unidecode >=1.0.0
- tqdm >=4.30.0
- huggingface_hub >=0.20.0

about:
home: {{ urls.get('repository') }}
license: Apache 2.0
license_file: {{ project.get('license', {}).get('file') }}
summary: {{ project.get('description') | replace(":", " -")}}
doc_url: {{ urls.get('documentation') }}
dev_url: {{ urls.get('repository') }}
19 changes: 19 additions & 0 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,22 @@ jobs:
pip install -e .[torch] --upgrade
- name: Import package
run: python -c "import doctr; print(doctr.__version__)"

conda:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: 3.8
- name: Install dependencies
shell: bash -el {0}
run: conda install -y conda-build conda-verify anaconda-client
- name: Build and publish
shell: bash -el {0}
run: |
python setup.py sdist
mkdir conda-dist
conda build .conda/ -c conda-forge -c pypdfium2-team -c bblanchon --output-folder conda-dist
ls -l conda-dist/noarch/*tar.bz2
54 changes: 48 additions & 6 deletions .github/workflows/release.yml → .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: pypi-publish
name: publish

on:
release:
types: [published]

jobs:

pypi-publish:
runs-on: ${{ matrix.os }}
pypi:
if: "!github.event.release.prerelease"
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.8"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python
Expand Down Expand Up @@ -44,14 +44,14 @@ jobs:
twine upload dist/*
pypi-check:
needs: pypi
if: "!github.event.release.prerelease"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.8"]
needs: pypi-publish
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
Expand All @@ -64,3 +64,45 @@ jobs:
python -m pip install --upgrade pip
pip install python-doctr
python -c "import doctr; print(doctr.__version__)"
conda:
if: "!github.event.release.prerelease"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: 3.8
- name: Install dependencies
shell: bash -el {0}
run: conda install -y conda-build conda-verify anaconda-client
- name: Get release tag
id: release_tag
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Build and publish
shell: bash -el {0}
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
VERSION: ${{ steps.release_tag.outputs.VERSION }}
run: |
echo "BUILD_VERSION=${VERSION}" >> $GITHUB_ENV
python setup.py sdist
mkdir conda-dist
conda build .conda/ -c conda-forge -c pypdfium2-team -c bblanchon --output-folder conda-dist
ls -l conda-dist/noarch/*tar.bz2
anaconda upload conda-dist/noarch/*tar.bz2
conda-check:
if: "!github.event.release.prerelease"
runs-on: ubuntu-latest
needs: conda
steps:
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: 3.8
- name: Install package
shell: bash -el {0}
run: |
conda install -c mindee doctr

0 comments on commit 13dd377

Please sign in to comment.