Skip to content

Commit

Permalink
New setup (pyproject.toml, python 3.11)
Browse files Browse the repository at this point in the history
  • Loading branch information
lionel-panhaleux committed Feb 7, 2024
1 parent 777e0c9 commit 533ec2c
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 128 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/static.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -26,7 +26,7 @@ jobs:
black --check codex_of_the_damned tests
- name: Lint
run: |
flake8
ruff check --output-format github
- name: Test
run: |
pytest
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
.PHONY: po-update po-compile po release test update

po-update:
python setup.py extract_messages
python setup.py update_catalog
pybabel extract --charset=utf-8 -c "TRANSLATORS:" -w 120 -k lazy_gettext -F babel.cfg -o messages.pot codex_of_the_damned
pybabel update -l fr -w 120 --init-missing -i messages.pot -d codex_of_the_damned/translations

po-compile:
python setup.py compile_catalog
pybabel compile -D messages -d codex_of_the_damned/translations

po: po-update po-compile

Expand All @@ -14,6 +14,8 @@ release:
pip install -e ".[dev]"

test:
black --check codex_of_the_damned tests
ruff check
pytest

update:
Expand Down
14 changes: 8 additions & 6 deletions codex_of_the_damned/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ def index(lang_code=None, page=None):
)
image_name, _ = re.subn(r"""\s|,|\.|-|—|'|:|\(|\)|"|!""", "", image_name)
context["og_image"] = f"http://static.krcg.org/card/{image_name}.jpg"
context[
"og_image_secure"
] = f"https://static.krcg.org/card/{image_name}.jpg"
context["og_image_secure"] = (
f"https://static.krcg.org/card/{image_name}.jpg"
)
context["og_description"] = "Official card text and rulings"
context["og_title"] = card
context["og_image_dimensions"] = ["358", "500"]
Expand Down Expand Up @@ -382,9 +382,11 @@ def display_card():
def card(name, display_name=None):
return markupsafe.Markup(
'<span class="krcg-card"{data_name}>{name}</span>'.format(
data_name=f' data-name="{name}"'
if display_name or re.search(r" |-", name)
else "",
data_name=(
f' data-name="{name}"'
if display_name or re.search(r" |-", name)
else ""
),
# replace spaces and hyphens with non-breakable versions in card names
name=(display_name or name).replace(" ", " ").replace("-", "‑"),
)
Expand Down
51 changes: 51 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[build-system]
requires = ["setuptools>=68", "setuptools_scm>=8", "babel>=2"]
build-backend = "setuptools.build_meta"

[project]
name = "codex-of-the-damned"
dynamic = ["version"]
authors = [
{ name = "Lionel Panhaleux", email = "[email protected]" },
]
description = "Website on VTES Strategy, cards rulings and TWD search interface"
keywords = ["vtes", "Vampire: The Eternal Struggle", "CCG", "TWD", "TWDA"]
readme = "README.md"
requires-python = ">=3.11"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Development Status :: 5 - Production/Stable",
"Natural Language :: English",
"Operating System :: OS Independent",
"Framework :: Flask",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
]
dependencies = ["flask>=3", "flask-babel>=4", "unidecode>=1", "Jinja2>=3"]

[project.optional-dependencies]
dev = [
"black>=24",
"clipboard>=0",
"ipython>=8",
"pytest>=8",
"requests>=2",
"ruff>=0",
"zest.releaser[recommended]>=9",
]

[project.urls]
Homepage = "https://codex-of-the-damned.org"
Repository = "https://github.com/lionel-panhaleux/codex-of-the-damned"

[tool.setuptools.packages.find]
include = ["codex_of_the_damned*"]

# required for dynamic version
[tool.setuptools_scm]

[tool.zest-releaser]
create-wheel = true

[tool.pytest]
junit_duration_report = "call"
79 changes: 0 additions & 79 deletions setup.cfg

This file was deleted.

36 changes: 0 additions & 36 deletions setup.py

This file was deleted.

0 comments on commit 533ec2c

Please sign in to comment.