Skip to content

Commit cda9de6

Browse files
committed
syntax: Include py.typed, declare __all__
1 parent 5d6957b commit cda9de6

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

fluent.syntax/fluent/syntax/__init__.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,33 @@
11
from typing import Any
2-
from .ast import Resource
2+
3+
from . import ast
4+
from .errors import ParseError
35
from .parser import FluentParser
46
from .serializer import FluentSerializer
7+
from .stream import FluentParserStream
8+
from .visitor import Transformer, Visitor
9+
10+
__all__ = [
11+
'FluentParser',
12+
'FluentParserStream',
13+
'FluentSerializer',
14+
'ParseError',
15+
'Transformer',
16+
'Visitor',
17+
'ast',
18+
'parse',
19+
'serialize'
20+
]
521

622

7-
def parse(source: str, **kwargs: Any) -> Resource:
23+
def parse(source: str, **kwargs: Any) -> ast.Resource:
824
"""Create an ast.Resource from a Fluent Syntax source.
925
"""
1026
parser = FluentParser(**kwargs)
1127
return parser.parse(source)
1228

1329

14-
def serialize(resource: Resource, **kwargs: Any) -> str:
30+
def serialize(resource: ast.Resource, **kwargs: Any) -> str:
1531
"""Serialize an ast.Resource to a unicode string.
1632
"""
1733
serializer = FluentSerializer(**kwargs)

fluent.syntax/fluent/syntax/py.typed

Whitespace-only changes.

fluent.syntax/setup.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
from setuptools import setup, find_namespace_packages
2-
import os
1+
from os import path
2+
from setuptools import setup
33

4-
this_directory = os.path.abspath(os.path.dirname(__file__))
5-
with open(os.path.join(this_directory, 'README.rst'), 'rb') as f:
4+
this_directory = path.abspath(path.dirname(__file__))
5+
with open(path.join(this_directory, 'README.rst'), 'rb') as f:
66
long_description = f.read().decode('utf-8')
77

88
setup(name='fluent.syntax',
@@ -24,6 +24,7 @@
2424
'Programming Language :: Python :: 3.9',
2525
'Programming Language :: Python :: 3 :: Only',
2626
],
27-
packages=find_namespace_packages(include=['fluent.*']),
27+
packages=['fluent.syntax'],
28+
package_data={'fluent.syntax': ['py.typed']},
2829
test_suite='tests.syntax'
2930
)

0 commit comments

Comments
 (0)