From a965ae6faea1bdb60e9d2efc35d9fe17f91d1171 Mon Sep 17 00:00:00 2001 From: Romeo Kienzler <5694071+romeokienzler@users.noreply.github.com> Date: Wed, 17 Sep 2025 10:48:52 +0200 Subject: [PATCH 1/2] Update package name and version in pyproject.toml --- pyproject.toml | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..91daa3a --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,41 @@ +[build-system] +requires = ["setuptools>=61.0", "wheel", "setuptools_scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "mlx" # <--- change to your package name on PyPI +version = "0.1" # setuptools_scm will override when building from git tags +description = "Machine Learning Exchange (MLX) library" +readme = "README.md" +requires-python = ">=3.8" +license = { text = "Apache-2.0" } +authors = [ + { name = "The Machine Learning Exchange Authors", email = "terratorch@ibm.com" } +] +keywords = ["ml", "registry", "package"] +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent" +] + +[project.urls] +"Homepage" = "https://github.com/machine-learning-exchange/mlx" +"Source" = "https://github.com/machine-learning-exchange/mlx" + +[project.dependencies] +# put runtime deps here, for example: +claimed + +[tool.setuptools.packages.find] +where = ["mlx"] +exclude = ["tests*"] + +[tool.setuptools] +package-dir = { "" = "mlx" } +# If you use package-data, configure here or use MANIFEST.in if needed + +[tool.setuptools_scm] +# use git tags like v1.2.3 to generate versions +version_scheme = "post-release" +local_scheme = "no-local-version" From e04c9daffdf19f28a3d07912322d9c8e5a5d6c83 Mon Sep 17 00:00:00 2001 From: Romeo Kienzler Date: Wed, 17 Sep 2025 11:01:23 +0200 Subject: [PATCH 2/2] reorg, add auto publish to pypi --- .github/workflows/codeql-analysis.yml | 75 ------------ .github/workflows/mlx-ci.yml | 111 ------------------ .github/workflows/publish-pypi.yml | 37 ++++++ .github/workflows/verify-links.yml | 38 ------ src/mlx/__init__.py | 0 {mlx => src/mlx}/cos_backend.py | 0 {mlx => src/mlx}/s3_kv_store.py | 0 {schema => src/schema}/dataset.json | 0 {schema => src/schema}/job.json | 0 {schema => src/schema}/model.json | 0 {schema => src/schema}/notebook.json | 0 {schema => src/schema}/pipeline.json | 0 {schema => src/schema}/pipeline_operator.json | 0 13 files changed, 37 insertions(+), 224 deletions(-) delete mode 100644 .github/workflows/codeql-analysis.yml delete mode 100644 .github/workflows/mlx-ci.yml create mode 100644 .github/workflows/publish-pypi.yml delete mode 100644 .github/workflows/verify-links.yml create mode 100644 src/mlx/__init__.py rename {mlx => src/mlx}/cos_backend.py (100%) rename {mlx => src/mlx}/s3_kv_store.py (100%) rename {schema => src/schema}/dataset.json (100%) rename {schema => src/schema}/job.json (100%) rename {schema => src/schema}/model.json (100%) rename {schema => src/schema}/notebook.json (100%) rename {schema => src/schema}/pipeline.json (100%) rename {schema => src/schema}/pipeline_operator.json (100%) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index d2cd567..0000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,75 +0,0 @@ -# Copyright 2021 The MLX Contributors -# -# SPDX-License-Identifier: Apache-2.0 - -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ main ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ main ] - schedule: - - cron: '19 8 * * 2' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'javascript', 'python' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 - - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/mlx-ci.yml b/.github/workflows/mlx-ci.yml deleted file mode 100644 index b005186..0000000 --- a/.github/workflows/mlx-ci.yml +++ /dev/null @@ -1,111 +0,0 @@ -# Copyright 2021 The MLX Contributors -# -# SPDX-License-Identifier: Apache-2.0 - -name: Build MLX API and UI images - -on: - push: - branches: - - main - - tags: - - v* - - # Run tests for any PRs. - pull_request: - -env: - GITHUB_ACTION: "true" - DOCKER_REGISTRY: mlexchange - UI_IMAGE_TAG: nightly-origin-main - API_IMAGE_TAG: nightly-main - -jobs: - python-flake8: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.7] - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: pip install flake8 - - name: "Python flake8 check" - run: flake8 . --count --exclude=./api/server/swagger_server/code_templates --select=E9,F63,F7,F82 --show-source --statistics - ui-build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: docker/setup-qemu-action@v1 - - uses: docker/setup-buildx-action@v1 - # Only login when pushing to main branch - - uses: docker/login-action@v1 - if: github.event_name == 'push' - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Get the version - id: get_version - run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) - - uses: docker/build-push-action@v2 - if: github.event_name != 'push' - with: - context: dashboard/origin-mlx - push: false - file: dashboard/origin-mlx/Dockerfile - tags: ${{ env.DOCKER_REGISTRY }}/mlx-ui:${{ env.UI_IMAGE_TAG }} - - uses: docker/build-push-action@v2 - if: github.event_name == 'push' && github.ref == 'refs/heads/main' - with: - context: dashboard/origin-mlx - push: true - file: dashboard/origin-mlx/Dockerfile - tags: ${{ env.DOCKER_REGISTRY }}/mlx-ui:${{ env.UI_IMAGE_TAG }} - - uses: docker/build-push-action@v2 - if: github.event_name == 'push' && github.ref != 'refs/heads/main' - with: - context: dashboard/origin-mlx - push: true - file: dashboard/origin-mlx/Dockerfile - tags: ${{ env.DOCKER_REGISTRY }}/mlx-ui:${{ steps.get_version.outputs.VERSION }} - api-build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: docker/setup-qemu-action@v1 - - uses: docker/setup-buildx-action@v1 - # Only login when pushing to main branch - - uses: docker/login-action@v1 - if: github.event_name == 'push' - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Get the version - id: get_version - run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) - - uses: docker/build-push-action@v2 - if: github.event_name != 'push' - with: - context: api/server - push: false - file: api/server/Dockerfile - tags: ${{ env.DOCKER_REGISTRY }}/mlx-api:${{ env.API_IMAGE_TAG }} - - uses: docker/build-push-action@v2 - if: github.event_name == 'push' && github.ref == 'refs/heads/main' - with: - context: api/server - push: true - file: api/server/Dockerfile - tags: ${{ env.DOCKER_REGISTRY }}/mlx-api:${{ env.API_IMAGE_TAG }} - - uses: docker/build-push-action@v2 - if: github.event_name == 'push' && github.ref != 'refs/heads/main' - with: - context: api/server - push: true - file: api/server/Dockerfile - tags: ${{ env.DOCKER_REGISTRY }}/mlx-api:${{ steps.get_version.outputs.VERSION }} diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml new file mode 100644 index 0000000..935daa9 --- /dev/null +++ b/.github/workflows/publish-pypi.yml @@ -0,0 +1,37 @@ +name: Build and publish Python package + +on: + push: + tags: + - 'v*' # publish only on tag pushes like v1.2.3 + +jobs: + build-and-publish: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 # necessary for setuptools_scm to see tags + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: Install build & twine + run: python -m pip install --upgrade pip build twine setuptools_scm + + - name: Build sdist and wheel + run: python -m build --sdist --wheel + + - name: Check artifacts + run: ls -l dist + + - name: Publish to PyPI + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: | + python -m twine check dist/* + python -m twine upload dist/* --non-interactive diff --git a/.github/workflows/verify-links.yml b/.github/workflows/verify-links.yml deleted file mode 100644 index 3b034a0..0000000 --- a/.github/workflows/verify-links.yml +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 2021 The MLX Contributors -# -# SPDX-License-Identifier: Apache-2.0 - -name: Verify Links - -on: - push: - branches: - - main - - tags: - - v* - - pull_request: - -jobs: - check-links: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.7] - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: pip install requests - - - name: Link check - run: | - ./tools/python/verify_doc_links.py - diff --git a/src/mlx/__init__.py b/src/mlx/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/mlx/cos_backend.py b/src/mlx/cos_backend.py similarity index 100% rename from mlx/cos_backend.py rename to src/mlx/cos_backend.py diff --git a/mlx/s3_kv_store.py b/src/mlx/s3_kv_store.py similarity index 100% rename from mlx/s3_kv_store.py rename to src/mlx/s3_kv_store.py diff --git a/schema/dataset.json b/src/schema/dataset.json similarity index 100% rename from schema/dataset.json rename to src/schema/dataset.json diff --git a/schema/job.json b/src/schema/job.json similarity index 100% rename from schema/job.json rename to src/schema/job.json diff --git a/schema/model.json b/src/schema/model.json similarity index 100% rename from schema/model.json rename to src/schema/model.json diff --git a/schema/notebook.json b/src/schema/notebook.json similarity index 100% rename from schema/notebook.json rename to src/schema/notebook.json diff --git a/schema/pipeline.json b/src/schema/pipeline.json similarity index 100% rename from schema/pipeline.json rename to src/schema/pipeline.json diff --git a/schema/pipeline_operator.json b/src/schema/pipeline_operator.json similarity index 100% rename from schema/pipeline_operator.json rename to src/schema/pipeline_operator.json