Skip to content

Commit

Permalink
Use pyproject.toml, integrate ruff and black
Browse files Browse the repository at this point in the history
  • Loading branch information
santhoshtr committed Jul 14, 2023
1 parent eb634c8 commit 6423bd5
Show file tree
Hide file tree
Showing 13 changed files with 531 additions and 506 deletions.
21 changes: 16 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ UFO=$(STYLES:%=$(UFODIR)/$(FAMILY)-%.ufo) \
$(UFODIR)/$(FAMILY)-Color-Black.ufo \
$(UFODIR)/$(FAMILY)-Arrows-Color.ufo

.PHONY: $(STYLES) ufo clean glyphs build proofs autobuild
.PHONY: $(STYLES) ufo clean glyphs build proofs autobuild update-deps init update

default: build

Expand Down Expand Up @@ -151,31 +151,31 @@ $(FONTSDIR)/%/otf-variable : %.designspace
$(PY) tools/stat.py $* $@/*.otf

# Create Variable Color fonts-OTF from variable font. The variable font will be colrv0 already
# We just rename as per naminc conventions. Then build colrv1 from it.
# We just rename as per naming conventions. Then build colrv1 from it.
$(FONTSDIR)/%/otf-color : $(FONTSDIR)/%/otf-variable
@mkdir -p $@
@mv $</$*-VF.otf $@/$*.colrv0.otf
$(PY) tools/build_color_v1.py $@/$*.colrv0.otf $@/$*.colrv1.otf
@rm -rf $<

# Create Color fonts-OTF from otf font. The otf font will be colrv0 already
# We just rename as per naminc conventions. Then build colrv1 from it.
# We just rename as per naming conventions. Then build colrv1 from it.
$(FONTSDIR)/%/otf-color : $(FONTSDIR)/%/otf
@mkdir -p $@
@mv $</$*.otf $@/$*.colrv0.otf
$(PY) tools/build_color_v1.py $@/$*.colrv0.otf $@/$*.colrv1.otf
@rm -rf $<

# Create Variable Color fonts-TTF from variable font. The variable font will be colrv0 already
# We just rename as per naminc conventions. Then build colrv1 from it.
# We just rename as per naming conventions. Then build colrv1 from it.
$(FONTSDIR)/%/ttf-color : $(FONTSDIR)/%/ttf-variable
@mkdir -p $@
@mv $</$*-VF.ttf $@/$*.colrv0.ttf
$(PY) tools/build_color_v1.py $@/$*.colrv0.ttf $@/$*.colrv1.ttf
@rm -rf $<

# Create Color fonts-TTF from TTF font. The otf font will be colrv0 already
# We just rename as per naminc conventions. Then build colrv1 from it.
# We just rename as per naming conventions. Then build colrv1 from it.
$(FONTSDIR)/%/ttf-color : $(FONTSDIR)/%/ttf
@mkdir -p $@
@mv $</$*.ttf $@/$*.colrv0.ttf
Expand Down Expand Up @@ -332,3 +332,14 @@ release:
zip -r $(FONTSDIR)/Nupuram-Display.zip README.md OFL.txt $(FONTSDIR)/Nupuram-Display
sha256sum $(FONTSDIR)/Nupuram-Display.zip > $(FONTSDIR)/Nupuram-Display.zip.sha256
md5sum $(FONTSDIR)/Nupuram-Display.zip > $(FONTSDIR)/Nupuram-Display.zip.md5

init:
pip-sync
pip check

update: update-deps init

update-deps:
export PIP_REQUIRE_VIRTUALENV=true
pip install --upgrade pip-tools pip wheel
pip-compile --upgrade --extra=tests,dev -o requirements.txt pyproject.toml
9 changes: 0 additions & 9 deletions requirements.in

This file was deleted.

96 changes: 63 additions & 33 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --output-file=requirements.txt requirements.in
# pip-compile --extra=tests,dev --output-file=requirements.txt pyproject.toml
#
appdirs==1.4.4
# via fs
attrs==23.1.0
# via
# fontmake
# ufolib2
axisregistry==0.4.2
axisregistry==0.4.3
# via fontbakery
babelfont==3.0.1
# via
Expand All @@ -23,22 +23,32 @@ beziers==0.5.0
# fontbakery
# fontfeatures
# glyphtools
black==23.7.0
# via nupuram (pyproject.toml)
booleanoperations==0.9.0
# via ufo2ft
brotli==1.0.9
# via -r requirements.in
# via nupuram (pyproject.toml)
cachetools==5.3.1
# via tox
certifi==2023.5.7
# via requests
cffi==1.15.1
# via cmarkgfm
cffsubr==0.2.9.post1
# via ufo2ft
charset-normalizer==3.1.0
chardet==5.1.0
# via tox
charset-normalizer==3.2.0
# via requests
click==8.1.5
# via black
cmarkgfm==2022.10.27
# via fontbakery
collidoscope==0.6.5
# via fontbakery
colorama==0.4.6
# via tox
commandlines==0.4.1
# via ufolint
compreffor==0.5.3
Expand All @@ -51,19 +61,25 @@ defcon==0.10.2
# glyphsets
dehinter==4.0.0
# via fontbakery
distlib==0.3.6
# via virtualenv
filelock==3.12.2
# via
# tox
# virtualenv
font-v==2.1.0
# via fontbakery
fontbakery[freetype]==0.8.13
# via -r requirements.in
# via nupuram (pyproject.toml)
fontfeatures==1.7.4
# via
# -r requirements.in
# babelfont
# nupuram (pyproject.toml)
fontmake==3.6.0
# via -r requirements.in
# via nupuram (pyproject.toml)
fontmath==0.9.3
# via fontmake
fonttools[lxml,ufo,unicode]==4.40.0
fonttools[lxml,ufo,unicode]==4.41.0
# via
# axisregistry
# babelfont
Expand Down Expand Up @@ -96,11 +112,11 @@ gflanguages==0.8.9
# via fontbakery
gitdb==4.0.10
# via gitpython
gitpython==3.1.31
gitpython==3.1.32
# via font-v
glyphsets==0.6.1
glyphsets==0.6.2
# via fontbakery
glyphslib==6.2.2
glyphslib==6.2.5
# via
# babelfont
# fontmake
Expand All @@ -110,9 +126,11 @@ glyphtools==0.8.0
# via fontfeatures
idna==3.4
# via requests
isort==5.12.0
# via nupuram (pyproject.toml)
kurbopy==0.9.0
# via collidoscope
lxml==4.9.2
lxml==4.9.3
# via
# fontbakery
# fontfeatures
Expand All @@ -121,15 +139,14 @@ markdown-it-py==3.0.0
# via rich
mdurl==0.1.2
# via markdown-it-py
munch==3.0.0
# via -r requirements.in
munch==4.0.0
# via nupuram (pyproject.toml)
munkres==1.1.4
# via fontbakery
numpy==1.24.3
# via
# glyphtools
# scipy
# svgpathtools
mypy-extensions==1.0.0
# via black
numpy==1.25.1
# via glyphtools
openstep-plist==0.3.0.post1
# via
# babelfont
Expand All @@ -138,12 +155,25 @@ opentype-sanitizer==9.1.0
# via fontbakery
opentypespec==1.9.1
# via fontbakery
orjson==3.9.1
orjson==3.9.2
# via babelfont
packaging==23.1
# via fontbakery
# via
# black
# fontbakery
# pyproject-api
# tox
pathspec==0.11.1
# via black
pip-api==0.0.30
# via fontbakery
platformdirs==3.8.1
# via
# black
# tox
# virtualenv
pluggy==1.2.0
# via tox
protobuf==3.20.3
# via
# axisregistry
Expand All @@ -157,22 +187,22 @@ pycparser==2.21
# via cffi
pygments==2.15.1
# via rich
pyproject-api==1.5.3
# via tox
pyyaml==6.0
# via
# -r requirements.in
# fontbakery
# nupuram (pyproject.toml)
requests==2.31.0
# via fontbakery
rich==13.4.2
# via fontbakery
rstr==3.2.1
# via stringbrewer
scipy==1.10.1
# via svgpathtools
ruff==0.0.278
# via nupuram (pyproject.toml)
six==1.16.0
# via
# fs
# munch
# via fs
skia-pathops==0.8.0
# via collidoscope
smmap==5.0.0
Expand All @@ -183,12 +213,10 @@ sre-yield==1.2
# via stringbrewer
stringbrewer==0.0.1
# via fontbakery
svgpathtools==1.6.1
# via -r requirements.in
svgwrite==1.4.3
# via svgpathtools
toml==0.10.2
# via fontbakery
tox==4.6.4
# via nupuram (pyproject.toml)
tqdm==4.65.0
# via collidoscope
ufo2ft[compreffor]==2.32.0
Expand All @@ -203,11 +231,11 @@ ufolib2==0.14.0
ufolint==1.2.0
# via fontbakery
ufonormalizer==0.6.1
# via -r requirements.in
# via nupuram (pyproject.toml)
uharfbuzz==0.37.0
# via
# -r requirements.in
# collidoscope
# nupuram (pyproject.toml)
# vharfbuzz
unicodedata2==15.0.0
# via
Expand All @@ -217,6 +245,8 @@ urllib3==2.0.3
# via requests
vharfbuzz==0.2.0
# via fontbakery
virtualenv==20.23.1
# via tox

# The following packages are considered to be unsafe in a requirements file:
# pip
Expand Down
1 change: 1 addition & 0 deletions specimen/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
body {
hyphens: auto;
-webkit-hyphenate-character: "";
hyphenate-character: "";
font-family: "Lato";
font-size: 100%;
background-color: var(--body-background-color);
Expand Down
23 changes: 10 additions & 13 deletions tools/build_color_v0.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
from ufoLib2.objects import Font, Layer
from munch import DefaultMunch
from operator import itemgetter
import copy
import yaml
import ufo2ft
import sys
import logging
import sys
from operator import itemgetter

import ufo2ft
import yaml
from munch import DefaultMunch
from ufoLib2.objects import Font, Layer

log = logging.getLogger(__name__)

colorConfig = DefaultMunch.fromDict(
yaml.load(open("config.yaml"), Loader=yaml.FullLoader)
)
colorConfig = DefaultMunch.fromDict(yaml.load(open("config.yaml"), Loader=yaml.FullLoader))

config = colorConfig.colorfonts[sys.argv[1]]

Expand All @@ -20,7 +19,7 @@ def hex_to_rgba(hexcolor):
hexcolor = hexcolor.lstrip("#")
if len(hexcolor) == 6:
hexcolor = hexcolor + "FF"
return tuple(int(hexcolor[i:i + 2], 16) for i in (0, 2, 4, 6))
return tuple(int(hexcolor[i : i + 2], 16) for i in (0, 2, 4, 6))


layer_mapping = []
Expand All @@ -31,9 +30,7 @@ def hex_to_rgba(hexcolor):
font = Font().open(config["layers"][layer_name]["source"])
else:
if not font:
raise ValueError(
"Default font not found. Define default source as first item in layers"
)
raise ValueError("Default font not found. Define default source as first item in layers")
layer: Layer = font.newLayer(layer_name)
layer_font: Font = Font().open(config["layers"][layer_name]["source"])
for base_glyph in layer_font:
Expand Down
Loading

0 comments on commit 6423bd5

Please sign in to comment.