Skip to content

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienGrv committed Nov 18, 2024
1 parent 2937a21 commit b1ca22f
Show file tree
Hide file tree
Showing 31 changed files with 367 additions and 772 deletions.
22 changes: 8 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,29 @@ jobs:
python-version: ["3.12"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

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

- name: Install packages
run: |
pip install build numpy wheel setuptools
pip install -r requirements_exe_build.txt
python setup.py bdist_wheel
pip install -e . --no-deps
pip install cmerg
pip install -r requirements_exe_build.txt
python -m build --wheel
- name: Build an executable
shell: bash
if: ${{ matrix.python-version == '3.12' }}
run: |
pip install build numpy wheel setuptools
pip install -r requirements_exe_build.txt
python setup.py bdist_wheel
pip install -e . --no-deps
pip install cmerg
pyinstaller asammdf.spec --distpath dist/${RUNNER_OS} --noconfirm --clean
pip install -r requirements_exe_build.txt
python -m build --wheel
pyinstaller asammdf.spec --distpath dist/${RUNNER_OS} --noconfirm --clean
# see: https://docs.github.com/en/actions/advanced-guides/storing-workflow-data-as-artifacts
- name: Archive dist artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/**
Expand Down
19 changes: 8 additions & 11 deletions .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,29 @@ jobs:
python-version: ["3.10"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

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

- name: Install packages
run: |
pip install build numpy wheel
pip install -r requirements_exe_build.txt
python setup.py bdist_wheel
pip install -e . --no-deps
pip install cmerg
pip install -r requirements_exe_build.txt
python -m build --wheel
- name: Build an executable
shell: bash
if: ${{ matrix.python-version == '3.10' }}
run: |
sudo apt update
sudo apt install libegl1 libopengl0
pyinstaller asammdf.spec --distpath dist/${RUNNER_OS} --noconfirm --clean
sudo apt update
sudo apt install libegl1 libopengl0
pyinstaller asammdf.spec --distpath dist/${RUNNER_OS} --noconfirm --clean
# see: https://docs.github.com/en/actions/advanced-guides/storing-workflow-data-as-artifacts
- name: Archive dist artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/**
Expand Down
22 changes: 8 additions & 14 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,29 @@ jobs:
python-version: ["3.12"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

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

- name: Install packages
run: |
pip install build numpy wheel setuptools
pip install -r requirements_exe_build.txt
python setup.py bdist_wheel
pip install -e . --no-deps
pip install cmerg
pip install -r requirements_exe_build.txt
python -m build --wheel
- name: Build an executable
shell: bash
if: ${{ matrix.python-version == '3.12' }}
run: |
pip install build numpy wheel setuptools
pip install -r requirements_exe_build.txt
python setup.py bdist_wheel
pip install -e . --no-deps
pip install cmerg
pyinstaller asammdf.spec --distpath dist/${RUNNER_OS} --noconfirm --clean
pip install -r requirements_exe_build.txt
python -m build --wheel
pyinstaller asammdf.spec --distpath dist/${RUNNER_OS} --noconfirm --clean
# see: https://docs.github.com/en/actions/advanced-guides/storing-workflow-data-as-artifacts
- name: Archive dist artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/**
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/coveralls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install packages
shell: bash
run: |
pip install tox coveralls
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt update
sudo apt-get install libegl1 libopengl0
sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
sudo apt-get install libxcb-xinerama0
sudo apt-get install libxkbcommon-x11-0
sudo apt-get install xorg
sudo apt-get install -y xvfb
if [ "$RUNNER_OS" = "Linux" ]; then
sudo apt update
sudo apt-get install libegl1 libopengl0
sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
sudo apt-get install libxcb-xinerama0
sudo apt-get install libxkbcommon-x11-0
sudo apt-get install xorg
sudo apt-get install -y xvfb
fi
- name: Start Xvfb
Expand Down
31 changes: 15 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on: [ push, pull_request ]
on: [push, pull_request]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-latest, ubuntu-22.04, macos-latest ]
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
os: [windows-latest, ubuntu-22.04, macos-latest]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
fail-fast: false

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5

with:
python-version: ${{ matrix.python-version }}
Expand All @@ -28,14 +28,14 @@ jobs:
shell: bash
run: |
pip install tox tox-gh-actions
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt update
sudo apt-get install libegl1 libopengl0
sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
sudo apt-get install libxcb-xinerama0
sudo apt-get install libxkbcommon-x11-0
sudo apt-get install xorg
sudo apt-get install -y xvfb
if [ "$RUNNER_OS" = "Linux" ]; then
sudo apt update
sudo apt-get install libegl1 libopengl0
sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
sudo apt-get install libxcb-xinerama0
sudo apt-get install libxkbcommon-x11-0
sudo apt-get install xorg
sudo apt-get install -y xvfb
fi
- name: Start Xvfb
Expand All @@ -53,9 +53,9 @@ jobs:
run: tox

- uses: actions/upload-artifact@v4
if: failure() && matrix.os == 'windows-latest' # 'ubuntu-22.04' or 'windows-latest'
if: failure() && matrix.os == 'windows-latest' # 'ubuntu-22.04' or 'windows-latest'
with:
path: '**/screenshots/**'
path: "**/screenshots/**"
name: ${{ matrix.python-version }}

- name: Stop Xvfb
Expand All @@ -72,4 +72,3 @@ jobs:
run: |
pip install junitparser
python -c "from ci import report_tests; report_tests(header='## Unit-tests Report:')"
19 changes: 10 additions & 9 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
fail-fast: false

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# Used to host cibuildwheel
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"

Expand All @@ -27,29 +27,30 @@ jobs:
env:
CIBW_TEST_COMMAND: "pytest {project}/test --ignore={project}/test/asammdf/gui"
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt update
sudo apt-get install libegl1 libopengl0 libxml2 libxml2-dev libxslt1-dev libxslt1.1
if [ "$RUNNER_OS" = "Linux" ]; then
sudo apt update
sudo apt-get install libegl1 libopengl0 libxml2 libxml2-dev libxslt1-dev libxslt1.1
fi
python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Build sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
path: dist/*.tar.gz
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
repos:
- repo: https://github.com/ambv/black
rev: 24.1.1
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.10.0
hooks:
- id: black
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: v0.2.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.4
hooks:
- id: ruff
- id: ruff
args: [--fix]
3 changes: 1 addition & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ formats:

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.8
install:
- method: pip
path: .
- requirements: doc/requirements.txt
- requirements: doc/requirements.txt
20 changes: 20 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"recommendations": [
"benspaulding.python-manifest-template",
"charliermarsh.ruff",
"esbenp.prettier-vscode",
"fill-labs.dependi",
"github.vscode-github-actions",
"lextudio.restructuredtext",
"ms-python.black-formatter",
"ms-python.debugpy",
"ms-python.python",
"ms-python.vscode-pylance",
"njpwerner.autodocstring",
"redhat.vscode-yaml",
"swyddfa.esbonio",
"tamasfe.even-better-toml",
"trond-snekvik.simple-rst",
"twixes.pypi-assistant"
]
}
33 changes: 24 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
# The basics
# Contributing

## The basics

Your help is appreciated and welcome!

The _master_ branch is meant to hold the release code. At any time this should be
identical to the code available on PyPI.
The _master_ branch is meant to hold the release code. At any time this should be
identical to the code available on PyPI.

PR's will be pushed on the _development_ branch if the actual package code is changed. When the time comes this branch
will be merged to the _master_ branch and a new release will be issued.

PR's that deal with documentation, and other adjacent files (README for example) can be pushed to the _master_ branch.

When submitting PR's please take into account:
* the project's goals
* PEP8 and the style guide below

# Testing
- the project's goals
- PEP8 and the style guide below

## Developer Instructions

Clone the repository, then install the development dependencies (we recommend using a virtual environment):

```bash
python -m venv .venv # create virtual environment in .venv
source .venv/bin/activate # activate virtual environment
pip install --requirement requirements.txt # install development dependencies (includes asammdf in editable mode)
```

Now you can start developing. If you are using VSCode, the virtual environment should be detected automatically. If not, open the command panel `Ctrl + Shift + P` and search for `Python: Select Interpreter`.

## Testing

You can use tox to run tests locally. Example for the unit tests with Python version 3.10:

Expand All @@ -24,8 +39,8 @@ tox -e py310

Otherwise, you can just push and the tests will be run by GitHub Actions.

# Style guide
## Style guide

Just run [*black*](https://black.readthedocs.io) on modified files before sending the PR. There is no need to reinvent the wheel here!
Just run [_black_](https://black.readthedocs.io) on modified files before sending the PR. There is no need to reinvent the wheel here!

**Tip**: Add a pre-commit hook with `pip install pre-commit && pre-commit install`
**Tip**: install Git hooks using pre-commit `pre-commit install --install-hooks`
Loading

0 comments on commit b1ca22f

Please sign in to comment.