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

Package update #99

Merged
merged 19 commits into from
Nov 6, 2024
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
7 changes: 3 additions & 4 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,17 @@ jobs:
runs-on: ubuntu-latest
name: Build docs
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: 3.9
mamba-version: "*"
channels: conda-forge
activate-environment: lume-model-dev
environment-file: dev-environment.yml
- name: Build package
shell: bash -l {0}
run: |
pip install -e .
pip install -e ".[docs]"
- name: Build docs
shell: bash -l {0}
run: |
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish Python distributions to PyPI

on:
release:
types: [published]

jobs:
build-n-publish:
if: ${{ github.repository == 'slaclab/lume-model' }}
name: Build and publish Python distributions to PyPI
runs-on: ubuntu-latest
environment: deployment
permissions:
id-token: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install build
run: |
python -m pip install build
- name: Build a source tarball
run: |
sudo python3 -m build
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
26 changes: 15 additions & 11 deletions .github/workflows/build.yml → .github/workflows/test_build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build lume-model
name: Test build lume-model

on:
push:
Expand All @@ -11,31 +11,35 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.9", "3.12"]
python-version: ["3.9", "3.11", "3.12"]

name: Python ${{ matrix.python-version }}, ${{ matrix.os }} build
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
channels: conda-forge
activate-environment: lume-model-dev
environment-file: dev-environment.yml

- name: Install lume-model
shell: bash -l {0}
run: |
pip install -e .
pip install -e ".[dev]"

- name: Run Tests
shell: bash -l {0}
run: |
pytest -ra --pyargs tests -k "not keras"
pytest -ra --pyargs tests

- name: Build package
- name: Install build
shell: bash -l {0}
run: |
mamba install conda-build
conda mambabuild -q conda-recipe --python=${{ matrix.python-version }} --output-folder bld-dir
python -m pip install build --user

- name: Build a source tarball
shell: bash -l {0}
run: |
python -m build
27 changes: 27 additions & 0 deletions .github/workflows/test_build_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build docs

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
build:
if: ${{ github.repository == 'slaclab/lume-model' }}
runs-on: ubuntu-latest
name: Build docs
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: 3.9
mamba-version: "*"
channels: conda-forge
activate-environment: lume-model-dev
- name: Build package
shell: bash -l {0}
run: |
pip install -e ".[docs]"
- name: Build docs
shell: bash -l {0}
run: |
mkdocs build
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Auto-generated version file
lume_model/_version.py

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
70 changes: 44 additions & 26 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,46 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.1.0
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v4.6.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: local
hooks:
- id: black
name: black
entry: black
language: python
language_version: python3
types: [python]
args: # arguments to configure black
- --line-length=88
- id: flake8
name: flake8
entry: flake8
language: python
language_version: python3
types: [python]
# only in lume_services
files: ^lume_services
args: # arguments to configure flake8
# making isort line length compatible with black
- "--max-line-length=88"
- id: no-commit-to-branch
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-ast
- id: check-case-conflict
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-xml
- id: check-yaml
exclude: "^(python/lume_model/_version.py)$"

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.0
hooks:
- id: ruff
args: [--fix]
- id: ruff-format

#- repo: local
# hooks:
# - id: black
# name: black
# entry: black
# language: python
# language_version: python3
# types: [python]
# args: # arguments to configure black
# - --line-length=88
# - id: flake8
# name: flake8
# entry: flake8
# language: python
# language_version: python3
# types: [python]
# # only in lume_services
# files: ^lume_services
# args: # arguments to configure flake8
# # making isort line length compatible with black
# - "--max-line-length=88"
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

Loading
Loading