Skip to content
Open
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
111 changes: 109 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ on:
pull_request:

jobs:
build_and_test:
build_and_test_conda:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
pyversion: ["3.11", "3.12", "3.13", "3.14"]
python-version: ["3.11", "3.12", "3.13", "3.14"]

runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -54,3 +54,110 @@ jobs:
with:
files: tests/.tests/pytest-sconsUtils.xml-cov-sconsUtils.xml
token: ${{ secrets.CODECOV_TOKEN }}
build_and_test_pip:
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
# Need to clone everything for the git tags.
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "setup.cfg"
allow-prereleases: true

- name: Install dependencies
shell: bash -l {0}
run: |
pip install --upgrade pip uv
uv pip install --system -r requirements.txt

# We have two cores so we can speed up the testing with xdist
- name: Install pytest packages
shell: bash -l {0}
run: |
uv pip install --system pytest pytest-xdist

- name: Build and install
run: |
uv pip install --system --no-deps -v -e .

- name: Run tests
run: |
pytest --ignore=tests/test_simple.py -r a -v -n 3
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see there is a comment in test_simple.py explaining that they must be run with scons, but perhaps a comment here would be useful too. And perhaps it should be called test_with_scons.py or something more obvious?

scons -j2

check-changes:
outputs:
skip: ${{ steps.check.outputs.skip }}
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check if weekly changed
id: check
run: |
# Get SHA hashes for all weekly tags
weekly_sha=$(git tag -l 'w.*' | while read tag; do
git rev-list -n 1 "${tag}"
done)

echo "Weekly tag SHA ${weekly_sha}"
# Extract the current tag and its SHA
current_tag=${GITHUB_REF#refs/tags/}
echo "Current tag: ${current_tag}"
current_sha=$(git rev-list -1 "${current_tag}") || echo "no_value"
echo "Current sha: ${current_sha}"
# Count occurrences of the current SHA in the weekly SHA list
n=$(echo "${weekly_sha}" | grep -c "${current_sha}") || echo "0"
echo "Current tag ${current_tag} (${current_sha}) SHA found ${n} time(s)"

# Determine whether to skip the upload based on the count
if [ "${n}" -gt 1 ]; then
echo "Skip upload"
echo "skip=true" >> "${GITHUB_OUTPUT}"
else
echo "Enable upload"
echo "skip=false" >> "${GITHUB_OUTPUT}"
fi

pypi:
name: Upload release to PyPI
runs-on: ubuntu-latest
needs: [build_and_test_conda, build_and_test_pip, check-changes]
permissions:
id-token: write
if: "${{ ! startsWith(github.ref, 'refs/tags/w.') || needs.check-changes.outputs.skip == 'false' }}"

steps:
- uses: actions/checkout@v6
with:
# Need to clone everything to embed the version.
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.13"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel build

- name: Build and create distribution
run: |
python -m build --skip-dependency-check

- name: Upload
uses: pypa/gh-action-pypi-publish@release/v1
45 changes: 45 additions & 0 deletions .github/workflows/build_docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: docs

on:
push:
branches:
- main
pull_request:

jobs:
build_sphinx_docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
# Need to clone everything for the git tags.
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.13"
cache: "pip"
cache-dependency-path: "setup.cfg"

- name: Install graphviz
run: sudo apt-get install graphviz

- name: Update pip/wheel infrastructure
run: |
python -m pip install --upgrade pip uv
uv pip install --system wheel
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm vaguely aware that uv is supposed to be better than pip alone but is uv pip basically just for speed like mamba vs conda used to be, or are there other advantages?


- name: Install dependencies
run: |
uv pip install --system -r requirements.txt

- name: Build and install
run: uv pip install --system --no-deps -v .

- name: Install documenteer
run: uv pip install --system -r doc/requirements.txt

- name: Build documentation
working-directory: ./doc
run: package-docs build
19 changes: 17 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,36 @@ config.log
_build.log
_build.sh
_build.tags

*.o
*.os
*.so
*.cfgc
*.pyc
pytest_session.txt

# Built by sconsUtils
bin/
bin/makeLinkFarm
bin/sconsOpts
python/lsst/sconsUtils/version.py

# Built by pip install
python/lsst_sconsUtils.egg-info/

# docs
doc/api
doc/html
doc/doxygen.conf
doc/sconsUtils.tag

# Pytest
tests/.tests
tests/testFailedTests/python
tests/testFailedTests/tests/.tests
.coverage
python/*.dist-info/

dist/

# IDEs
.idea
.vscode
2 changes: 2 additions & 0 deletions COPYRIGHT
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Copyright 2024 Association of Universities for Research in Astronomy, Inc. (AURA)
Copyright 2024 The Trustees of Princeton University
3 changes: 3 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This software is dual licensed under the GNU General Public License and also
under a 3-clause BSD license. Recipients may choose which of these licenses
to use; please see the files gpl-3.0.txt and/or bsd_license.txt, respectively.
35 changes: 0 additions & 35 deletions README

This file was deleted.

21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# lsst-sconsUtils

[![codecov](https://codecov.io/gh/lsst/sconsUtils/branch/main/graph/badge.svg?token=2BUBL8R9RH)](https://codecov.io/gh/lsst/sconsUtils)

sconsUtils is a package in the [LSST Science Pipelines](https://pipelines.lsst.io/).

This package contains utility scripts for building pipelines packages with
[SCons](https://scons.org/), and is required to build most pipelines packages.
SCons can be used to build C++ and Python (with pybind11 bindings) packages;
see the [stack package templates](https://github.com/lsst/templates/tree/main/project_templates/stack_package)
if this is of interest.

This is a **Python 3 only** package.

This software is dual licensed under the GNU General Public License
(version 3 of the License, or (at your option) any later version),
and also under a 3-clause BSD license. Recipients may choose which of these
licenses to use; please see the files gpl-3.0.txt and/or bsd_license.txt,
respectively.

This package can only be imported through a SCons script.
27 changes: 27 additions & 0 deletions bsd_license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
For copyright information see the COPYRIGHT file included in the top-level
directory of this distribution.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

3. Neither the names of the copyright holders nor the names of their
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9 changes: 3 additions & 6 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@

This configuration only affects single-package Sphinx documentation builds.
"""
# ruff: noqa: F403, F405

from documenteer.conf.pipelinespkg import * # noqa: F403, import *
from documenteer.conf.guide import *

project = "sconsUtils"
html_theme_options["logotext"] = project # noqa: F405, unknown name
html_title = project
html_short_title = project
doxylink = {}
exclude_patterns.append("changes/*")
19 changes: 19 additions & 0 deletions doc/documenteer.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[project]
title = "lsst-sconsUtils"

[project.python]
package = "lsst-sconsUtils"

[build]
clean = true

[sphinx]

nitpick_ignore = [
]
nitpick_ignore_regex = [
]

[sphinx.intersphinx.projects]
python = "https://docs.python.org/3"
scons = "https://scons.org/doc/4.10.0/HTML/scons-api/"
4 changes: 3 additions & 1 deletion doc/lsst.sconsUtils/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Contributing
============

``lsst.sconsUtils`` is developed at https://github.com/lsst/sconsUtils.
You can find Jira issues for this module under the `sconsUtils <https://jira.lsstcorp.org/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20sconsUtils>`_ component.
You can find Jira issues for this module under the `sconsUtils <https://rubinobs.atlassian.net/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20sconsUtils>`_ component.

.. _lsst.sconsUtils-pyapi:

Expand All @@ -34,11 +34,13 @@ Python API reference
:no-inheritance-diagram:
.. automodapi:: lsst.sconsUtils.dependencies
:no-main-docstr:
:no-inheritance-diagram:
.. automodapi:: lsst.sconsUtils.tests
:no-main-docstr:
:no-inheritance-diagram:
.. automodapi:: lsst.sconsUtils.installation
:no-main-docstr:
:no-inheritance-diagram:
.. automodapi:: lsst.sconsUtils.builders
:no-main-docstr:
:no-inheritance-diagram:
Expand Down
1 change: 1 addition & 0 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lsst-sphinxutils @ git+https://github.com/lsst/sphinxutils@main
Loading