Skip to content

Commit

Permalink
[Oryx] Use poetry/pyproject.toml for building/dependency management
Browse files Browse the repository at this point in the history
- Also updates README.md
- Also fixes matcher dispatch for Python3.9

PiperOrigin-RevId: 381165823
  • Loading branch information
sharadmv authored and tensorflower-gardener committed Jun 24, 2021
1 parent 8ed93b4 commit 4bef540
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 78 deletions.
49 changes: 45 additions & 4 deletions spinoffs/oryx/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,51 @@
# Oryx

Oryx is a library for probabilistic programming and deep learning built on top
of Jax. The approach is to expose a set of function transformations that
compose and integrate with JAX's existing transformations (e.g. `jit`, `grad`,
and `vmap`).
of Jax. The approach is to expose a set of function transformations that compose
and integrate with JAX's existing transformations (e.g. `jit`, `grad`, and
`vmap`).

## Installation

You can install Oryx via `pip`:

```bash
$ pip install oryx
```

## Documentation and Examples

Coming soon!
Documentation is available
[on the Oryx website](https://www.tensorflow.org/probability/oryx/api_docs/python/oryx).

### Guides

* [A tour of Oryx](https://www.tensorflow.org/probability/oryx/notebooks/a_tour_of_oryx)
* [Probabilistic programming](https://www.tensorflow.org/probability/oryx/notebooks/probabilistic_programming)

## Development

To develop and modify Oryx, you need to install
[`poetry`](https://python-poetry.org/), a tool for Python packaging and
dependency management.

To install the development dependencies of Oryx, you can run

```bash
$ poetry install
```

and to enter a virtual environment for testing or debugging, you can run:

```bash
$ poetry shell
```

### Running tests

Oryx uses [Bazel](https://bazel.build/) for building and testing. Once Bazel is
installed, you can run tests by executing:

```
$ poetry run bazel test //oryx/...
```
3 changes: 2 additions & 1 deletion spinoffs/oryx/oryx/experimental/matching/matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@
`Pattern` and implementing the `match(self, expr, bindings, succeed)` method,
the class is automatically registered with `matcher`.
"""
import collections
import functools

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


@matcher.register(Sequence)
@matcher.register(collections.abc.Sequence)
def sequence_matcher(pattern: Sequence[Any]):
"""Returns a matcher for a given sequence pattern."""

Expand Down
35 changes: 35 additions & 0 deletions spinoffs/oryx/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright 2021 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
[tool.poetry]
name = "oryx"
version = "0.2.0"
description = "Probabilistic programming and deep learning in JAX"
authors = ["Google LLC"]
license = "Apache 2.0"

[tool.poetry.dependencies]
python = "^3.6"
jax = "0.2.16"
jaxlib = "0.1.68"
dataclasses = { version = "*", python = "<3.7" }
tfp-nightly = {extras = ["jax"], version = "0.14.0-alpha.20210623"}


[tool.poetry.dev-dependencies]
inference-gym = "^0.0.4"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
73 changes: 0 additions & 73 deletions spinoffs/oryx/setup.py

This file was deleted.

0 comments on commit 4bef540

Please sign in to comment.