Skip to content

Commit

Permalink
Merge pull request #172 from lab-cosmo/tox
Browse files Browse the repository at this point in the history
Modernize package infrastructure
  • Loading branch information
PicoCentauri authored Mar 30, 2023
2 parents 3847166 + 7a2fc61 commit 16de441
Show file tree
Hide file tree
Showing 82 changed files with 651 additions and 604 deletions.
27 changes: 10 additions & 17 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,24 @@
name: Check documentation
name: Documentation

on:
push:
branches: [main]
tags: ["*"]
pull_request:
# Check all PR

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- uses: actions/checkout@v3
- name: setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
python-version: "3.10"
- name: install dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
pip install .
python -m pip install tox
sudo apt install pandoc
- name: Build the documentation
run: |
cd docs
make html
- name: build documentation
run: tox -e docs
17 changes: 17 additions & 0 deletions .github/workflows/documentation-links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: readthedocs/actions

on:
pull_request_target:
types:
- opened

permissions:
pull-requests: write

jobs:
documentation-links:
runs-on: ubuntu-latest
steps:
- uses: readthedocs/actions/preview@v1
with:
project-slug: scikit-matter
38 changes: 11 additions & 27 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,20 @@
name: Lint

on:
push:
branches: [main]
pull_request:
# Check all PR
branches: [main]

jobs:
build:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 black isort
- name: Lint with flake8
run: |
# ignore formatting, it will be checked by black
export FORMATTING_RULES="E101,E111,E114,E115,E116,E117,E12,E13,E2,E3,E401,E5,E70,W1,W2,W3,W5"
flake8 --ignore=$FORMATTING_RULES .
- name: Lint with black
run: |
black --check .
- name: Check imports
run: |
isort skmatter/*/*py -m 3 --tc --fgw --up -e -l 88 --check
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- run: pip install tox

- name: Lint the code
run: tox -e lint
42 changes: 23 additions & 19 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test
name: Tests

on:
push:
Expand All @@ -7,25 +7,29 @@ on:
# Check all PR

jobs:
build:
runs-on: ubuntu-latest
tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
os: ['ubuntu-latest']
python-version: ['3.8', '3.9', '3.10', '3.11']
include:
- os: macos-latest
python-version: '3.10'
- os: windows-latest
python-version: '3.10'

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Run tests
run: |
tox -e tests,examples
- uses: codecov/codecov-action@v1
with:
file: ./tests/coverage.xml
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- run: pip install tox

- name: run Python tests
run: tox -e tests,examples
- uses: codecov/codecov-action@v3
with:
files: ./tests/coverage.xml
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ __pycache__
.tox/
build/
dist/
docs/source/read-only-examples
docs/src/read-only-examples
10 changes: 7 additions & 3 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,21 @@
# Required
version: 2

# Set the version of Python and other tools we need
build:
os: ubuntu-22.04
tools:
python: "3.10"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/source/conf.py
configuration: docs/src/conf.py

# Optionally build your docs in additional formats such as PDF
formats:
- pdf

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.8
install:
- requirements: docs/requirements.txt
- method: pip
Expand Down
6 changes: 4 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
recursive-include skmatter/datasets/data/ *
recursive-include skmatter/datasets/descr/ *
recursive-include src/skmatter/datasets/data/ *
recursive-include src/skmatter/datasets/descr/ *

prune tests
1 change: 1 addition & 0 deletions contributors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Guillaume Fraux
Sergei Kliavinek
Alexander Goscinski
Benjamin A. Helfrecht
Victor P. Principe
Michele Ceriotti
20 changes: 0 additions & 20 deletions docs/Makefile

This file was deleted.

35 changes: 0 additions & 35 deletions docs/make.bat

This file was deleted.

6 changes: 3 additions & 3 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
ipykernel
jinja2 < 3.1
matplotlib
nbsphinx==0.8.12
nbconvert
nbsphinx==0.8.12
numpy
pandas
scikit-learn >=0.24.0
sphinx >=3.3
sphinx_rtd_theme
tqdm
traitlets>=5.0
jinja2 < 3.1
pandas
11 changes: 0 additions & 11 deletions docs/source/datasets.rst

This file was deleted.

16 changes: 0 additions & 16 deletions docs/source/installation.rst

This file was deleted.

File renamed without changes.
File renamed without changes.
15 changes: 9 additions & 6 deletions docs/source/conf.py → docs/src/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,21 @@

import os
import sys
from datetime import datetime

import sphinx_rtd_theme
from nbconvert import NotebookExporter
from traitlets.config import Config

import skmatter


ROOT = os.path.abspath(os.path.join("..", ".."))
sys.path.insert(0, ROOT)

# Copying and Compiling of Examples
if not os.path.exists(os.path.join(ROOT, "docs/source/read-only-examples")):
os.mkdir(os.path.join(ROOT, "docs/source/read-only-examples"))
if not os.path.exists(os.path.join(ROOT, "docs/src/read-only-examples")):
os.mkdir(os.path.join(ROOT, "docs/src/read-only-examples"))

# Set up nbconvert configuration to strip empty cells and tables of contents
c = Config()
Expand All @@ -45,24 +50,22 @@
# Skip any non-notebooks
if nb.endswith("ipynb") and "no-doc" not in nb:
nb_in = os.path.join(ROOT, "examples", nb)
nb_out = os.path.join(ROOT, "docs/source/read-only-examples", nb)
nb_out = os.path.join(ROOT, "docs/src/read-only-examples", nb)

# Skip any notebooks which already exist
if not os.path.exists(nb_out):
with open(nb_out, "w") as out_stream:
converted = exporter.from_filename(nb_in)[0]
out_stream.write(converted)

import skmatter # noqa

# -- Project information -----------------------------------------------------

# The master toctree document.
master_doc = "index"

project = "scikit-matter"
author = ", ".join(open(os.path.join(ROOT, "contributors.txt")))
copyright = "2020, " + author
copyright = f"{datetime.now().date().year}, {author}"

# The full version, including alpha/beta/rc tags
release = skmatter.__version__
Expand Down
Loading

0 comments on commit 16de441

Please sign in to comment.