Skip to content

Commit cfee792

Browse files
authored
Merge pull request #128 from openzim/adopt_bootstrap
Migrate to python bootstrap conventions
2 parents 4dc3012 + ad4b241 commit cfee792

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1322
-744
lines changed

.github/workflows/Publish.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build and upload to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-22.04
10+
permissions:
11+
id-token: write # mandatory for PyPI trusted publishing
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version-file: pyproject.toml
20+
architecture: x64
21+
22+
- name: Build packages
23+
run: |
24+
pip install -U pip build
25+
python -m build --sdist --wheel
26+
27+
- name: Upload to PyPI
28+
uses: pypa/gh-action-pypi-publish@release/v1.8

.github/workflows/QA.yaml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: QA
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
check-qa:
11+
runs-on: ubuntu-22.04
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version-file: pyproject.toml
20+
architecture: x64
21+
22+
- name: Install dependencies (and project)
23+
run: |
24+
pip install -U pip
25+
pip install -e .[lint,scripts,test,check]
26+
27+
- name: Check black formatting
28+
run: inv lint-black
29+
30+
- name: Check ruff
31+
run: inv lint-ruff
32+
33+
- name: Check pyright
34+
run: inv check-pyright

.github/workflows/Tests.yaml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Tests
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
run-tests:
11+
strategy:
12+
matrix:
13+
os: [ubuntu-22.04]
14+
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
15+
runs-on: ${{ matrix.os }}
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- name: install ffmpeg and gifsicle
21+
run: sudo apt update && sudo apt install ffmpeg gifsicle
22+
23+
- name: add required locales for tests
24+
run: sudo locale-gen fr_FR.UTF-8 pt_BR.UTF-8 && sudo update-locale
25+
26+
- name: Set up Python ${{ matrix.python }}
27+
uses: actions/setup-python@v4
28+
with:
29+
python-version: ${{ matrix.python }}
30+
architecture: x64
31+
32+
- name: Install dependencies (and project)
33+
run: |
34+
pip install -U pip
35+
pip install -e .[test,scripts]
36+
37+
- name: Run the tests
38+
run: inv coverage --args "--runslow -vvv"
39+
40+
- name: Upload coverage report to codecov
41+
if: matrix.python == '3.12'
42+
uses: codecov/codecov-action@v3
43+
with:
44+
token: ${{ secrets.CODECOV_TOKEN }}
45+
46+
build_python:
47+
runs-on: ubuntu-22.04
48+
steps:
49+
- uses: actions/checkout@v3
50+
51+
- name: Set up Python
52+
uses: actions/setup-python@v4
53+
with:
54+
python-version-file: pyproject.toml
55+
architecture: x64
56+
57+
- name: Ensure we can build Python targets
58+
run: |
59+
pip install -U pip build
60+
python3 -m build --sdist --wheel

.github/workflows/ci.yml

-54
This file was deleted.

.github/workflows/release.yml

-34
This file was deleted.

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,7 @@ $RECYCLE.BIN/
248248
*.lnk
249249

250250
# End of https://www.toptal.com/developers/gitignore/api/python,macos,windows,linux
251+
252+
# ignore all vscode, this is not standard configuration in this place
253+
.vscode
254+
src/libzim-stubs

.pre-commit-config.yaml

+24-19
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
4-
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.4.0
6-
hooks:
7-
- id: trailing-whitespace
8-
- id: end-of-file-fixer
9-
- repo: https://github.com/pycqa/isort
10-
rev: "5.12.0"
11-
hooks:
12-
- id: isort
13-
args: ["--profile", "black", "--filter-files"]
14-
- repo: https://github.com/psf/black
15-
rev: "23.1.0"
16-
hooks:
17-
- id: black
18-
- repo: https://github.com/pycqa/flake8
19-
rev: "6.0.0"
20-
hooks:
21-
- id: flake8
22-
args: ["--max-line-length", "88", "--extend-ignore=E203"]
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.5.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- repo: https://github.com/psf/black
10+
rev: "24.1.1"
11+
hooks:
12+
- id: black
13+
- repo: https://github.com/astral-sh/ruff-pre-commit
14+
rev: v0.2.1
15+
hooks:
16+
- id: ruff
17+
- repo: https://github.com/RobertCraigie/pyright-python
18+
rev: v1.1.350
19+
hooks:
20+
- id: pyright
21+
name: pyright (system)
22+
description: 'pyright static type checker'
23+
entry: pyright
24+
language: system
25+
'types_or': [python, pyi]
26+
require_serial: true
27+
minimum_pre_commit_version: '2.9.2'

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ All notable changes to this project are documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) (as of version 1.5.0).
77

8+
## [Unreleased]
9+
10+
### Changed
11+
12+
- Using openZIM Python bootstrap conventions (including hatch-openzim plugin) #120
13+
- Suuport for Python 3.12, drop Python 3.7 #118
14+
- Replace "iso-369" iso639-lang by "iso639-lang" library
15+
816
## [3.2.0] - 2023-12-16
917

1018
### Added

MANIFEST.in

-4
This file was deleted.

README.md

+16-14
Original file line numberDiff line numberDiff line change
@@ -47,27 +47,29 @@ sudo apt install libmagic1 wget ffmpeg \
4747

4848
# Contribution
4949

50+
This project adheres to openZIM's [Contribution Guidelines](https://github.com/openzim/overview/wiki/Contributing)
51+
5052
```shell
51-
pip -r requirements.txt
52-
pip install tox pre-commit
53+
pip install hatch
54+
pip install ".[dev]"
5355
pre-commit install
5456
# For tests
55-
tox
57+
invoke coverage
5658
```
5759

5860
# Users
5961

6062
Non-exhaustive list of scrapers using it (check status when updating API):
6163

62-
* [openzim/youtube](https://github.com/openzim/youtube)
64+
* [openzim/freecodecamp](https://github.com/openzim/freecodecamp)
65+
* [openzim/gutenberg](https://github.com/openzim/gutenberg)
66+
* [openzim/ifixit](https://github.com/openzim/ifixit)
67+
* [openzim/kolibri](https://github.com/openzim/kolibri)
6368
* [openzim/nautilus](https://github.com/openzim/nautilus)
64-
65-
# releasing
66-
67-
* Update your dependencies: `pip install -U setuptools wheel twine`
68-
* Make sure CHANGELOG.md is up-to-date
69-
* Bump version on `src/zimscraperlib/VERSION`
70-
* Build packages `python ./setup.py sdist bdist_wheel`
71-
* Upload to PyPI `twine upload dist/zimscraperlib-2.0.0*`.
72-
* Commit your Changelog + version bump changes
73-
* Tag version on git `git tag -a v2.0.0`
69+
* [openzim/nautilus](https://github.com/openzim/nautilus)
70+
* [openzim/openedx](https://github.com/openzim/openedx)
71+
* [openzim/sotoki](https://github.com/openzim/sotoki)
72+
* [openzim/ted](https://github.com/openzim/ted)
73+
* [openzim/warc2zim](https://github.com/openzim/warc2zim)
74+
* [openzim/wikihow](https://github.com/openzim/wikihow)
75+
* [openzim/youtube](https://github.com/openzim/youtube)

0 commit comments

Comments
 (0)