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

register_font: support for new API #111

Merged
merged 16 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
86 changes: 24 additions & 62 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ name: Test

on:
push:
branches: [main,tests-build,v*]
branches: [main, tests-build, v*]
pull_request:
branches: [main,v*]
branches: [main, v*]

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
test:
Expand All @@ -14,7 +18,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -43,22 +47,14 @@ jobs:
if: steps.cache-pango.outputs.cache-hit != 'true'
run: |
source packing/build_pango_tests.sh

- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Build Project
run: python setup.py build_ext -i
- name: Run Tests
run: |
python setup.py build_ext -i
python setup.py sdist
pip install .
pytest
- name: Coverage
run: |
coverage report
coverage html
coverage xml
run: pytest -s
- uses: codecov/codecov-action@v3
with:
file: ./.coverage/coverage.xml
Expand All @@ -68,78 +64,44 @@ jobs:
path: .pytest_temp/

msvc:
name: ${{matrix.os}} - ${{matrix.python-version}}
name: ${{matrix.os}} - ${{matrix.python-version}} - ${{matrix.architecture}}
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os: [windows-2022]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
architecture: ["x64", "x86"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }} for x64
- name: Set up Python ${{ matrix.python-version }} for ${{matrix.architecture}}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: "x64"
architecture: ${{matrix.architecture}}
allow-prereleases: true
- name: Cache Windows
id: cache-windows
uses: actions/cache@v3
with:
path: C:\cibw\pkg-config
key: ${{ hashFiles('packing/download_dlls.py') }}-${{ hashFiles('packing/build_pkgconfig.ps1') }}-1
- name: Download Binary
run: |
python packing/download_dlls.py
- name: Set Path
- name: Set Path for pkg-config
run: |
$env:Path = "C:\cibw\pkg-config\bin;C:\cibw\vendor\bin;$($env:PATH)"
echo "$env:Path" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Test x64
- name: Install Python Dependencies
run: |
python -m pip install -U pip
pip install -U setuptools wheel
$env:PKG_CONFIG_PATH="C:\cibw\vendor\lib\pkgconfig"
pip install -r requirements-dev.txt
python setup.py build_ext -i
pytest
- name: Coverage
- name: Build Project
env:
PKG_CONFIG_PATH: C:\cibw\vendor\lib\pkgconfig
run: python setup.py build_ext -i
- name: Run tests
run: |
coverage report
coverage html
coverage xml
- name: Set up Python ${{ matrix.python-version }} for x86
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: "x86"
allow-prereleases: true
- name: Download Binary
run: |
python packing/download_dlls.py
- name: Build x86 Build
run: |
python -m pip install -U pip
$env:PATH="$env:PATH;C:\cibw\vendor\pkg-config\bin;C:\cibw\vendor\bin"
$env:PKG_CONFIG_PATH="C:\cibw\vendor\lib\pkgconfig"
pip install -r requirements-dev.txt
python setup.py build_ext -i
python setup.py sdist
python -m pip install dist/*
$env:PATH="C:\cibw\vendor\bin;$env:PATH"
pytest
- name: Coverage
run: |
coverage report
coverage html
coverage xml
- uses: codecov/codecov-action@v3
with:
file: ./.coverage/coverage.xml
pytest -s
- uses: actions/upload-artifact@v3
with:
name: test-artifacts-${{matrix.os}}-${{matrix.python-version}}
name: test-artifacts-${{matrix.os}}-${{matrix.python-version}} ${{matrix.architecture}}
path: .pytest_temp/
success-win:
needs: [msvc]
Expand Down
9 changes: 4 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
Expand All @@ -9,19 +9,18 @@ repos:
- id: mixed-line-ending
- id: check-merge-conflict
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 24.8.0
hooks:
- id: black
language_version: python3.11
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
rev: 7.1.1
hooks:
- id: flake8
additional_dependencies: [flake8-2020, flake8-implicit-str-concat]

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
Expand Down
16 changes: 12 additions & 4 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
version: 2
formats: all
conda:
environment: environment.yml
build:
os: ubuntu-22.04

tools:
python: "3.11"

apt_packages:
- libpango1.0-dev

python:
version: 3.8
install:
- requirements: docs/requirements.txt
- method: pip
path: .

formats: all
2 changes: 2 additions & 0 deletions docs/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Manimpango Reference
manimpango.MarkupUtils
manimpango.register_font
manimpango.unregister_font
manimpango.fc_register_font
manimpango.fc_unregister_font
manimpango.list_fonts

Enums
Expand Down
9 changes: 9 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
furo
sphinx
sphinxcontrib-applehelp
sphinxcontrib-devhelp
sphinxcontrib-htmlhelp
sphinxcontrib-jsmath
sphinxcontrib-qthelp
sphinxcontrib-serializinghtml
sphinxext-opengraph
2 changes: 1 addition & 1 deletion manimpango/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
f"{os.environ['PATH']}"
)
try:
from .register_font import * # isort:skip # noqa: F403,F401
from .cmanimpango import * # noqa: F403,F401
from .enums import * # noqa: F403,F401
from .register_font import * # noqa: F403,F401
except ImportError as ie: # pragma: no cover
py_ver = ".".join(map(str, sys.version_info[:3]))
msg = f"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

from libc.stddef cimport wchar_t
from pango cimport *


cdef extern from "Python.h":
Expand Down Expand Up @@ -35,6 +35,13 @@ IF UNAME_SYSNAME == "Windows":
DWORD fl,
unsigned int pdv
)

ctypedef void* HANDLE
HANDLE CreateMutexA(void* lpMutexAttributes, int bInitialOwner, const char* lpName)
int ReleaseMutex(HANDLE hMutex)
int WaitForSingleObject(HANDLE hHandle, unsigned long dwMilliseconds)
int CloseHandle(HANDLE hObject)

ELIF UNAME_SYSNAME == "Darwin":
cdef extern from "Carbon/Carbon.h":
ctypedef struct CFURLRef:
Expand Down
Loading
Loading