diff --git a/.conda/meta.yaml b/.conda/meta.yaml new file mode 100644 index 0000000000..b5f9bca17c --- /dev/null +++ b/.conda/meta.yaml @@ -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') }} diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 895c42cd68..959346817c 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/publish.yml similarity index 55% rename from .github/workflows/release.yml rename to .github/workflows/publish.yml index 37446c9c46..4d6f61199c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/publish.yml @@ -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 @@ -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 @@ -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