Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 60 additions & 19 deletions .github/workflows/release-build.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,76 @@
name: Release workflow - Build and Publish Package
# This workflow will upload a Python Package to PyPI when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

name: Upload Python Package

on:
push:
branches:
- main
paths:
- 'version.py' # Only run when the version is bumped
release:
types: [published]

permissions:
contents: read

jobs:
build-and-publish:
runs-on: ubuntu-22.04
permissions:
id-token: write
contents: read
release-build:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.version }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Fetch sufficient history for setuptools-scm to find tags
# Using 50 commits should cover most scenarios while being faster than full history
fetch-depth: 50

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: "3.12"

- name: Install dependencies
- name: Get version from setuptools-scm
id: get_version
run: |
python -m pip install --upgrade pip
python -m pip install setuptools wheel twine
python -m pip install setuptools-scm
version=$(python -m setuptools_scm)
echo "version=$version" >> $GITHUB_OUTPUT
echo "Package version: $version"

- name: Build package
- name: Build release distributions
run: |
python setup.py sdist bdist_wheel
python -m pip install build
python -m build

- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/

- name: Publish package to PyPI
pypi-publish:
runs-on: ubuntu-latest
needs:
- release-build
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write

# Dedicated environments with protections for publishing are strongly recommended.
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
environment:
name: pypi
# PyPI project URL with the exact version (e.g., 1.3.3 or 1.3.3b3)
url: https://pypi.org/project/oscar-python/${{ needs.release-build.outputs.version }}/

steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/

- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
119 changes: 0 additions & 119 deletions .github/workflows/release-version.yaml

This file was deleted.

8 changes: 5 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: tests

on:
push:
branches: ["main"]
branches: ["main", "devel"]
pull_request:
branches: ["main"]
branches: ["main", "devel"]

jobs:
test:
Expand All @@ -19,7 +19,9 @@ jobs:
python-version: '3.12'

- name: Install dependencies
run: python -m pip install pytest pytest-cov webdavclient3 requests boto3 pyyaml aiohttp liboidcagent
run: |
python -m pip install --upgrade pip
python -m pip install -e .[dev]

- name: Run tests
run: python -m pytest tests --cov=oscar_python
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Python OSCAR client

[![Build](https://github.com/grycap/oscar_python/actions/workflows/release-build.yaml/badge.svg)](https://github.com/grycap/oscar_python/actions/workflows/release-build.yaml)
![PyPI](https://img.shields.io/pypi/v/oscar_python)
[![Tests](https://github.com/grycap/oscar_python/actions/workflows/tests.yaml/badge.svg?branch=main)](https://github.com/grycap/oscar_python/actions/workflows/tests.yaml)
[![PyPI](https://img.shields.io/pypi/v/oscar-python)](https://pypi.org/project/oscar-python/)

This package provides a client to interact with OSCAR (https://oscar.grycap.net) clusters and services. It is available on Pypi with the name [oscar-python](https://pypi.org/project/oscar-python/).

Expand Down
38 changes: 38 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[build-system]
requires = ["setuptools>=64", "setuptools-scm>=8"]
build-backend = "setuptools.build_meta"

[project]
name = "oscar-python"
dynamic = ["version"]
description = "Python client for OSCAR clusters"
readme = "README.md"
requires-python = ">=3.8"
license = {text = "Apache-2.0"}
authors = [{name = "GRyCAP - I3M - UPV"}]
keywords = ["oscar", "faas", "serverless"]

dependencies = [
"requests",
"webdavclient3>=3.14.6",
"boto3",
"pyyaml",
"aiohttp",
"liboidcagent",
]

[project.optional-dependencies]
dev = [
"pytest",
"pytest-cov",
]

[project.urls]
Homepage = "https://github.com/grycap/oscar-python"
Repository = "https://github.com/grycap/oscar-python"

[tool.setuptools]
packages = ["oscar_python"]

[tool.setuptools_scm]
# Automatically get version from git tags
38 changes: 5 additions & 33 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from setuptools import setup, find_namespace_packages
"""Minimal setup.py for backward compatibility.
All configuration is now in pyproject.toml.
"""

# Load readme
with open('README.md', mode='r', encoding='utf-8') as f:
readme = f.read()
from setuptools import setup

# Load version
with open('version.py', mode='r', encoding='utf-8') as f:
exec(f.read())


setup(name='oscar_python',
version=__version__,
description='OSCAR API for python',
long_description=readme,
long_description_content_type='text/markdown',
url='https://github.com/grycap/oscar_python',
author='GRyCAP - Universitat Politecnica de Valencia',
author_email='[email protected]',
license='Apache 2.0',
packages=find_namespace_packages(),
install_requires=[
'webdavclient3 == 3.14.6',
'requests',
'boto3',
'setuptools >= 40.8.0',
'pyyaml',
'aiohttp',
'liboidcagent',
],
classifiers=[
'Programming Language :: Python :: 3',
'License :: OSI Approved :: Apache Software License'
],
zip_safe=False)
setup()
17 changes: 0 additions & 17 deletions version.py

This file was deleted.

Loading