Skip to content

Commit

Permalink
Fix auto-publish tool, replace setup.py with pyproject.toml standard,…
Browse files Browse the repository at this point in the history
… disable duplicate builds.

PiperOrigin-RevId: 490342029
  • Loading branch information
ajain-23 authored and copybara-github committed Nov 22, 2022
1 parent 3ed1730 commit 42a9dcc
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 100 deletions.
30 changes: 0 additions & 30 deletions .github/workflows/auto-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,13 @@ name: Auto-publish
on: [push, workflow_dispatch]

jobs:
pytest-job:
runs-on: ubuntu-latest
strategy:
matrix:
# LINT.IfChange
python-version: [3.7, 3.8, 3.9]
# LINT.ThenChange(build.yml)

timeout-minutes: 30

steps:
- uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v3

# Install deps
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- run: pip --version
- run: pip install -e .[all,dev]
- run: pip freeze

# Run tests
- name: Run core tests
run: pytest -vv -n auto

publish-job:
# Only try to publish if:
# * Repo is self (prevents running from forks)
# * Branch is `main`
if: |
github.repository == 'google/orbax'
&& github.ref == 'refs/heads/main'
needs: pytest-job # Only publish after tests are successful
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ jobs:
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
uses: etils-actions/pypi-build-publish@v1
with:
pypi-token: ${{ secrets.PYPI_API_TOKEN }}
5 changes: 4 additions & 1 deletion orbax/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Place holder for orbax package, does nothing.
"""Orbax API."""

# A new PyPI release will be pushed everytime `__version__` is increased.
__version__ = '0.0.18'
47 changes: 47 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[build-system]
requires = ["flit_core >=3.5,<4"]
build-backend = "flit_core.buildapi"

[project]
name = 'orbax'
description='Orbax'
readme = 'README.md'
license = {file = 'LICENSE'}
requires-python = '>=3.7'
authors = [{name = 'Orbax Authors', email='[email protected]'}]
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
]

keywords = ['JAX machine learning']

dependencies = [
'absl-py',
'cached_property',
'importlib_resources',
'etils',
'flax',
'importlib_resources',
'jax',
'jaxlib',
'numpy',
'pytest',
'pyyaml',
'tensorstore >= 0.1.20',
]

dynamic = ['version']

[project.urls]
homepage = 'http://github.com/google/orbax'
repository = 'http://github.com/google/orbax'

[project.optional-dependencies]
dev = [
'pytest-xdist'
]
63 changes: 0 additions & 63 deletions setup.py

This file was deleted.

0 comments on commit 42a9dcc

Please sign in to comment.