Skip to content

Commit dee26e4

Browse files
authored
Merge pull request #197 from openzim/deps
Adopting-ish openZIM bootstrap
2 parents a4ea3c2 + 98499fe commit dee26e4

16 files changed

Lines changed: 744 additions & 235 deletions
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
push:
66
branches:
77
- main
8-
- windows
98

109
env:
1110
LIBZIM_DL_VERSION: "9.2.3-2"

.github/workflows/QA.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: QA
2+
on: [push]
3+
4+
env:
5+
LIBZIM_DL_VERSION: "9.2.3-2"
6+
MACOSX_DEPLOYMENT_TARGET: "12.0"
7+
8+
jobs:
9+
lint:
10+
runs-on: ubuntu-22.04
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Set up Python ${{ matrix.python }}
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: "3.12"
18+
architecture: x64
19+
20+
- name: Install dependencies (and project)
21+
run: |
22+
pip install -U pip
23+
pip install -e .[lint,scripts,test,check]
24+
25+
- name: Check black formatting
26+
run: inv lint-black
27+
28+
- name: Check ruff
29+
run: inv lint-ruff
30+
31+
- name: Check pyright
32+
run: inv check-pyright
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,19 @@
1-
name: test
1+
name: Tests
22
on: [push]
33

44
env:
55
LIBZIM_DL_VERSION: "9.2.3-2"
66
MACOSX_DEPLOYMENT_TARGET: "12.0"
7+
# we want cython traces for coverage
8+
PROFILE: "1"
79

810
jobs:
9-
lint:
10-
runs-on: ubuntu-22.04
11-
steps:
12-
- uses: actions/checkout@v4
13-
14-
- name: Set up Python ${{ matrix.python }}
15-
uses: actions/setup-python@v5
16-
with:
17-
python-version: "3.12"
18-
architecture: x64
19-
20-
- name: Check formatting and linting
21-
run: |
22-
pip install -U invoke
23-
invoke install-dev
24-
invoke check
25-
2611
test:
2712
runs-on: ${{ matrix.os }}
2813
strategy:
2914
matrix:
3015
os: [macos-13, windows-2022, ubuntu-22.04]
31-
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
16+
python: ["3.9", "3.10", "3.11", "3.12"]
3217

3318
steps:
3419
- uses: actions/checkout@v4
@@ -39,25 +24,22 @@ jobs:
3924
python-version: ${{ matrix.python }}
4025
architecture: x64
4126

42-
- name: Installing dependencies
43-
run: pip install -U pip setuptools build
4427

45-
- name: Building & installing for tests (with profiling)
46-
env:
47-
PROFILE: 1
48-
run: pip install -e .
28+
- name: Install dependencies (and project)
29+
run: |
30+
pip install -U pip
31+
pip install -e .[test,scripts]
4932
5033
- name: move DLLs next to wrapper
5134
if: matrix.os == 'windows-2022'
5235
run: Move-Item -Force -Path .\libzim\*.dll -Destination .\
5336

54-
- name: Testing
55-
run: |
56-
pip install pytest pytest-cov cython
57-
py.test --cov=libzim --cov-report=term --cov-report term-missing .
37+
- name: Run the tests
38+
run: inv coverage --args "-vvv"
5839

5940
- name: Upload coverage report to codecov
6041
if: matrix.os == 'ubuntu-22.04' && matrix.python == '3.11'
6142
uses: codecov/codecov-action@v4
6243
with:
44+
fail_ci_if_error: true
6345
token: ${{ secrets.CODECOV_TOKEN }}

.gitignore

Lines changed: 214 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,215 @@
1-
# General cruft
1+
# Created by https://www.toptal.com/developers/gitignore/api/python,macos
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=python,macos
3+
4+
### macOS ###
5+
# General
26
.DS_Store
3-
.venv
4-
.venv-docker
5-
.mypy_cache
6-
__pycache__
7-
*.pyc
8-
.tox
7+
.AppleDouble
8+
.LSOverride
9+
10+
# Icon must end with two \r
11+
Icon
12+
13+
14+
# Thumbnails
15+
._*
16+
17+
# Files that might appear in the root of a volume
18+
.DocumentRevisions-V100
19+
.fseventsd
20+
.Spotlight-V100
21+
.TemporaryItems
22+
.Trashes
23+
.VolumeIcon.icns
24+
.com.apple.timemachine.donotpresent
25+
26+
# Directories potentially created on remote AFP share
27+
.AppleDB
28+
.AppleDesktop
29+
Network Trash Folder
30+
Temporary Items
31+
.apdisk
32+
33+
### macOS Patch ###
34+
# iCloud generated files
35+
*.icloud
36+
37+
### Python ###
38+
# Byte-compiled / optimized / DLL files
39+
__pycache__/
40+
*.py[cod]
41+
*$py.class
42+
43+
# C extensions
44+
*.so
45+
46+
# Distribution / packaging
47+
.Python
48+
build/
49+
develop-eggs/
50+
dist/
51+
downloads/
52+
eggs/
53+
.eggs/
54+
lib/
55+
lib64/
56+
parts/
57+
sdist/
58+
var/
59+
wheels/
60+
share/python-wheels/
61+
*.egg-info/
62+
.installed.cfg
63+
*.egg
64+
MANIFEST
65+
66+
# PyInstaller
67+
# Usually these files are written by a python script from a template
68+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
69+
*.manifest
70+
*.spec
71+
72+
# Installer logs
73+
pip-log.txt
74+
pip-delete-this-directory.txt
75+
76+
# Unit test / coverage reports
77+
htmlcov/
78+
.tox/
79+
.nox/
980
.coverage
10-
coverage.*
11-
*.swp
81+
.coverage.*
82+
.cache
83+
nosetests.xml
84+
coverage.xml
85+
*.cover
86+
*.py,cover
87+
.hypothesis/
88+
.pytest_cache/
89+
cover/
90+
91+
# Translations
92+
*.mo
93+
*.pot
94+
95+
# Django stuff:
96+
*.log
97+
local_settings.py
98+
db.sqlite3
99+
db.sqlite3-journal
100+
101+
# Flask stuff:
102+
instance/
103+
.webassets-cache
104+
105+
# Scrapy stuff:
106+
.scrapy
107+
108+
# Sphinx documentation
109+
docs/_build/
110+
111+
# PyBuilder
112+
.pybuilder/
113+
target/
114+
115+
# Jupyter Notebook
116+
.ipynb_checkpoints
117+
118+
# IPython
119+
profile_default/
120+
ipython_config.py
121+
122+
# pyenv
123+
# For a library or package, you might want to ignore these files since the code is
124+
# intended to run in multiple environments; otherwise, check them in:
125+
# .python-version
126+
127+
# pipenv
128+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
129+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
130+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
131+
# install all needed dependencies.
132+
#Pipfile.lock
133+
134+
# poetry
135+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
136+
# This is especially recommended for binary packages to ensure reproducibility, and is more
137+
# commonly ignored for libraries.
138+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
139+
#poetry.lock
140+
141+
# pdm
142+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
143+
#pdm.lock
144+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
145+
# in version control.
146+
# https://pdm.fming.dev/#use-with-ide
147+
.pdm.toml
148+
149+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
150+
__pypackages__/
151+
152+
# Celery stuff
153+
celerybeat-schedule
154+
celerybeat.pid
155+
156+
# SageMath parsed files
157+
*.sage.py
158+
159+
# Environments
160+
.env
161+
.venv
162+
env/
163+
venv/
164+
ENV/
165+
env.bak/
166+
venv.bak/
167+
168+
# Spyder project settings
169+
.spyderproject
170+
.spyproject
171+
172+
# Rope project settings
173+
.ropeproject
174+
175+
# mkdocs documentation
176+
/site
177+
178+
# mypy
179+
.mypy_cache/
180+
.dmypy.json
181+
dmypy.json
182+
183+
# Pyre type checker
184+
.pyre/
185+
186+
# pytype static type analyzer
187+
.pytype/
188+
189+
# Cython debug symbols
190+
cython_debug/
191+
192+
# PyCharm
193+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
194+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
195+
# and can be added to the global gitignore or merged into this file. For a more nuclear
196+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
197+
#.idea/
198+
199+
### Python Patch ###
200+
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
201+
poetry.toml
202+
203+
# ruff
204+
.ruff_cache/
205+
206+
# LSP config files
207+
pyrightconfig.json
208+
209+
# End of https://www.toptal.com/developers/gitignore/api/python,macos
210+
211+
# ignore all vscode, this is not standard configuration in this place
212+
.vscode
12213

13214

14215
# Compiled binaries and package builds
@@ -32,8 +233,12 @@ libzim/libzim_api.h
32233
Pipfile
33234
.dev
34235
.env
236+
.venv
35237

36238
libzim.so
37239
libzim.so.*
38240
libzim.dylib
39241
libzim.*.dylib
242+
zim*.dll
243+
libicu*.dll
244+
zim.lib

.pre-commit-config.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.6.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- repo: https://github.com/psf/black
10+
rev: "24.8.0"
11+
hooks:
12+
- id: black
13+
- repo: https://github.com/astral-sh/ruff-pre-commit
14+
rev: v0.6.3
15+
hooks:
16+
- id: ruff
17+
# - repo: https://github.com/RobertCraigie/pyright-python
18+
# rev: v1.1.379
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'

0 commit comments

Comments
 (0)