Skip to content

Commit 870b926

Browse files
committed
Merge branch 'main' into bva-icx/feat_time_object_support
2 parents 2a8b423 + 724a6cf commit 870b926

61 files changed

Lines changed: 2735 additions & 2532 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[flake8]
2-
exclude=.tox
2+
exclude=.venv
33
extend-ignore = E203
44
max-line-length=120

.github/workflows/ci.yml

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,39 @@ on:
55
branches:
66
- main
77
pull_request:
8+
workflow_dispatch:
89

910
jobs:
1011
lint:
1112
runs-on: ubuntu-latest
1213
steps:
13-
- uses: actions/checkout@v4
14-
- uses: actions/setup-python@v5
14+
- uses: actions/checkout@v6
15+
- uses: astral-sh/setup-uv@v7
1516
with:
16-
cache: pip
17-
cache-dependency-path: |
18-
dev-requirements.txt
19-
fluent.syntax/setup.py
20-
fluent.runtime/setup.py
21-
- run: python -m pip install -r dev-requirements.txt
22-
- run: python -m pip install ./fluent.syntax ./fluent.runtime
23-
- run: python -m flake8
24-
- run: python -m mypy fluent.syntax/fluent fluent.runtime/fluent
17+
python-version: 3.9
18+
- uses: actions/setup-python@v6
19+
- run: uv sync --dev --all-packages
20+
- run: uv run python -m flake8
21+
- run: uv run mypy fluent.syntax/fluent fluent.runtime/fluent
2522
test:
2623
runs-on: ${{ matrix.os }}
2724
strategy:
2825
matrix:
29-
os: [ubuntu-22.04, windows-2022]
30-
python-version: [3.7, 3.8, 3.9, "3.10", 3.11, 3.12, pypy3.9, pypy3.10]
26+
os: [ubuntu-latest, windows-latest, macos-latest]
27+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
3128
steps:
32-
- uses: actions/checkout@v4
33-
- uses: actions/setup-python@v5
29+
- uses: actions/checkout@v6
30+
- uses: astral-sh/setup-uv@v7
3431
with:
3532
python-version: ${{ matrix.python-version }}
36-
cache: pip
37-
cache-dependency-path: |
38-
fluent.syntax/setup.py
39-
fluent.runtime/setup.py
40-
- run: python -m pip install ./fluent.syntax ./fluent.runtime
41-
- run: python -m unittest discover -s fluent.syntax
42-
- run: python -m unittest discover -s fluent.runtime
33+
- run: uv sync --dev --all-packages
34+
- run: uv run pytest fluent.syntax
35+
- run: uv run pytest fluent.runtime
36+
- run: uv run pytest fluent.pygments
4337

44-
# Test compatibility with the oldest Python version we claim to support,
45-
# and for fluent.runtime's compatibility with a range of fluent.syntax versions.
38+
# Test fluent.runtime's compatibility with a range of fluent.syntax versions.
4639
compatibility:
47-
runs-on: ubuntu-20.04 # https://github.com/actions/setup-python/issues/544
40+
runs-on: ubuntu-22.04
4841
strategy:
4942
matrix:
5043
fluent-syntax:
@@ -53,10 +46,11 @@ jobs:
5346
- fluent.syntax==0.18.1 six
5447
- fluent.syntax==0.17.0 six
5548
steps:
56-
- uses: actions/checkout@v3
57-
- uses: actions/setup-python@v4
49+
- uses: actions/checkout@v6
50+
- uses: astral-sh/setup-uv@v7
5851
with:
59-
python-version: 3.6
60-
- run: python -m pip install ${{ matrix.fluent-syntax }}
61-
- run: python -m pip install ./fluent.runtime
62-
- run: python -m unittest discover -s fluent.runtime
52+
python-version: 3.12
53+
- run: uv venv
54+
- run: uv pip install ${{ matrix.fluent-syntax }}
55+
- run: uv pip install ./fluent.runtime
56+
- run: uv run pytest fluent.runtime

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"python.autoComplete.extraPaths": ["./fluent.syntax"],
3+
"python.analysis.extraPaths": ["./fluent.syntax"],
4+
"mypy-type-checker.ignorePatterns": ["**/tests/**"]
5+
}

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Project Fluent
2+
3+
This is a collection of Python packages to use the
4+
[Fluent localization system](http://projectfluent.org/):
5+
6+
## `fluent.syntax`
7+
8+
The [syntax package](./fluent.syntax) includes the
9+
parser, serializer, and traversal utilities like `Visitor` and `Transformer`.
10+
You’re looking for this package if you work on tooling for Fluent in Python.
11+
12+
## `fluent.runtime`
13+
14+
The [runtime package](./fluent.runtime) includes the library required to
15+
use Fluent to localize your Python application.
16+
It comes with a `Localization` class to use, based on an implementation of `FluentBundle`.
17+
It uses the tooling parser above to read Fluent files.
18+
19+
## `fluent.pygments`
20+
21+
A [plugin for pygments](./fluent.pygments) to add syntax highlighting to Sphinx.
22+
23+
## Discuss
24+
25+
We’d love to hear your thoughts on Project Fluent! Whether you’re a
26+
localizer looking for a better way to express yourself in your language,
27+
or a developer trying to make your app localizable and multilingual, or
28+
a hacker looking for a project to contribute to, please do get in touch
29+
on the mailing list and the IRC channel.
30+
31+
- Mozilla Discourse: https://discourse.mozilla.org/c/fluent
32+
- Matrix channel: [#fluent:mozilla.org](https://chat.mozilla.org/#/room/#fluent:mozilla.org)
33+
34+
## Get Involved
35+
36+
python-fluent is open-source, licensed under the Apache License, Version
37+
2.0. We encourage everyone to take a look at our code and we’ll listen
38+
to your feedback.

README.rst

Lines changed: 0 additions & 47 deletions
This file was deleted.

dev-requirements.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
import unittest
2-
31
from fluent.pygments.lexer import FluentLexer
42
from pygments.token import Token
53

64

7-
class LexerTest(unittest.TestCase):
8-
def setUp(self):
9-
self.lexer = FluentLexer()
10-
5+
class TestLexer:
116
def test_comment(self):
127
fragment = "# comment\n"
138
tokens = [
149
(Token.Comment.Multiline, "# comment"),
1510
(Token.Punctuation, "\n"),
1611
]
17-
self.assertEqual(tokens, list(self.lexer.get_tokens(fragment)))
12+
assert list(FluentLexer().get_tokens(fragment)) == tokens
1813

1914
def test_message(self):
2015
fragment = "msg = some value\n"
@@ -24,7 +19,7 @@ def test_message(self):
2419
(Token.Literal, "some value"),
2520
(Token.Punctuation, "\n"),
2621
]
27-
self.assertEqual(tokens, list(self.lexer.get_tokens(fragment)))
22+
assert list(FluentLexer().get_tokens(fragment)) == tokens
2823

2924
def test_message_with_comment(self):
3025
fragment = "# good comment\nmsg = some value\n"
@@ -36,4 +31,4 @@ def test_message_with_comment(self):
3631
(Token.Literal, "some value"),
3732
(Token.Punctuation, "\n"),
3833
]
39-
self.assertEqual(tokens, list(self.lexer.get_tokens(fragment)))
34+
assert list(FluentLexer().get_tokens(fragment)) == tokens

fluent.runtime/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# fluent.runtime
2+
3+
Use [Fluent](https://projectfluent.org/) to localize your Python application.
4+
It comes with a `Localization` class to use, based on an implementation of `FluentBundle`.
5+
It uses the parser from `fluent.syntax` to read Fluent files.
6+
7+
```python
8+
from datetime import date
9+
l10n = DemoLocalization("today-is = Today is { $today }")
10+
val = l10n.format_value("today-is", { "today": date.today() })
11+
val # 'Today is Jun 16, 2018'
12+
```
13+
14+
Find the full documentation at https://projectfluent.org/python-fluent/fluent.runtime/.

fluent.runtime/README.rst

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
from typing import Callable, Dict
1+
from typing import Callable
22

33
from .types import FluentType, fluent_date, fluent_number
44

55
NUMBER = fluent_number
66
DATETIME = fluent_date
77

88

9-
BUILTINS: Dict[str, Callable[..., FluentType]] = {
9+
BUILTINS: dict[str, Callable[..., FluentType]] = {
1010
"NUMBER": NUMBER,
1111
"DATETIME": DATETIME,
1212
}

0 commit comments

Comments
 (0)