Skip to content

Commit

Permalink
Merge branch 'pyvisa:main' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Satertek authored Sep 4, 2023
2 parents abb54dd + 17323c6 commit 29d93bd
Show file tree
Hide file tree
Showing 40 changed files with 2,051 additions and 1,131 deletions.
14 changes: 14 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[run]
branch = True
include =
*/pyvisa_sim/*

[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover

# Don't complain if tests don't hit defensive assertion code:
raise NotImplementedError()
pass
14 changes: 14 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[flake8]
exclude =
.git,
__pycache__,
docs/source/conf.py,
old,
build,
dist,
ignore = E203, E266, E501, W503, E731
# line length is intentionally set to 80 here because pyvisa uses Bugbear
# See https://github.com/psf/black/blob/master/README.md#line-length for more details
max-line-length = 80
max-complexity = 18
select = B,C,E,F,W,T4,B9
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
56 changes: 47 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,71 @@ on:
- cron: '0 0 * * 2'
push:
branches:
- master
- main
- staging
- trying
pull_request:
branches:
- master
- main
paths:
- .github/workflows/ci.yml
- pyvisa_sim/*
- "pyvisa_sim/**"
- pyproject.toml
- setup.cfg
- setup.py

jobs:
formatting:
name: Check code formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('dev-requirements.txt') }}
- name: Install tools
run: |
python -m pip install --upgrade pip
pip install -r dev-requirements.txt
- name: Isort
run: |
isort pyvisa_sim -c;
- name: Black
if: always()
run: |
black pyvisa_sim --check;
- name: Flake8
if: always()
run: |
flake8 pyvisa_sim;
- name: Mypy
if: always()
run: |
mypy pyvisa_sim;
tests:
name: Unit tests
runs-on: ${{ matrix.os }}
needs:
- formatting
if: needs.formatting.result == 'success'
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.7, 3.8, 3.9, "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -40,9 +78,9 @@ jobs:
- name: Test with pytest
run: |
pip install pytest-cov
pytest --pyargs pyvisa_sim --cov pyvisa_sim --cov-report xml -v
pytest --pyargs pyvisa_sim --cov --cov-report xml -v
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ jobs:
name: Docs building
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Install project
run: |
python setup.py develop
pip install -e .
- name: Install graphviz
uses: kamiazya/setup-graphviz@v1
- name: Install doc building tools
Expand Down
111 changes: 111 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Build and upload wheels
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 3'
push:
tags:
- '*'

jobs:
build_sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get history and tags for SCM versioning to work
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Setup Python
uses: actions/setup-python@v4
- name: Build sdist
run: |
pip install --upgrade pip
pip install wheel build
python -m build . -s
- name: Test sdist
run: |
pip install pytest
pip install dist/*.tar.gz
python -X dev -m pytest --pyargs pyvisa_sim
- name: Store artifacts
uses: actions/upload-artifact@v3
with:
name: artifact
path: dist/*

build_wheel:
name: Build wheel
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get history and tags for SCM versioning to work
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Setup Python
uses: actions/setup-python@v4
- name: Build wheels
run: |
pip install --upgrade pip
pip install wheel build
python -m build . -w
- name: Test wheel
run: |
pip install pytest
pip install dist/*.whl
python -X dev -m pytest --pyargs pyvisa_sim
- name: Store artifacts
uses: actions/upload-artifact@v3
with:
name: artifact
path: dist/*.whl

release_upload:
name: Create Release and Upload Release Asset
runs-on: ubuntu-latest
if: github.event_name == 'push'
needs: [build_wheel, build_sdist]
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: ${{ contains(github.ref, 'rc') || contains(github.ref, 'a') || contains(github.ref, 'b')}}
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- name: Upload Release Asset
id: upload-release-asset
uses: shogo82148/actions-upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/*

upload_pypi:
if: github.event_name == 'push'
needs: [build_wheel, build_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@v1
with:
user: __token__
password: ${{ secrets.pypi_password }}
# To test:
# repository_url: https://test.pypi.org/legacy/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
version.py

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
18 changes: 18 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
repos:
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.991 # Use the sha / tag you want to point at
hooks:
- id: mypy
additional_dependencies: [pyvisa, types-PyYAML, stringparser, pytest]
27 changes: 27 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
tools:
python: "3.10"

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

# Enable epub output
formats:
- epub

# Optionally declare the Python requirements required to build your docs
python:
install:
- requirements: docs/requirements.txt
- method: pip
path: .
7 changes: 5 additions & 2 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
pyvisa-sim is written and maintained by Hernan E. Grecco
pyvisa-sim was created by Hernan E. Grecco
[email protected].

It is currently maintained by:
- Matthieu Dartiailh [email protected]


Other contributors, listed alphabetically, are:

- Adam Vaughn [email protected]
- Colin Marquardt [email protected]
- Huan Nguyen [email protected]
- Matthieu Dartiailh [email protected]
9 changes: 8 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
PyVISA-sim Changelog
====================

Unreleased
----------

- Fixed debug logging a single character at a time. PR #79
- Fixed issue with `common.iter_bytes` where the masked bits would be incorrect.
PR #81

0.5.1 (2022-09-08)
------------------

Expand Down Expand Up @@ -60,4 +67,4 @@ PyVISA-sim Changelog
- First public release.
- Basic ASRL INSTR functionality.
- Basic USB INSTR functionality.
- Basic TCPIP INSTR functionality.
- Basic TCPIP INSTR functionality.
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ measurement controlling:
Requirements
------------

- Python (tested with 3.6 to 3.9)
- PyVISA 1.6+
- Python (tested with 3.8 to 3.11)
- PyVISA 1.11+

Installation
------------
Expand All @@ -68,8 +68,8 @@ Using ``pip``:

or install the development version:

$ pip install -U
`https://github.com/pyvisa/pyvisa-sim/zipball/master`_
$ pip install
`git+https://github.com/pyvisa/pyvisa-sim`_

PyVISA is automatically installed if needed.

Expand Down
9 changes: 9 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pyvisa
black
flake8
mypy
types-PyYAML
isort
pytest
sphinx
sphinx-rtd-theme
Loading

0 comments on commit 29d93bd

Please sign in to comment.