Skip to content

Commit

Permalink
Merge pull request #197 from openzim/deps
Browse files Browse the repository at this point in the history
Adopting-ish openZIM bootstrap
  • Loading branch information
rgaudin authored Sep 5, 2024
2 parents a4ea3c2 + 98499fe commit dee26e4
Show file tree
Hide file tree
Showing 16 changed files with 744 additions and 235 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
push:
branches:
- main
- windows

env:
LIBZIM_DL_VERSION: "9.2.3-2"
Expand Down
File renamed without changes.
32 changes: 32 additions & 0 deletions .github/workflows/QA.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: QA
on: [push]

env:
LIBZIM_DL_VERSION: "9.2.3-2"
MACOSX_DEPLOYMENT_TARGET: "12.0"

jobs:
lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: "3.12"
architecture: x64

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

- name: Check ruff
run: inv lint-ruff

- name: Check pyright
run: inv check-pyright
40 changes: 11 additions & 29 deletions .github/workflows/test.yml → .github/workflows/Tests.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,19 @@
name: test
name: Tests
on: [push]

env:
LIBZIM_DL_VERSION: "9.2.3-2"
MACOSX_DEPLOYMENT_TARGET: "12.0"
# we want cython traces for coverage
PROFILE: "1"

jobs:
lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: "3.12"
architecture: x64

- name: Check formatting and linting
run: |
pip install -U invoke
invoke install-dev
invoke check
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-13, windows-2022, ubuntu-22.04]
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
Expand All @@ -39,25 +24,22 @@ jobs:
python-version: ${{ matrix.python }}
architecture: x64

- name: Installing dependencies
run: pip install -U pip setuptools build

- name: Building & installing for tests (with profiling)
env:
PROFILE: 1
run: pip install -e .
- name: Install dependencies (and project)
run: |
pip install -U pip
pip install -e .[test,scripts]
- name: move DLLs next to wrapper
if: matrix.os == 'windows-2022'
run: Move-Item -Force -Path .\libzim\*.dll -Destination .\

- name: Testing
run: |
pip install pytest pytest-cov cython
py.test --cov=libzim --cov-report=term --cov-report term-missing .
- name: Run the tests
run: inv coverage --args "-vvv"

- name: Upload coverage report to codecov
if: matrix.os == 'ubuntu-22.04' && matrix.python == '3.11'
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
223 changes: 214 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,215 @@
# General cruft
# Created by https://www.toptal.com/developers/gitignore/api/python,macos
# Edit at https://www.toptal.com/developers/gitignore?templates=python,macos

### macOS ###
# General
.DS_Store
.venv
.venv-docker
.mypy_cache
__pycache__
*.pyc
.tox
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
coverage.*
*.swp
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

### Python Patch ###
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
poetry.toml

# ruff
.ruff_cache/

# LSP config files
pyrightconfig.json

# End of https://www.toptal.com/developers/gitignore/api/python,macos

# ignore all vscode, this is not standard configuration in this place
.vscode


# Compiled binaries and package builds
Expand All @@ -32,8 +233,12 @@ libzim/libzim_api.h
Pipfile
.dev
.env
.venv

libzim.so
libzim.so.*
libzim.dylib
libzim.*.dylib
zim*.dll
libicu*.dll
zim.lib
27 changes: 27 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/psf/black
rev: "24.8.0"
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.3
hooks:
- id: ruff
# - repo: https://github.com/RobertCraigie/pyright-python
# rev: v1.1.379
# hooks:
# - id: pyright
# name: pyright (system)
# description: 'pyright static type checker'
# entry: pyright
# language: system
# 'types_or': [python, pyi]
# require_serial: true
# minimum_pre_commit_version: '2.9.2'
Loading

0 comments on commit dee26e4

Please sign in to comment.