-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rfctr(build): modernize build and docs
- Add GitHub Actions CI. - Get docs working. - Update tox config.
- Loading branch information
Showing
14 changed files
with
880 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: ci | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
push: | ||
branches: | ||
- master | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
python-version: ["3.9", "3.10", "3.11", "3.12"] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install uv | ||
uses: astral-sh/setup-uv@v2 | ||
with: | ||
version: "0.4.15" | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
run: uv python install ${{ matrix.python-version }} | ||
|
||
- name: Install the project | ||
run: uv sync --all-extras --dev | ||
|
||
- name: Test with pytest + behave | ||
run: | | ||
uv run pytest --cov-report term-missing --cov=opcdiag --cov=tests tests | ||
uv run behave |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,53 @@ | ||
BEHAVE = behave | ||
PACKAGE = opcdiag | ||
PYTHON = python | ||
SETUP = $(PYTHON) ./setup.py | ||
|
||
.PHONY: accept clean coverage readme register test sdist upload | ||
|
||
help: | ||
@echo "Please use \`make <target>' where <target> is one or more of" | ||
@echo " accept run acceptance tests using behave" | ||
@echo " clean delete intermediate work product and start fresh" | ||
@echo " coverage run nosetests with coverage" | ||
@echo " readme update README.html from README.rst" | ||
@echo " register update metadata (README.rst) on PyPI" | ||
@echo " test run tests using setup.py" | ||
@echo " sdist generate a source distribution into dist/" | ||
@echo " upload upload distribution tarball to PyPI" | ||
|
||
@echo " accept run acceptance tests using behave" | ||
@echo " build generate a source distribution and wheel into dist/" | ||
@echo " clean delete intermediate work product and start fresh" | ||
@echo " cleandocs delete generated HTML documentation" | ||
@echo " coverage run unit tests with coverage" | ||
@echo " docs generate HTML documentation with Sphinx" | ||
@echo " test run unit tests" | ||
@echo " test-upload upload distribution artifacts in dist/ to Test-PyPI" | ||
@echo " upload upload distribution artifacts in dist/ to PyPI" | ||
|
||
.PHONY: accept | ||
accept: | ||
$(BEHAVE) --stop | ||
uv run behave --stop | ||
|
||
.PHONY: build | ||
build: | ||
rm -rf dist | ||
uv build | ||
|
||
.PHONY: clean | ||
clean: | ||
find . -type f -name \*.pyc -exec rm {} \; | ||
rm -rf dist *.egg-info .coverage .DS_Store | ||
|
||
coverage: | ||
py.test --cov-report term-missing --cov=$(PACKAGE) tests/ | ||
|
||
readme: | ||
rst2html README.rst >README.html | ||
open README.html | ||
.PHONY: cleandocs | ||
cleandocs: | ||
$(MAKE) -C docs clean | ||
|
||
register: | ||
$(SETUP) register | ||
.PHONY: coverage | ||
coverage: | ||
uv run pytest --cov-report term-missing --cov=$(PACKAGE) --cov=tests tests/ | ||
|
||
sdist: | ||
$(SETUP) sdist | ||
.PHONY: docs | ||
docs: | ||
$(MAKE) -C docs html | ||
|
||
.PHONY: test | ||
test: | ||
$(SETUP) test | ||
uv run pytest tests | ||
|
||
.PHONY: test-upload | ||
test-upload: build | ||
uv run twine upload --repository testpypi dist/* | ||
|
||
.PHONY: upload | ||
upload: | ||
$(SETUP) sdist upload | ||
uv run twine upload dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
[build-system] | ||
requires = ["setuptools>=61.0.0"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "opc-diag" | ||
version = "1.0.0" | ||
version = "1.1.0" | ||
authors = [{name = "Steve Canny", email = "[email protected]"}] | ||
classifiers = [ | ||
"Development Status :: 5 - Production/Stable", | ||
|
@@ -61,14 +65,17 @@ filterwarnings = [ | |
looponfailroots = ["src", "tests"] | ||
norecursedirs = [ | ||
".git", | ||
".ruff_cache", | ||
"dist", | ||
"docs", | ||
"features", | ||
"src", | ||
"typings", | ||
".tox", | ||
] | ||
python_files = ["test_*.py"] | ||
python_classes = ["Test", "Describe"] | ||
python_functions = ["it_", "its_", "they_", "and_", "but_"] | ||
python_functions = ["test_", "it_", "its_", "they_", "and_", "but_"] | ||
|
||
[tool.ruff] | ||
exclude = [] | ||
|
@@ -102,10 +109,17 @@ known-local-folder = ["helpers"] | |
|
||
[tool.uv] | ||
dev-dependencies = [ | ||
"alabaster<0.7.14", | ||
"behave>=1.2.6", | ||
"jinja2==2.11.3", | ||
"markupsafe==0.23", | ||
"pyright>=1.1.381", | ||
"pytest-cov>=5.0.0", | ||
"pytest>=8.3.3", | ||
"ruff>=0.6.7", | ||
"sphinx==1.8.6", | ||
"tox>=4.20.0", | ||
"twine>=5.1.1", | ||
"types-lxml>=2024.9.16", | ||
] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
__version__ = "1.0.0" # pragma: no cover | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,10 @@ | ||
# | ||
# tox.ini | ||
# | ||
# Copyright (C) 2012, 2013 Steve Canny [email protected] | ||
# | ||
# This module is part of python-opc and is released under the MIT License: | ||
# http://www.opensource.org/licenses/mit-license.php | ||
# | ||
# Configuration for tox and pytest | ||
|
||
[pytest] | ||
norecursedirs = doc *.egg-info features .git opcdiag .tox | ||
python_classes = Test Describe | ||
python_functions = test_ it_ they_ | ||
|
||
[tox] | ||
envlist = py26, py27, py33 | ||
envlist = py39, py310, py311, py312 | ||
|
||
[testenv] | ||
deps = | ||
behave | ||
lxml | ||
mock | ||
pytest | ||
|
||
commands = | ||
|
Oops, something went wrong.