Skip to content

Commit 4bef540

Browse files
sharadmvtensorflower-gardener
authored andcommitted
[Oryx] Use poetry/pyproject.toml for building/dependency management
- Also updates README.md - Also fixes matcher dispatch for Python3.9 PiperOrigin-RevId: 381165823
1 parent 8ed93b4 commit 4bef540

File tree

4 files changed

+82
-78
lines changed

4 files changed

+82
-78
lines changed

spinoffs/oryx/README.md

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,51 @@
11
# Oryx
22

33
Oryx is a library for probabilistic programming and deep learning built on top
4-
of Jax. The approach is to expose a set of function transformations that
5-
compose and integrate with JAX's existing transformations (e.g. `jit`, `grad`,
6-
and `vmap`).
4+
of Jax. The approach is to expose a set of function transformations that compose
5+
and integrate with JAX's existing transformations (e.g. `jit`, `grad`, and
6+
`vmap`).
7+
8+
## Installation
9+
10+
You can install Oryx via `pip`:
11+
12+
```bash
13+
$ pip install oryx
14+
```
715

816
## Documentation and Examples
917

10-
Coming soon!
18+
Documentation is available
19+
[on the Oryx website](https://www.tensorflow.org/probability/oryx/api_docs/python/oryx).
20+
21+
### Guides
22+
23+
* [A tour of Oryx](https://www.tensorflow.org/probability/oryx/notebooks/a_tour_of_oryx)
24+
* [Probabilistic programming](https://www.tensorflow.org/probability/oryx/notebooks/probabilistic_programming)
25+
26+
## Development
27+
28+
To develop and modify Oryx, you need to install
29+
[`poetry`](https://python-poetry.org/), a tool for Python packaging and
30+
dependency management.
31+
32+
To install the development dependencies of Oryx, you can run
33+
34+
```bash
35+
$ poetry install
36+
```
37+
38+
and to enter a virtual environment for testing or debugging, you can run:
39+
40+
```bash
41+
$ poetry shell
42+
```
43+
44+
### Running tests
45+
46+
Oryx uses [Bazel](https://bazel.build/) for building and testing. Once Bazel is
47+
installed, you can run tests by executing:
48+
49+
```
50+
$ poetry run bazel test //oryx/...
51+
```

spinoffs/oryx/oryx/experimental/matching/matcher.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@
230230
`Pattern` and implementing the `match(self, expr, bindings, succeed)` method,
231231
the class is automatically registered with `matcher`.
232232
"""
233+
import collections
233234
import functools
234235

235236
from typing import Any, Callable, Dict, Iterator, Optional, Sequence, TypeVar
@@ -601,7 +602,7 @@ def __init__(self,
601602
Dot, name=name, accumulate=accumulate, plus=plus, greedy=greedy)
602603

603604

604-
@matcher.register(Sequence)
605+
@matcher.register(collections.abc.Sequence)
605606
def sequence_matcher(pattern: Sequence[Any]):
606607
"""Returns a matcher for a given sequence pattern."""
607608

spinoffs/oryx/pyproject.toml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright 2021 The TensorFlow Probability Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ============================================================================
15+
[tool.poetry]
16+
name = "oryx"
17+
version = "0.2.0"
18+
description = "Probabilistic programming and deep learning in JAX"
19+
authors = ["Google LLC"]
20+
license = "Apache 2.0"
21+
22+
[tool.poetry.dependencies]
23+
python = "^3.6"
24+
jax = "0.2.16"
25+
jaxlib = "0.1.68"
26+
dataclasses = { version = "*", python = "<3.7" }
27+
tfp-nightly = {extras = ["jax"], version = "0.14.0-alpha.20210623"}
28+
29+
30+
[tool.poetry.dev-dependencies]
31+
inference-gym = "^0.0.4"
32+
33+
[build-system]
34+
requires = ["poetry-core>=1.0.0"]
35+
build-backend = "poetry.core.masonry.api"

spinoffs/oryx/setup.py

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

0 commit comments

Comments
 (0)