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

Migrate to our new Python standard + fix many subtle issues #47

Merged
merged 45 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
e91b5d1
Use standard .gitignore from toptal
benoit74 Jul 14, 2023
6afd9a9
Fail get_js_deps script on download / unzip errors
benoit74 Jul 14, 2023
e043236
Migration version info to __about__.py to match standard
benoit74 Jul 14, 2023
6caf0d4
Migrate to pyproject.toml + hatch instead of setuptools
benoit74 Jul 14, 2023
222727d
Add pre-commit configuration
benoit74 Jul 14, 2023
a2fabb1
Fix simple issues raised by ruff
benoit74 Jul 14, 2023
bc5785d
Fix subtle issues raised by pyright / ruff
benoit74 Jul 14, 2023
e1686d0
Adapt CHANGELOG + fix typo
benoit74 Jul 14, 2023
1777e57
Add QA worfklow + publish on releases only, to PyPi in addition to Do…
benoit74 Jul 14, 2023
8a87e34
WIP
benoit74 Jul 18, 2023
b74cdaf
Use str instead of as_posix
benoit74 Jul 20, 2023
ae2372c
Source version from appropriate new file
benoit74 Jul 21, 2023
05fb7a6
Fix Dockerfile for new build system
benoit74 Jul 21, 2023
9d1daaa
Remove obsolete file
benoit74 Jul 21, 2023
22c3b88
Upgrade Zimscraperlib to 3.1.1 + remove useless code
benoit74 Jul 21, 2023
fc7c085
Fix computation of nb_threads and nb_processes
benoit74 Jul 21, 2023
e35f35e
Fail early if it looks like JS dependencies are not available
benoit74 Jul 21, 2023
20d6102
Revert useless modifications
benoit74 Jul 21, 2023
41ccf93
Rewrite tmp_dir usage to avoid many calls to go() function
benoit74 Jul 21, 2023
a233ee8
Only one read_from_zip makes more sense
benoit74 Jul 21, 2023
7d408dd
Read directly from the files
benoit74 Jul 21, 2023
fb341f7
Use major Github actions versions
benoit74 Jul 21, 2023
dae158f
Add missing 'check' dependency to CI
benoit74 Jul 21, 2023
7c83e23
Fix missleading names in CI
benoit74 Jul 21, 2023
6552dba
Fix publishing CI
benoit74 Jul 21, 2023
2d61850
Fix favicon / illustrations handling to not downscale then upscale
benoit74 Jul 21, 2023
f48532b
Truncate description and add truncated long description
benoit74 Jul 21, 2023
c28dc12
zimscraperlib now supports datetime + this avoids formating issue
benoit74 Jul 21, 2023
d755683
Images must be squared
benoit74 Jul 21, 2023
977aaff
Fix changelog
benoit74 Jul 21, 2023
7186e5f
Enhance ZIM description handling and add support long description
benoit74 Jul 24, 2023
2000d7e
Add tests for description/long-description computations (including fo…
benoit74 Jul 24, 2023
33cab63
Fix wrong method for items
benoit74 Jul 24, 2023
f69c68a
Move code back to its original position, should not have been moved
benoit74 Jul 24, 2023
f6ede9f
Simplify ensure_js_deps_are_present
benoit74 Jul 24, 2023
0a4082d
Ensure assets are not downloaded twice at build time
benoit74 Jul 24, 2023
69200e4
Adapt to Python bootstrap changes
benoit74 Jul 24, 2023
6896f31
Update pyright to 1.1.318
benoit74 Jul 24, 2023
aa794c2
Fix few quality issues
benoit74 Jul 24, 2023
e57b03d
Make it clear why we need hatchling in dev environment
benoit74 Jul 24, 2023
319d9f9
Use build instead of hatch
benoit74 Jul 25, 2023
2673c68
Small fixes / change revert following review
benoit74 Jul 25, 2023
dfaf970
Simplify code + add support for seting only the long description
benoit74 Jul 25, 2023
b005ed2
Fix CHANGELOG to add latest changes
benoit74 Jul 25, 2023
9e4a610
Use today() as it is already used somewhere else and sufficient
benoit74 Jul 25, 2023
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
29 changes: 0 additions & 29 deletions .github/workflows/docker.yml

This file was deleted.

52 changes: 52 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build and upload to PyPI

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-22.04
permissions:
id-token: write # mandatory for PyPI trusted publishing

steps:
- uses: actions/[email protected]

- name: Set up Python 3.11
uses: actions/[email protected]
with:
python-version: "3.11"
architecture: x64

- name: Build packages
run: |
pip install -U pip build
python -m build sdist wheel

- name: Upload to PyPI
uses: pypa/[email protected]
# dont specify anything for Trusted Publishing
benoit74 marked this conversation as resolved.
Show resolved Hide resolved
# https://docs.pypi.org/trusted-publishers
# with:
# # Using token
# user: __token__
# password: ${{ secrets.PYPI_API_TOKEN }}
#
# # Using token on test index
# password: ${{ secrets.PYPI_TEST_API_TOKEN }}
# repository_url: https://test.pypi.org/legacy/

- name: Build and push Docker image
uses: openzim/docker-publish-action@v10
with:
image-name: openzim/kolibri
on-master: dev
tag-pattern: /^v([0-9.]+)$/
latest-on-tag: true
restrict-to: openzim/kolibri
registries: ghcr.io
credentials: GHCRIO_USERNAME=${{ secrets.GHCR_USERNAME }}
benoit74 marked this conversation as resolved.
Show resolved Hide resolved
GHCRIO_TOKEN=${{ secrets.GHCR_TOKEN }}
repo_description: auto
repo_overview: auto
10 changes: 10 additions & 0 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Pull Request
benoit74 marked this conversation as resolved.
Show resolved Hide resolved

on:
pull_request:

jobs:
qa:
uses: ./.github/workflows/qa.yml
# run qa job if the pull request originates from a fork (otherwise the qa is already triggered by the push to a branch)
if: github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
8 changes: 8 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: Push

on:
push:

jobs:
qa:
uses: ./.github/workflows/qa.yml
34 changes: 34 additions & 0 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: QA

on:
workflow_call:

jobs:
check-qa:
runs-on: ubuntu-22.04

steps:
- uses: actions/[email protected]

- name: Set up Python 3.11
uses: actions/[email protected]
with:
python-version: "3.11"
benoit74 marked this conversation as resolved.
Show resolved Hide resolved
architecture: x64

- name: Install dependencies (and project)
run: |
pip install -U pip
pip install -e .[lint,scripts,test]

- name: Check black formatting
run: inv lint-black

- name: Check ruff
run: inv lint-ruff

# Installs and run pyright (node). Easier/faster alt. to: inv check-pyright
benoit74 marked this conversation as resolved.
Show resolved Hide resolved
- name: Check with pyright
uses: jakebailey/[email protected]
with:
version: 1.1.311
Loading