refactor: get a shorter name

This commit is contained in:
Corentin 2024-05-21 22:36:52 +02:00
parent 2729af8e39
commit fc9a8dc461
15 changed files with 26 additions and 26 deletions

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
**/__pycache__ **/__pycache__
.coverage .coverage
jean_website.egg-info jean_web.egg-info
tests/**/*.mo tests/**/*.mo

View File

@ -2,7 +2,7 @@ from pathlib import Path
from click import group from click import group
from jwebsite.context import Context from jweb.context import Context
@group @group

View File

@ -10,7 +10,7 @@ from jinja2.environment import Environment
from jinja2.loaders import FileSystemLoader from jinja2.loaders import FileSystemLoader
from jinja2.runtime import Context as JinjaContext from jinja2.runtime import Context as JinjaContext
from jwebsite.content import Content from jweb.content import Content
_DEFAULT_LANGUAGE = "en" _DEFAULT_LANGUAGE = "en"

View File

@ -1,8 +1,8 @@
from datetime import datetime from datetime import datetime
from subprocess import check_output from subprocess import check_output
from jwebsite.content import Content from jweb.content import Content
from jwebsite.context import Context from jweb.context import Context
def load_extension(context: Context) -> None: def load_extension(context: Context) -> None:

View File

@ -2,8 +2,8 @@ from typing import Any
from markdown import Markdown from markdown import Markdown
from jwebsite.content import Content, ContentField from jweb.content import Content, ContentField
from jwebsite.context import Context from jweb.context import Context
def load_extension(context: Context) -> None: def load_extension(context: Context) -> None:

View File

@ -2,8 +2,8 @@ from typing import Any
from yaml import Loader, load from yaml import Loader, load
from jwebsite.content import Content, ContentField from jweb.content import Content, ContentField
from jwebsite.context import Context from jweb.context import Context
def load_extension(context: Context) -> None: def load_extension(context: Context) -> None:

View File

@ -1,7 +1,7 @@
from datetime import datetime from datetime import datetime
from subprocess import check_output from subprocess import check_output
from jwebsite.content import Content from jweb.content import Content
def git_creation_date(content: Content) -> datetime: def git_creation_date(content: Content) -> datetime:

View File

@ -52,7 +52,7 @@ def unit_tests(session: Session) -> None:
session.install("babel", "jinja2") session.install("babel", "jinja2")
for directory in _LOCALIZED_TESTS: for directory in _LOCALIZED_TESTS:
session.run("pybabel", "compile", "--domain=tests", f"--directory={directory}/locale", "--use-fuzzy") session.run("pybabel", "compile", "--domain=tests", f"--directory={directory}/locale", "--use-fuzzy")
session.run("python", "-m", "pytest", "--cov=jwebsite", "--cov-report=html") session.run("python", "-m", "pytest", "--cov=jweb", "--cov-report=html")
@session() @session()

View File

@ -1,8 +1,8 @@
[project] [project]
name = "jean-website" name = "jean-web"
version = "0.0.1" version = "0.0.1"
authors = [ authors = [
{name = "Jean-Website", email ="team@collectivit.org"} {name = "Jean-Web", email ="team@collectivit.org"}
] ]
description = "Static site generator" description = "Static site generator"
@ -29,14 +29,14 @@ dev = [
] ]
[project.scripts] [project.scripts]
jwebsite = "jwebsite.cli:main" jweb = "jweb.cli:main"
[build-system] [build-system]
requires = ["setuptools>=45"] requires = ["setuptools>=45"]
[tool.mypy] [tool.mypy]
strict = true strict = true
files = "jwebsite/**/*.py,tests/**/*.py,noxfile.py" files = "jweb/**/*.py,tests/**/*.py,noxfile.py"
[tool.ruff] [tool.ruff]
line-length = 110 line-length = 110

View File

@ -2,14 +2,14 @@ from pathlib import Path
from pytest import mark, raises from pytest import mark, raises
from jwebsite.content import Content from jweb.content import Content
from jwebsite.context import Context from jweb.context import Context
@mark.parametrize("content", ["# Otters", b"# Otters"]) @mark.parametrize("content", ["# Otters", b"# Otters"])
def test_load(datadir: Path, content: bytes | str) -> None: def test_load(datadir: Path, content: bytes | str) -> None:
context = Context(datadir) context = Context(datadir)
context.load_extensions("jwebsite.extensions.markdown") context.load_extensions("jweb.extensions.markdown")
context.render("test-load.html", "output.html", content=Content(Path("content.yml"), content, None)) context.render("test-load.html", "output.html", content=Content(Path("content.yml"), content, None))
with open(datadir / "build" / "output.html", encoding="utf-8") as ouput_file: with open(datadir / "build" / "output.html", encoding="utf-8") as ouput_file:
@ -18,7 +18,7 @@ def test_load(datadir: Path, content: bytes | str) -> None:
def test_load_type_error(datadir: Path) -> None: def test_load_type_error(datadir: Path) -> None:
context = Context(datadir) context = Context(datadir)
context.load_extensions("jwebsite.extensions.markdown") context.load_extensions("jweb.extensions.markdown")
with raises(ValueError): with raises(ValueError):
context.render("test-load.html", "output.html", content=Content(Path("content.yml"), 10, None)) context.render("test-load.html", "output.html", content=Content(Path("content.yml"), 10, None))
@ -29,7 +29,7 @@ def test_load_type_error(datadir: Path) -> None:
def test_metadata(datadir: Path) -> None: def test_metadata(datadir: Path) -> None:
context = Context(datadir) context = Context(datadir)
context.load_extensions("jwebsite.extensions.markdown") context.load_extensions("jweb.extensions.markdown")
markdown = "---\n" "title: Steven\n" "---\n" "\n" "Content\n" markdown = "---\n" "title: Steven\n" "---\n" "\n" "Content\n"

View File

@ -2,14 +2,14 @@ from pathlib import Path
from pytest import mark, raises from pytest import mark, raises
from jwebsite.content import Content from jweb.content import Content
from jwebsite.context import Context from jweb.context import Context
@mark.parametrize("content", ["[Peter, Steven]", b"[Peter, Steven]"]) @mark.parametrize("content", ["[Peter, Steven]", b"[Peter, Steven]"])
def test_load(datadir: Path, content: bytes | str) -> None: def test_load(datadir: Path, content: bytes | str) -> None:
context = Context(datadir) context = Context(datadir)
context.load_extensions("jwebsite.extensions.yaml") context.load_extensions("jweb.extensions.yaml")
context.render("test-load.html", "output.html", content=Content(Path("content.yml"), content, None)) context.render("test-load.html", "output.html", content=Content(Path("content.yml"), content, None))
with open(datadir / "build" / "output.html", encoding="utf-8") as ouput_file: with open(datadir / "build" / "output.html", encoding="utf-8") as ouput_file:
@ -18,7 +18,7 @@ def test_load(datadir: Path, content: bytes | str) -> None:
def test_load_type_error(datadir: Path) -> None: def test_load_type_error(datadir: Path) -> None:
context = Context(datadir) context = Context(datadir)
context.load_extensions("jwebsite.extensions.yaml") context.load_extensions("jweb.extensions.yaml")
with raises(ValueError): with raises(ValueError):
context.render("test-load.html", "output.html", content=Content(Path("content.yml"), 10, None)) context.render("test-load.html", "output.html", content=Content(Path("content.yml"), 10, None))

View File

@ -1,6 +1,6 @@
from pathlib import Path from pathlib import Path
from jwebsite.context import Context from jweb.context import Context
def test_render(datadir: Path) -> None: def test_render(datadir: Path) -> None:

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PROJECT VERSION\n" "Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-05-21 21:13+0200\n" "POT-Creation-Date: 2024-05-21 22:35+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: fr\n" "Language: fr\n"