diff --git a/.github/workflows/core_test.yml b/.github/workflows/core_test.yml new file mode 100644 index 0000000..3ac1ebc --- /dev/null +++ b/.github/workflows/core_test.yml @@ -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 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..9dd6f2b --- /dev/null +++ b/requirements.txt @@ -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. diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..1343159 --- /dev/null +++ b/setup.py @@ -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='jaindeepali@google.com', + install_requires=_parse_requirements('requirements.txt'), + packages=setuptools.find_packages(), + )