Skip to content
Open
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
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[flake8]
exclude=.tox
exclude=.venv
extend-ignore = E203
max-line-length=120
53 changes: 23 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,38 @@ on:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
with:
cache: pip
cache-dependency-path: |
dev-requirements.txt
fluent.syntax/setup.py
fluent.runtime/setup.py
- run: python -m pip install -r dev-requirements.txt
- run: python -m pip install ./fluent.syntax ./fluent.runtime
- run: python -m flake8
- run: python -m mypy fluent.syntax/fluent fluent.runtime/fluent
python-version: 3.8
- uses: actions/setup-python@v6
- run: uv sync --dev --all-packages
- run: uv run python -m flake8
- run: uv run mypy fluent.syntax/fluent fluent.runtime/fluent
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, windows-2022]
python-version: [3.7, 3.8, 3.9, "3.10", 3.11, 3.12, pypy3.9, pypy3.10]
python-version: [3.8, 3.9, "3.10", 3.11, 3.12, pypy3.9, pypy3.10]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: |
fluent.syntax/setup.py
fluent.runtime/setup.py
- run: python -m pip install ./fluent.syntax ./fluent.runtime
- run: python -m unittest discover -s fluent.syntax
- run: python -m unittest discover -s fluent.runtime
- run: uv sync --dev --all-packages
- run: uv run python -m unittest discover -s fluent.syntax
- run: uv run python -m unittest discover -s fluent.runtime

# Test compatibility with the oldest Python version we claim to support,
# and for fluent.runtime's compatibility with a range of fluent.syntax versions.
# Test fluent.runtime's compatibility with a range of fluent.syntax versions.
compatibility:
runs-on: ubuntu-20.04 # https://github.com/actions/setup-python/issues/544
runs-on: ubuntu-22.04
strategy:
matrix:
fluent-syntax:
Expand All @@ -53,10 +45,11 @@ jobs:
- fluent.syntax==0.18.1 six
- fluent.syntax==0.17.0 six
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
with:
python-version: 3.6
- run: python -m pip install ${{ matrix.fluent-syntax }}
- run: python -m pip install ./fluent.runtime
- run: python -m unittest discover -s fluent.runtime
python-version: 3.8
- run: uv venv --python 3.8
- run: uv pip install ${{ matrix.fluent-syntax }}
- run: uv pip install ./fluent.runtime
- run: uv run python -m unittest discover -s fluent.runtime
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"python.autoComplete.extraPaths": ["./fluent.syntax"],
"python.analysis.extraPaths": ["./fluent.syntax"],
}
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Project Fluent

This is a collection of Python packages to use the
[Fluent localization system](http://projectfluent.org/):

## `fluent.syntax`

The [syntax package](./fluent.syntax) includes the
parser, serializer, and traversal utilities like `Visitor` and `Transformer`.
You’re looking for this package if you work on tooling for Fluent in Python.

## `fluent.runtime`

The [runtime package](./fluent.runtime) includes the library required to
use Fluent to localize your Python application.
It comes with a `Localization` class to use, based on an implementation of `FluentBundle`.
It uses the tooling parser above to read Fluent files.

## `fluent.pygments`

A [plugin for pygments](./fluent.pygments) to add syntax highlighting to Sphinx.

## Discuss

We’d love to hear your thoughts on Project Fluent! Whether you’re a
localizer looking for a better way to express yourself in your language,
or a developer trying to make your app localizable and multilingual, or
a hacker looking for a project to contribute to, please do get in touch
on the mailing list and the IRC channel.

- Mozilla Discourse: https://discourse.mozilla.org/c/fluent
- Matrix channel: [#fluent:mozilla.org](https://chat.mozilla.org/#/room/#fluent:mozilla.org)

## Get Involved

python-fluent is open-source, licensed under the Apache License, Version
2.0. We encourage everyone to take a look at our code and we’ll listen
to your feedback.
47 changes: 0 additions & 47 deletions README.rst

This file was deleted.

7 changes: 0 additions & 7 deletions dev-requirements.txt

This file was deleted.

14 changes: 14 additions & 0 deletions fluent.runtime/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# fluent.runtime

Use [Fluent](https://projectfluent.org/) to localize your Python application.
It comes with a `Localization` class to use, based on an implementation of `FluentBundle`.
It uses the parser from `fluent.syntax` to read Fluent files.

```python
from datetime import date
l10n = DemoLocalization("today-is = Today is { $today }")
val = l10n.format_value("today-is", { "today": date.today() })
val # 'Today is Jun 16, 2018'
```

Find the full documentation at https://projectfluent.org/python-fluent/fluent.runtime/.
19 changes: 0 additions & 19 deletions fluent.runtime/README.rst

This file was deleted.

34 changes: 34 additions & 0 deletions fluent.runtime/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[project]
name = "fluent.runtime"
version = "0.4.0"
requires-python = ">= 3.8"
dependencies = [
"fluent.syntax>=0.17,<0.20",
"attrs",
"babel",
"pytz",
"typing-extensions>=3.7,<5",
]
license = { text = "Apache-2.0" }
description = "Localization library for expressive translations."
keywords = ["fluent", "localization", "l10n"]
authors = [
{ name = "Mozilla", email = "l10n-drivers@mozilla.org" },
{ name = "Eemeli Aro", email = "eemeli@mozilla.com" },
{ name = "Luke Plant", email = "L.Plant.98@cantab.net" },
]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3 :: Only",
]

[project.urls]
repository = "https://github.com/projectfluent/python-fluent"

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
5 changes: 0 additions & 5 deletions fluent.runtime/setup.cfg

This file was deleted.

42 changes: 0 additions & 42 deletions fluent.runtime/setup.py

This file was deleted.

22 changes: 0 additions & 22 deletions fluent.runtime/tox.ini

This file was deleted.

17 changes: 17 additions & 0 deletions fluent.syntax/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# fluent.syntax

Read, write, and transform [Fluent](https://projectfluent.org/) files.

This package includes the parser, serializer, and traversal
utilities like Visitor and Transformer. You’re looking for this package
if you work on tooling for Fluent in Python.

```python
from fluent.syntax import parse, ast, serialize
resource = parse("a-key = String to localize")
resource.body[0].value.elements[0].value = "Localized string"
serialize(resource)
# 'a-key = Localized string\n'
```

Find the full documentation at https://projectfluent.org/python-fluent/fluent.syntax/.
22 changes: 0 additions & 22 deletions fluent.syntax/README.rst

This file was deleted.

27 changes: 27 additions & 0 deletions fluent.syntax/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[project]
name = "fluent.syntax"
version = "0.19.0"
requires-python = ">= 3.8"
dependencies = ["typing-extensions>=3.7,<5"]
license = { text = "Apache-2.0" }
description = "Localization library for expressive translations."
keywords = ["fluent", "localization", "l10n"]
authors = [
{ name = "Mozilla", email = "l10n-drivers@mozilla.org" },
{ name = "Eemeli Aro", email = "eemeli@mozilla.com" },
]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3 :: Only",
]

[project.urls]
repository = "https://github.com/projectfluent/python-fluent"

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
Loading
Loading