Skip to content

Commit 59d87d0

Browse files
Add VSCode config (#49)
Packaging, CI, docs and VSCode updates from template module - Packaging changed to add test deps as an extra to work around pip's dependency resolver in cibuildwheel - CI adjusted to use new packaging - Docs use the theme with the github version links in - VSCode lifted from the DLS Py3 Template Module, with all auto-formatting parts removed due to most of the code not conforming to existing formatting (i.e. the Black formatter)
1 parent 2c5961b commit 59d87d0

File tree

14 files changed

+141
-123
lines changed

14 files changed

+141
-123
lines changed

.github/workflows/code.yml

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,51 +23,40 @@ jobs:
2323
run: flake8
2424

2525
build:
26-
name: build/${{ matrix.os }}/${{ matrix.python }}
27-
runs-on: ${{ matrix.os }}
28-
2926
strategy:
3027
fail-fast: false
3128
matrix:
3229
os: [ubuntu-latest, windows-latest, macos-latest]
3330
python: [cp27, cp37, cp38, cp39]
3431

3532
exclude:
33+
# No cothread or asyncio for windows python 2.7 so doesn't work
3634
- os: windows-latest
37-
# No cothread or asyncio so doesn't work
3835
python: cp27
3936

4037
include:
41-
- os: ubuntu-latest
42-
# Put coverage in the output dir mounted in docker
43-
cov_file: /output/coverage.xml
44-
test_requires: cothread pytest-asyncio aioca
45-
# Build an sdist here so it has the right line endings
46-
sdist: true
47-
48-
- os: windows-latest
49-
cov_file: "{project}/dist/coverage.xml"
50-
# cothread doesn't work on windows
51-
test_requires: pytest-asyncio aioca
52-
38+
# Put coverage in the project directory for mac
5339
- os: macos-latest
5440
cov_file: "{project}/dist/coverage.xml"
55-
test_requires: cothread pytest-asyncio aioca
56-
41+
# And for windows
42+
- os: windows-latest
43+
cov_file: "{project}/dist/coverage.xml"
44+
# But put coverage in the output dir mounted in docker for linux
5745
- os: ubuntu-latest
58-
python: cp27
59-
# asyncio doesn't work on Python2.7
60-
test_requires: cothread
46+
cov_file: /output/coverage.xml
47+
# Build an sdist on linux so it has the right line endings
48+
- os: ubuntu-latest
49+
sdist: true
6150

62-
- os: macos-latest
63-
python: cp27
64-
# asyncio doesn't work on Python2.7
65-
test_requires: cothread
51+
name: build/${{ matrix.os }}/${{ matrix.python }}
52+
runs-on: ${{ matrix.os }}
6653

6754
steps:
6855
- name: Checkout Source
6956
uses: actions/checkout@v2
7057
with:
58+
# require history to get back to last tag for version number of branches
59+
fetch-depth: 0
7160
submodules: true
7261

7362
- name: Install Python
@@ -86,8 +75,8 @@ jobs:
8675
run: cibuildwheel --output-dir dist
8776
env:
8877
CIBW_BUILD: ${{ matrix.python }}*64
89-
CIBW_TEST_REQUIRES: pytest-cov p4p ${{ matrix.test_requires }}
90-
CIBW_TEST_COMMAND: pytest --cov=softioc {project}/tests --cov-report xml:${{ matrix.cov_file }}
78+
CIBW_TEST_EXTRAS: dev
79+
CIBW_TEST_COMMAND: pytest {project}/tests --cov-report xml:${{ matrix.cov_file }}
9180
# Disable auditwheel as it isn't compatible with setuptools_dso approach
9281
# https://github.com/mdavidsaver/setuptools_dso/issues/17
9382
CIBW_REPAIR_WHEEL_COMMAND: ""
@@ -101,7 +90,7 @@ jobs:
10190
path: dist/softioc*
10291

10392
- name: Upload coverage to Codecov
104-
uses: codecov/codecov-action@v1
93+
uses: codecov/codecov-action@v2
10594
with:
10695
name: ${{ matrix.os }}/${{ matrix.python }}
10796
directory: dist

.github/workflows/docs.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,9 @@ jobs:
3030
- name: Build Docs
3131
run: pipenv run docs
3232

33-
- uses: rishabhgupta/split-by@v1
34-
id: split
35-
with:
36-
string: ${{ github.ref }}
37-
split-by: /
38-
3933
- name: Move to versioned directory
4034
# e.g. master or 0.1.2
41-
run: mv build/html ".github/pages/${{ steps.split.outputs._2 }}"
35+
run: mv build/html ".github/pages/${GITHUB_REF##*/}"
4236

4337
- name: Publish Docs to gh-pages
4438
# Only master and tags are published

.vscode/extensions.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"ms-python.vscode-pylance",
4+
"ms-python.python",
5+
"ryanluker.vscode-coverage-gutters"
6+
]
7+
}

.vscode/launch.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Debug Unit Test",
9+
"type": "python",
10+
"request": "launch",
11+
"justMyCode": false,
12+
"program": "${file}",
13+
"purpose": ["debug-test"],
14+
"console": "integratedTerminal",
15+
"env": {
16+
// The default config in setup.cfg's "[tool:pytest]" adds coverage.
17+
// Cannot have coverage and debugging at the same time.
18+
// https://github.com/microsoft/vscode-python/issues/693
19+
"PYTEST_ADDOPTS": "--no-cov"
20+
},
21+
}
22+
]
23+
}

.vscode/settings.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"editor.defaultFormatter": "ms-python.python",
3+
"python.linting.pylintEnabled": false,
4+
"python.linting.flake8Enabled": true,
5+
"python.linting.enabled": true,
6+
"python.testing.pytestArgs": [],
7+
"python.testing.unittestEnabled": false,
8+
"python.testing.pytestEnabled": true,
9+
"python.languageServer": "Pylance",
10+
}

.vscode/tasks.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// See https://go.microsoft.com/fwlink/?LinkId=733558
2+
// for the documentation about the tasks.json format
3+
{
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"type": "shell",
8+
"label": "Tests with coverage",
9+
"command": "pipenv run tests",
10+
"options": {
11+
"cwd": "${workspaceRoot}"
12+
},
13+
"problemMatcher": [],
14+
}
15+
]
16+
}

Pipfile

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,13 @@ url = "https://pypi.org/simple"
44
verify_ssl = true
55

66
[dev-packages]
7-
pytest-cov = "*"
8-
pytest-flake8 = "*"
9-
sphinx-rtd-theme = "*"
10-
setuptools-dso = "*"
11-
pytest-asyncio = "*"
12-
p4p = "*"
7+
softioc = {editable = true, extras = ["dev"], path = "."}
138

149
[packages]
15-
# All other package requirements from setup.py
1610
softioc = {editable = true, extras = ["useful"], path = "."}
17-
# Apart from the epicscorelibs which comes from pyproject.toml so needs to be here too
18-
# epicscorelibs = "*"
1911

2012
[scripts]
21-
# Put coverage here so we don't interfere with debugging in the IDE
22-
# Put flake8 here so we don't run it during cibuildwheel tests
23-
tests = "python -m pytest --cov=softioc --cov-report term --flake8"
13+
# Do flake8 here so it doesn't happen in the container in CI
14+
tests = "python -m pytest --flake8"
2415
docs = "sphinx-build -EWT --keep-going docs build/html"
2516
gitclean = "git clean -fdX"

Pipfile.lock

Lines changed: 46 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/_static/theme_overrides.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@
1212
padding: 4px 6px;
1313
}
1414

15-
/* allow us to stop margin after list so we can add to it */
16-
.no-margin-after-ul ul {
17-
margin-bottom: 0 !important;
18-
}
19-
2015
/* Add two-column option */
2116
@media only screen and (min-width: 1000px) {
2217
.columns {

0 commit comments

Comments
 (0)