Skip to content

OpenAstronomy/build-python-dist

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

build-python-dist

.github/workflows/main.yml

A GitHub action to build and test a source distribution for a Python package, and optionally a wheel for pure Python packages.

To build wheels for packages with extensions, you should instead use cibuildwheel which also includes a GitHub action for convenience.

Examples

Build a source distribution with no testing:

jobs:
  build_sdist:
    name: Build source distribution
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - id: build
        uses: OpenAstronomy/build-python-dist@v1

Build a source distribution with testing

jobs:
  build_sdist:
    name: Build source distribution
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - id: build
        uses: OpenAstronomy/build-python-dist@v1
        with:
          test_extras: test
          test_command: pytest --pyargs test_package

The test_extras option, if specified, should contain a string (e.g. test or test,all) that will be used to determine which 'extras' should be installed when testing. The test_command option should contain the full command to use for testing the installed package (this is run from an empty temporary directory).

Build a source distribution and wheel for a pure-Python package

jobs:
  build_sdist_and_wheel:
    name: Build source distribution and pure-Python wheel
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - id: build
        uses: OpenAstronomy/build-python-dist@v1
        with:
          pure_python_wheel: true
          test_extras: test
          test_command: pytest --pyargs test_package

Custom Python version

By default, the actions/setup-python action will install the latest Python 3 version for building and testing, however, the OpenAstronomy/build-python-dist action accepts a python-version string input to select a specific version,

jobs:
  build_sdist:
    name: Build source distribution
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - id: build
        uses: OpenAstronomy/build-python-dist@v1
        with:
          test_extras: test
          test_command: pytest --pyargs test_package
          python-version: '3.9'

Notes

If you want to use the latest available version of this action instead of hard-coding a specific version, you can replace OpenAstronomy/build-python-dist@v1 by OpenAstronomy/build-python-dist@main.

About

GitHub action to build a source distribution for a Python package, and optionally a wheel for pure-Python packages.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages