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

feat: Adds conda recipe & corresponding CI jobs #1414

Merged
merged 17 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from 13 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
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:
felixdittrich92 marked this conversation as resolved.
Show resolved Hide resolved
- 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
felixdittrich92 marked this conversation as resolved.
Show resolved Hide resolved
- 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.5.0
frgfm marked this conversation as resolved.
Show resolved Hide resolved

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') }}
20 changes: 20 additions & 0 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,23 @@ 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
frgfm marked this conversation as resolved.
Show resolved Hide resolved
python-version: 3.9
- 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}
frgfm marked this conversation as resolved.
Show resolved Hide resolved
run: |
echo "BUILD_VERSION=0.8.0a0" | cut -c 2- >> $GITHUB_ENV
python setup.py sdist
mkdir conda-dist
conda build .conda/ -c conda-forge -c pypdfium2-team -c bblanchon --output-folder conda-dist
felixdittrich92 marked this conversation as resolved.
Show resolved Hide resolved
ls -l conda-dist/noarch/*tar.bz2
50 changes: 44 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,41 @@ 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: Build and publish
shell: bash -el {0}
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
run: |
echo "BUILD_VERSION=${GITHUB_REF#refs/*/}" | cut -c 2- >> $GITHUB_ENV
python setup.py sdist
mkdir conda-dist
Copy link
Contributor

Choose a reason for hiding this comment

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

calling setup.py directly is deprecated, you'll want something like python -m build --sdist instead
see also https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html

Copy link
Contributor

Choose a reason for hiding this comment

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

@frgfm ? :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh I didn't know, thanks mara!
But for this PR, I don't think we need the edit:

  • we'd have to do this for the other occurrences in the repo (feels like a standalone PR to me, and we should check backward compatibility)
  • it will be deprecated but it's still working to the best of my understanding right?

Copy link
Contributor

Choose a reason for hiding this comment

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

it will be deprecated but it's still working to the best of my understanding right?

Yes, for the time being. They might want to remove it after some deprecation period, but I don't know if they'll ever do, as this somehow doesn't seem to have reached the crowd at large.

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
Loading