Skip to content

Commit

Permalink
Internal Change.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 623473453
  • Loading branch information
xingyousong committed May 14, 2024
1 parent 5ccf3a6 commit 17d75ec
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/core_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: pytest_core

on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
test-ubuntu:
name: "pytest on ${{ matrix.python-version }} on ${{ matrix.os }}"
runs-on: "${{ matrix.os }}"
strategy:
matrix:
python-version: [3.9]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install essential dependencies
run: |
python -m pip install --upgrade pip
pip install wheel
pip install pytest pytest-xdist
- name: Install package
run: |
pip install -e .
- name: Print installed dependencies
run: |
pip freeze
- name: Test with pytest # (TODO: Automate Iris installation)
run: |
# pytest -n auto iris
16 changes: 16 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Standard packages.
typing # Version dependent on Python version.
pytest # Use the latest version to match github workflow.
absl-py>=1.0.0

# Distributed systems libraries.
dm-launchpad

# Configuration + Experimentation
ml-collections

# Numerical packages.
numpy>=1.21.5
jax # Use latest version.
jaxlib # Use latest version.
flax # Use latest version.
43 changes: 43 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2024 Google LLC.
#
# 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.

"""Setup for pip package."""
import setuptools


def _strip_comments_from_line(s: str) -> str:
"""Parses a line of a requirements.txt file."""
requirement, *_ = s.split('#')
return requirement.strip()


def _parse_requirements(requirements_txt_path: str) -> list[str]:
"""Returns a list of dependencies for setup() from requirements.txt."""

with open(requirements_txt_path) as fp:
# Parse comments.
lines = [_strip_comments_from_line(line) for line in fp.read().splitlines()]
# Remove empty lines and direct github repos (not allowed in setup.py)
return [l for l in lines if (l and 'github.com' not in l)]


setuptools.setup(
name='google-iris',
version='1.0',
description='Iris',
author='Iris Team',
author_email='[email protected]',
install_requires=_parse_requirements('requirements.txt'),
packages=setuptools.find_packages(),
)

0 comments on commit 17d75ec

Please sign in to comment.