Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Further configuration for FedoraProject #241

Merged
merged 6 commits into from
Apr 5, 2023
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
1 change: 1 addition & 0 deletions .distro/python-scikit-build-core.rpmlintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addFilter("files-duplicate .*/__init__.py")
32 changes: 13 additions & 19 deletions scikit-build-core.spec → .distro/scikit-build-core.spec
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
%global pypi_name scikit_build_core

Name: python-scikit-build-core
Version: 0.2.2
Version: 0.0.0
Release: %{autorelease}
Summary: Build backend for CMake based projects

License: Apache-2.0
URL: https://github.com/scikit-build/scikit-build-core
Source0: https://github.com/scikit-build/scikit-build-core/archive/refs/tags/v%{version}.tar.gz
Source0: %{pypi_source %{pypi_name}}
Source1: %{name}.rpmlintrc

BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: cmake
BuildRequires: ninja-build
BuildRequires: gcc
BuildRequires: gcc-c++
Requires: cmake
Recommends: (ninja-build or make)
Recommends: python3dist(pyproject-metadata)
Recommends: python3dist(pathspec)
Suggests: ninja-build
Suggests: gcc

%global _description %{expand:
A next generation Python CMake adaptor and Python API for plugins}
Expand All @@ -27,19 +24,16 @@ A next generation Python CMake adaptor and Python API for plugins}

%package -n python3-scikit-build-core
Summary: %{summary}
Requires: cmake
Recommends: (ninja-build or make)
Recommends: python3dist(pyproject-metadata)
Recommends: python3dist(pathspec)
Suggests: ninja-build
Suggests: gcc
%description -n python3-scikit-build-core %_description

%prep
# This assumes the source is not retrieved from tar ball, but built in place
# This makes it possible to build with `tito build --test`
# Change to `%%autosetup -n %%{pypi_name}-%%{version}` for release
# TODO: There should be a format to satisfy both
%setup -q
# TODO: Remove when tito upstream issue is fixed
# https://github.com/rpm-software-management/tito/issues/444
if grep -q "describe-name: \$Format" .git_archival.txt; then
sed -i "s/describe-name:.*/describe-name: v%{version}/g" .git_archival.txt
fi
%autosetup -n %{pypi_name}-%{version}

%generate_buildrequires
%pyproject_buildrequires -x test
Expand All @@ -50,7 +44,7 @@ fi

%install
%pyproject_install
%pyproject_save_files scikit_build_core
%pyproject_save_files %{pypi_name}


%check
Expand Down
48 changes: 48 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,3 +287,51 @@ cmake_extensions=[CMakeExtension("cmake_example")],
```

Which should eventually support multiple extensions.

# Downstream packaging

## Fedora packaging

We are using [`packit`](https://packit.dev/) to keep maintain the
[Fedora package](https://src.fedoraproject.org/rpms/python-scikit-build-core/).
There are two `packit` jobs one needs to keep in mind here:

- `copr_build`: Submits copr builds to:
- `@scikit-build/nightly` if there is a commit to `main`. This is intended for
users to test the current development build
- `@scikit-build/scikit-build-core` if there is a PR request. This is for CI
purposes to confirm that the build is successful
- `@scikit-build/release` whenever a new release is published on GitHub. Users
can use this to get the latest release before they land on Fedora. This is
also used for other copr projects to check the future release
- `propose_downstream`: Submits a PR to `src.fedoraproject.org` once a release
is published

To interact with `packit`, you can use
[`/packit command`](https://packit.dev/docs/guide/#how-to-re-trigger-packit-actions-in-your-pull-request)
in PRs and commit messages or [`packit` CLI](https://packit.dev/docs/cli/).
These interactions are primarily intended for controlling the CI managed on
`scikit-build`.

To debug and build locally or on your own copr project you may use
`packit build` commands, e.g. to build locally using `mock` for fedora rawhide:

```console
$ packit build in-mock -r /etc/mock/fedora-rawhide-x86_64.cfg
```

or for copr project `copr_user/scikit-build-core`:

```console
$ copr-cli edit-permissions --builder=packit copr_user/scikit-build-core
$ packit build in-copr --owner copr_user --project scikit-build-core
```

(Here we are making sure `packit` has the appropriate permission for
`copr_user/scikit-build-core` via the `copr-cli` command. You may need to
configure [`~/.config/copr`](https://packit.dev/docs/cli/build/copr/)) first

Both of these methods automatically edit the `Version` in the
[spec file](../.dist/scikit-build-core.spec), therefore it is intentionally
marked as `0.0.0` there to avoid manually updating. Make sure to not push these
changes in a PR.
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
with:
path: dist/*

- uses: pypa/[email protected].4
- uses: pypa/[email protected].5
if: github.event_name == 'release' && github.event.action == 'published'
with:
password: ${{ secrets.pypi_password }}
19 changes: 13 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ jobs:
pip install .[test,cov] cmake ninja rich hatch-fancy-pypi-readme
setuptools-scm

- name: Add NumPy
if: >
(matrix.runs-on == 'ubuntu-latest' || matrix.python-version !=
'pypy-3.8') && matrix.python-version != '3.12-dev'
run: "pip install --only-binary=:all: numpy"

- name: Test package
run: pytest -ra --showlocals --cov=scikit_build_core

Expand All @@ -105,7 +111,9 @@ jobs:
with:
cmake-version: "${{ matrix.cmake-version }}"

# Skipped on pypy to keep the tests fast
- name: Test min package
if: matrix.python-version != 'pypy-3.8'
run: pytest -ra --showlocals

cygwin:
Expand All @@ -121,8 +129,7 @@ jobs:
with:
platform: x86_64
packages:
cmake ninja git make gcc-g++ gcc-fortran python39 python39-devel
python39-pip
cmake ninja git make gcc-g++ python39 python39-devel python39-pip

- name: Install
run: python3.9 -m pip install .[test]
Expand All @@ -131,7 +138,7 @@ jobs:
run: python3.9 -m pytest -ra --showlocals -m "not virtualenv"

msys:
name: Tests on 🐍 3 • msys
name: Tests on 🐍 3 • msys UCRT
runs-on: windows-latest

defaults:
Expand All @@ -141,13 +148,13 @@ jobs:
steps:
- uses: msys2/setup-msys2@v2
with:
msystem: msys
msystem: UCRT64
path-type: minimal
update: true
install: >-
base-devel git
pacboy: >-
python python-pip gcc cmake
python:p python-pip:p gcc:p cmake:p

- uses: actions/checkout@v3
with:
Expand All @@ -157,7 +164,7 @@ jobs:
run: python -m pip install .[test]

- name: Test package
run: python -m pytest -ra --showlocals
run: python -m pytest -ra --showlocals -m "not broken_on_urct"

mingw64:
name: Tests on 🐍 3 • mingw64
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ tests/**/build/
*.swp

# RPM spec file
!/scikit-build-core.spec
!/.distro/scikit-build-core.spec
/.distro/*.tar.gz
*.rpm

# ruff
.ruff_cache/
Expand Down
57 changes: 57 additions & 0 deletions .packit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# See the documentation for more information:
# https://packit.dev/docs/configuration/

specfile_path: .distro/scikit-build-core.spec

files_to_sync:
- src: .distro/scikit-build-core.spec
dest: python-scikit-build-core.spec
- .packit.yaml
- src: .distro/python-scikit-build-core.rpmlintrc
dest: python-scikit-build-core.rpmlintrc
upstream_package_name: scikit_build_core
downstream_package_name: python-scikit-build-core
update_release: false
upstream_tag_template: v{version}

jobs:
- job: copr_build
trigger: pull_request
owner: "@scikit-build"
project: scikit-build-core
update_release: true
release_suffix: "{PACKIT_RPMSPEC_RELEASE}"
targets:
- fedora-development
- job: copr_build
trigger: commit
branch: main
owner: "@scikit-build"
project: nightly
targets:
- fedora-development-x86_64
- fedora-latest-x86_64
- fedora-development-aarch64
- fedora-latest-aarch64
- job: copr_build
trigger: release
owner: "@scikit-build"
project: release
targets:
- fedora-development-x86_64
- fedora-latest-x86_64
- fedora-development-aarch64
- fedora-latest-aarch64
- job: propose_downstream
trigger: release
dist_git_branches:
- fedora-development
- fedora-latest
- job: koji_build
trigger: commit
dist_git_branches:
- fedora-all
- job: bodhi_update
trigger: commit
dist_git_branches:
- fedora-branched
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ repos:
exclude: "^tests"

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.259
rev: v0.0.260
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand Down
3 changes: 0 additions & 3 deletions .tito/packages/.readme

This file was deleted.

5 changes: 0 additions & 5 deletions .tito/tito.props

This file was deleted.

11 changes: 7 additions & 4 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,11 @@ CMAKE_ARGS: -DSOME_DEFINE=ON;-DOTHER=OFF

## Dynamic metadata (WIP)

Scikit-build-core 0.3.0 will support dynamic metadata. This is experimental
until a release. The public interface for making a plugin is very experimental.
Scikit-build-core 0.3.0 will support dynamic metadata. This is not ready for
plugin development outside of scikit-build-core;
`tool.scikit-build.expiremental=true` is required to use external plugins, since
the interface is provisional. Nested arbitrary dicts (as seen here) are not
supported in config-settings or environment variables.

There currently are two built-in plugins for dynamic metadata.

Expand All @@ -388,7 +391,7 @@ name = "mypackage"
dynamic = ["version"]

[tool.scikit-build]
metadata.version = "scikit_build_core.metadata.setuptools_scm"
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
```

This sets the python project version according to
Expand Down Expand Up @@ -425,7 +428,7 @@ name = "mypackage"
dynamic = ["readme"]

[tool.scikit-build]
metadata.readme = "scikit_build_core.metadata.fancy_pypi_readme"
metadata.readme.provider = "scikit_build_core.metadata.fancy_pypi_readme"
```

:::
Expand Down
2 changes: 2 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def tests(session: nox.Session) -> None:
extra.append("cmake")
if shutil.which("ninja") is None:
extra.append("ninja")
if (3, 8) <= sys.version_info < (3, 12):
extra.append("numpy")

session.install("-e.[test]", *extra)
session.run("pytest", *session.posargs, env=env)
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ test = [
"cattrs >=22.2.0",
"gitpython",
"importlib_metadata; python_version<'3.8'",
"numpy; python_version>='3.8' and python_version<'3.12'",
"pathspec >=0.10.1",
"pybind11",
"pyproject-metadata >=0.5",
Expand Down Expand Up @@ -108,13 +107,14 @@ filterwarnings = [
log_cli_level = "info"
testpaths = ["tests"]
markers = [
"broken_on_urct: Broken for now due to lib not found",
"compile: Compiles code",
"configure: Configures CMake code",
"fortran: Fortran code",
"integration: Full package build",
"isolated: Needs an isolated virtualenv",
"setuptools: Tests setuptools integration",
"virtualenv: Needs a virtualenv",
"isolated: Needs an isolated virtualenv",
]


Expand Down
2 changes: 1 addition & 1 deletion src/scikit_build_core/build/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def _build_wheel_impl(

settings_reader.validate_may_exit()

metadata = get_standard_metadata(pyproject, settings, config_settings)
metadata = get_standard_metadata(pyproject, settings)

if metadata.version is None:
msg = "project.version is not statically specified, must be present currently"
Expand Down
Loading