Skip to content

Commit 418e317

Browse files
authored
Merge pull request #5 from dls-controls/on-its-head
Make pythonIoc pip installable
2 parents 94da62c + 0633d74 commit 418e317

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+4134
-1814
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*/_version_git.py export-subst

.github/pages/index.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Redirecting to master branch</title>
5+
<meta charset="utf-8">
6+
<meta http-equiv="refresh" content="0; url=./master/index.html">
7+
<link rel="canonical" href="master/index.html">
8+
</head>
9+
</html>

.github/workflows/code.yml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: Code CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
lint:
9+
runs-on: "ubuntu-latest"
10+
steps:
11+
- name: Checkout Source
12+
uses: actions/checkout@v2
13+
14+
- name: Install Python
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: '3.7'
18+
19+
- name: Install Python Dependencies
20+
run: pip install flake8
21+
22+
- name: Lint
23+
run: flake8
24+
25+
build:
26+
name: ${{ matrix.os }}/${{ matrix.python }}
27+
runs-on: ${{ matrix.os }}
28+
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
os: [ubuntu-latest, windows-latest, macos-latest]
33+
python: [cp27, cp37, cp38, cp39]
34+
35+
exclude:
36+
- os: windows-latest
37+
# No cothread or asyncio so doesn't work
38+
python: cp27
39+
40+
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+
46+
- os: windows-latest
47+
cov_file: '{project}/dist/coverage.xml'
48+
# cothread doesn't work on windows
49+
test_requires: pytest-asyncio aioca
50+
51+
- os: macos-latest
52+
cov_file: '{project}/dist/coverage.xml'
53+
test_requires: cothread pytest-asyncio aioca
54+
55+
- os: ubuntu-latest
56+
python: cp27
57+
# asyncio doesn't work on Python2.7
58+
test_requires: cothread
59+
60+
- os: macos-latest
61+
python: cp27
62+
# asyncio doesn't work on Python2.7
63+
test_requires: cothread
64+
65+
66+
steps:
67+
- name: Checkout Source
68+
uses: actions/checkout@v2
69+
with:
70+
submodules: true
71+
72+
- name: Install Python
73+
uses: actions/setup-python@v2
74+
with:
75+
python-version: '3.7'
76+
77+
- name: Install Python Dependencies
78+
run: pip install twine build cibuildwheel
79+
80+
- name: Build Sdist
81+
run: python -m build --sdist .
82+
83+
- name: Build Wheel
84+
run: cibuildwheel --output-dir dist
85+
env:
86+
CIBW_BUILD: ${{ matrix.python }}*64
87+
CIBW_TEST_REQUIRES: pytest-cov ${{ matrix.test_requires }}
88+
CIBW_TEST_COMMAND: pytest --cov=softioc {project}/tests --cov-report xml:${{ matrix.cov_file }}
89+
# Disable auditwheel as it isn't compatible with setuptools_dso approach
90+
# https://github.com/mdavidsaver/setuptools_dso/issues/17
91+
CIBW_REPAIR_WHEEL_COMMAND: ''
92+
93+
- name: Upload Wheel and Sdist
94+
uses: actions/upload-artifact@v2
95+
with:
96+
name: dist
97+
path: dist/softioc*
98+
99+
- name: Upload coverage to Codecov
100+
uses: codecov/codecov-action@v1
101+
with:
102+
name: ${{ matrix.os }}/${{ matrix.python }}
103+
directory: dist
104+
105+
upload_pypi:
106+
needs: [build]
107+
runs-on: ubuntu-latest
108+
# upload to PyPI on every tag
109+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
110+
steps:
111+
- uses: actions/download-artifact@v2
112+
with:
113+
name: dist
114+
path: dist
115+
116+
- name: Publish to PyPI
117+
env:
118+
TWINE_USERNAME: __token__
119+
TWINE_PASSWORD: ${{ secrets.pypi_token }}
120+
run: twine upload dist/*
121+

.github/workflows/docs.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
2+
name: Docs CI
3+
4+
on:
5+
push:
6+
pull_request:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout Source
14+
uses: actions/checkout@v2
15+
with:
16+
# require all of history to see all tagged versions' docs
17+
fetch-depth: 0
18+
submodules: true
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v2
22+
with:
23+
python-version: "3.7"
24+
25+
- name: Install Packages
26+
# Can delete this if you don't use graphviz in your docs
27+
run: sudo apt-get install graphviz
28+
29+
- name: Install Python Dependencies
30+
run: |
31+
pip install pipenv
32+
pipenv install --dev --deploy --python $(which python) && pipenv graph
33+
34+
- name: Deploy index
35+
# We pin to the SHA, not the tag, for security reasons.
36+
# https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
37+
uses: peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501 # v3.7.3
38+
with:
39+
github_token: ${{ secrets.GITHUB_TOKEN }}
40+
publish_dir: .github/pages
41+
keep_files: true
42+
43+
- name: Checkout gh-pages
44+
# As we already did a deploy of gh-pages above, it is guaranteed to be there
45+
# so check it out so we can selectively build docs below
46+
uses: actions/checkout@v2
47+
with:
48+
ref: gh-pages
49+
path: build/html
50+
51+
- name: Maybe use sphinx-multiversion
52+
# If we are building master or a tag we will publish
53+
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')
54+
# So use the args we normally pass to sphinx-build, but run sphinx-multiversion
55+
run: mv $(pipenv --venv)/bin/sphinx-multiversion $(pipenv --venv)/bin/sphinx-build
56+
57+
- name: Build Docs
58+
run: pipenv run docs
59+
60+
- name: Publish Docs to gh-pages
61+
# Only master and tags are published
62+
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')
63+
# We pin to the SHA, not the tag, for security reasons.
64+
# https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
65+
uses: peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501 # v3.7.3
66+
with:
67+
github_token: ${{ secrets.GITHUB_TOKEN }}
68+
publish_dir: build/html
69+
keep_files: true
70+

.gitignore

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,67 @@
1-
/bin
2-
/dbd
3-
/lib
4-
/db
5-
/docs/html
6-
/pythonIoc
7-
*.pyc
8-
O.*
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
94

5+
# C extensions
6+
*.so
7+
8+
# Distribution / packaging
9+
.Python
10+
env/
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
*.egg-info/
23+
.installed.cfg
24+
*.egg
25+
26+
# PyInstaller
27+
# Usually these files are written by a python script from a template
28+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
29+
*.manifest
30+
*.spec
31+
32+
# Installer logs
33+
pip-log.txt
34+
pip-delete-this-directory.txt
35+
36+
# Unit test / coverage reports
37+
htmlcov/
38+
.tox/
39+
.coverage
40+
.coverage.*
41+
.cache
42+
nosetests.xml
43+
coverage.xml
44+
*,cover
45+
*.mypy_cache
46+
*.pytest_cache
47+
cov.xml
48+
49+
# DLS build dir and virtual environment
50+
/prefix/
51+
/venv/
52+
/lightweight-venv/
53+
/installed.files
54+
55+
# Docs output
1056
/docs/papers/*/*.aux
1157
/docs/papers/*/*.pdf
1258
/docs/papers/*/*.nav
1359
/docs/papers/*/*.out
1460
/docs/papers/*/*.snm
1561
/docs/papers/*/*.toc
1662
/docs/papers/*/*.vrb
63+
64+
# setup.py develop (via pipenv install) places this link here
65+
# so editable installs work. Related:
66+
# https://github.com/mdavidsaver/setuptools_dso/issues/11
67+
/epicscorelibs

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "iocStats"]
2+
path = iocStats
3+
url = https://github.com/epics-modules/iocStats.git

CONTRIBUTING.rst

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
Contributing
2+
============
3+
4+
Contributions and issues are most welcome! All issues and pull requests are
5+
handled through github on the `dls_controls repository`_. Also, please check for
6+
any existing issues before filing a new one. If you have a great idea but it
7+
involves big changes, please file a ticket before making a pull request! We
8+
want to make sure you don't spend your time coding something that might not fit
9+
the scope of the project.
10+
11+
.. _dls_controls repository: https://github.com/dls-controls/pythonIoc/issues
12+
13+
Running the tests
14+
-----------------
15+
16+
To get the source source code and run the unit tests, run::
17+
18+
$ git clone git://github.com/dls-controls/pythonIoc.git
19+
$ cd pythonIoc
20+
$ pipenv install --dev
21+
$ pipenv run tests
22+
23+
While 100% code coverage does not make a library bug-free, it significantly
24+
reduces the number of easily caught bugs! Please make sure coverage remains the
25+
same or is improved by a pull request!
26+
27+
Code Styling
28+
------------
29+
30+
The code in this repository conforms to standards set by the following tools:
31+
32+
- flake8_ for style checks
33+
34+
.. _flake8: http://flake8.pycqa.org/en/latest/
35+
36+
These tests will be run on code when running ``pipenv run tests`` and also
37+
automatically at check in. Please read the tool documentation for details
38+
on how to fix the errors it reports.
39+
40+
Documentation
41+
-------------
42+
43+
Documentation is contained in the ``docs`` directory and extracted from
44+
docstrings of the API.
45+
46+
Docs follow the underlining convention::
47+
48+
Headling 1 (page title)
49+
=======================
50+
51+
Heading 2
52+
---------
53+
54+
Heading 3
55+
~~~~~~~~~
56+
57+
58+
You can build the docs from the project directory by running::
59+
60+
$ pipenv run docs
61+
$ firefox build/html/index.html
62+
63+
64+
Release Checklist
65+
-----------------
66+
67+
Before a new release, please go through the following checklist:
68+
69+
- Choose a new PEP440 compliant release number
70+
- Git tag the version with a message summarizing the changes
71+
- Push to github and the actions will make a release on pypi
72+
- Push to internal gitlab and do a dls-release.py of the tag

0 commit comments

Comments
 (0)