Skip to content

Commit

Permalink
Refactor to begin aligning with femto (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonBoothroyd authored Jan 15, 2024
1 parent bb46f26 commit 095c1ab
Show file tree
Hide file tree
Showing 104 changed files with 5,425 additions and 8,707 deletions.
7 changes: 0 additions & 7 deletions .codecov.yml

This file was deleted.

42 changes: 0 additions & 42 deletions .github/CONTRIBUTING.md

This file was deleted.

10 changes: 2 additions & 8 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
## Description
Provide a brief description of the PR's purpose here.

## Todos
Notable points that this PR has either accomplished or will accomplish.
- [ ] TODO 1

## Questions
- [ ] Question1
<!--- Provide a brief description of the PR's purpose here. -->

## Status
- [ ] Ready to go
- [ ] Ready to go
76 changes: 11 additions & 65 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,83 +5,29 @@ concurrency:
cancel-in-progress: true

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

push: { branches: [ "main" ] }
pull_request: { branches: [ "main" ] }

jobs:

lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: actions/[email protected]
with:
python-version: '3.10'
- name: Install the package
run: |
pip install -e .
- name: Install isort / flake8 / black
run: |
pip install isort flake8 black
- name: Run isort
run: |
isort --check-only absolv
- name: Run black
run: |
black absolv --check
- name: Run flake8
run: |
flake8 absolv
test:

name: ${{ matrix.os }} python=${{ matrix.python-version }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ]
python-version: [ "3.10" ]
runs-on: ubuntu-latest
container: condaforge/mambaforge:latest

steps:
- uses: actions/checkout@v2.4.0
- uses: actions/checkout@v3.3.0

- name: Setup Conda Environment
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: devtools/envs/base.yaml
extra-specs: |
python=${{ matrix.python-version }}
- name: Install Package
shell: bash -l {0}
run: |
pip install -e .
- name: Conda Environment Information
shell: bash -l {0}
run: |
conda info
conda list
apt update && apt install -y git make
- name: Run Tests
shell: bash -l {0}
run: |
pytest -v --cov=absolv --cov-report=xml --cov-report=term --color=yes absolv/tests/
make env
make lint
make test
make docs-build
- name: CodeCov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v3.1.1
with:
file: ./coverage.xml
flags: unittests
name: codecov-${{ matrix.os }}-py${{ matrix.python-version }}
68 changes: 35 additions & 33 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -1,51 +1,53 @@
name: docs
name: Publish Documentation

on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
- main
tags:
- '*'

jobs:
docs:
deploy-docs:

runs-on: ubuntu-latest
container: condaforge/mambaforge:latest

steps:
- uses: actions/[email protected]
- name: Prepare container
run: |
apt update && apt install -y git make
- name: Setup Conda Environment
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: docs/environment.yml
extra-specs: |
python=${{ matrix.python-version }}
- name: Checkout
uses: actions/[email protected]

- name: Install Package
shell: bash -l {0}
- name: Determine Version
shell: bash
run: |
pip install -e .
- name: Environment Information
shell: bash -l {0}
if [ "$GITHUB_REF" = "refs/heads/main" ]; then
echo "VERSION=latest" >> $GITHUB_ENV
elif [ "${GITHUB_REF#refs/tags/}" != "$GITHUB_REF" ]; then
VERSION=$(echo $GITHUB_REF | sed 's/refs\/tags\///')
echo "VERSION=$VERSION stable" >> $GITHUB_ENV
else
echo "Invalid ref: $GITHUB_REF"
exit 1
fi
- name: Build and Deploy Documentation
env:
INSIDER_DOCS_TOKEN: ${{ secrets.INSIDER_DOCS_TOKEN }}
run: |
conda info
conda list
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
git config --global --add safe.directory "$PWD"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
- name: Build 🔧
shell: bash -l {0}
run: |
git fetch --all --prune
cd docs
make env
python compile-sass.py
make html
sed -i 's/# extensions/extensions/' mkdocs.yml
- name: Deploy 🚀
if: github.ref == 'refs/heads/main'
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: docs/_build/html
make docs-insiders INSIDER_DOCS_TOKEN="${INSIDER_DOCS_TOKEN}"
make docs-deploy VERSION="$VERSION"
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,6 @@ ENV/
.idea

# OSX
.DS_Store
.DS_Store

.ruff_cache
30 changes: 13 additions & 17 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
files: \.py$
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer

- repo: local
hooks:
- id: isort
name: Import formatting
language: system
entry: isort

- id: black
name: Code formatting
language: system
entry: black

- id: flake8
name: Linting
language: system
entry: flake8
- repo: local
hooks:
- id: ruff
name: Autoformat python code
language: system
entry: ruff
args: [check]
files: \.py$
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

MIT License

Copyright (c) 2021 Simon Boothroyd
Copyright (c) 2023 Simon Boothroyd

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
7 changes: 1 addition & 6 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
include LICENSE
include MANIFEST.in
include versioneer.py

graft absolv
global-exclude *.py[cod] __pycache__ *.so
global-exclude *.py[cod] __pycache__ *.so
40 changes: 33 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,36 @@
.PHONY: env
PACKAGE_NAME := absolv

CONDA_ENV_RUN=conda run --no-capture-output --name $(PACKAGE_NAME)

TEST_ARGS := -v --cov=$(PACKAGE_NAME) --cov-report=term --cov-report=xml --junitxml=unit.xml --color=yes

.PHONY: env lint format test docs-build docs-deploy docs-insiders

env:
mamba create -n absolv
mamba env update -n absolv --file devtools/envs/base.yaml
conda run --no-capture-output --name absolv pip install --no-deps -e .
conda run --no-capture-output --name absolv pre-commit install
mamba create --name $(PACKAGE_NAME)
mamba env update --name $(PACKAGE_NAME) --file devtools/envs/base.yaml
$(CONDA_ENV_RUN) pip install --no-deps -e .
$(CONDA_ENV_RUN) pre-commit install || true

lint:
$(CONDA_ENV_RUN) ruff check $(PACKAGE_NAME)

.PHONY: format
format:
pre-commit run --all-files
$(CONDA_ENV_RUN) ruff format $(PACKAGE_NAME)
$(CONDA_ENV_RUN) ruff check --fix --select I $(PACKAGE_NAME)

test:
$(CONDA_ENV_RUN) pytest -v $(TEST_ARGS) $(PACKAGE_NAME)/tests/

docs-build:
$(CONDA_ENV_RUN) mkdocs build

docs-deploy:
ifndef VERSION
$(error VERSION is not set)
endif
$(CONDA_ENV_RUN) mike deploy --push --update-aliases $(VERSION)

docs-insiders:
$(CONDA_ENV_RUN) pip install git+https://$(INSIDER_DOCS_TOKEN)@github.com/SimonBoothroyd/mkdocstrings-python.git \
git+https://$(INSIDER_DOCS_TOKEN)@github.com/SimonBoothroyd/griffe-pydantic.git@fix-inheritence-static
Loading

0 comments on commit 095c1ab

Please sign in to comment.