-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bump versions #38
Merged
Merged
Bump versions #38
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
78691b3
Bump versions
oerc0122 30b22df
Update run_tests.yml
oerc0122 09a0566
Update light_python_wrapper
mducle 9450140
Fix euphonic doc test for R2022b and newer
mducle 7de39c0
Pin Brille to 0.7.0 as wheels for 0.8.0 crash on Windows
mducle c8b9ac8
Update readthedocs configurations
mducle 1e00fa6
Remove 1.3.1 version pin, revert to just latest Matlab in CI
mducle 97cca83
Update light_python_wrapper to latest main sha
mducle 6d7a434
Switch to conda on Windows. Remove brille-0.7.0 pin
mducle e1c990e
Revert brille-0.7.0 pin as still segfaults on CI
mducle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Read the Docs configuration file for Sphinx projects | ||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details | ||
|
||
# Required | ||
version: 2 | ||
|
||
# Set the OS, Python version and other tools you might need | ||
build: | ||
os: ubuntu-22.04 | ||
tools: | ||
python: "3.12" | ||
# You can also specify other tool versions: | ||
# nodejs: "20" | ||
# rust: "1.70" | ||
# golang: "1.20" | ||
|
||
# Build documentation in the "docs/" directory with Sphinx | ||
sphinx: | ||
configuration: doc/source/conf.py | ||
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs | ||
# builder: "dirhtml" | ||
# Fail on all warnings to avoid broken references | ||
# fail_on_warning: true | ||
|
||
# Optionally build your docs in additional formats such as PDF and ePub | ||
# formats: | ||
# - epub | ||
|
||
# Optional but recommended, declare the Python requirements required | ||
# to build your documentation | ||
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html | ||
python: | ||
install: | ||
- requirements: doc/requirements.txt |
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,58 +1,79 @@ | ||
import os | ||
import fileinput | ||
import re | ||
import subprocess | ||
import shutil | ||
import glob | ||
import subprocess | ||
from pathlib import Path | ||
|
||
import versioneer | ||
import update_module_versions | ||
import versioneer | ||
|
||
__version__ = versioneer.get_version() | ||
|
||
HELPDOCSTR = '\n' \ | ||
' % Overloaded help command to display Python help in Matlab\n' \ | ||
' % To use it, please type\n' \ | ||
' %\n' \ | ||
' % >> import euphonic.help\n' \ | ||
' % >> help <topic>\n' \ | ||
' %\n' \ | ||
' % where <topic> is a Python class or method which has been wrapped for use in Matlab.\n' \ | ||
' % If the topic is not wrapped, the normal Matlab help is displayed.\n' \ | ||
|
||
def replace_matlab_docstring(filename, replacement_str): | ||
with open(filename) as f: | ||
txt = f.read() | ||
cm = [m.start() for m in re.finditer(r'\n\s*%', txt)] | ||
nl = [m.start() for m in re.finditer(r'\n', txt)] | ||
idx = [cm[idx] for idx in range(len(cm)) if cm[idx] == nl[idx]] | ||
HELPDOCSTR = """ | ||
% Overloaded help command to display Python help in Matlab | ||
% To use it, please type | ||
% | ||
% >> import euphonic.help | ||
% >> help <topic> | ||
% | ||
% where <topic> is a Python class or method which has been wrapped for use in Matlab. | ||
% If the topic is not wrapped, the normal Matlab help is displayed. | ||
""" | ||
|
||
|
||
def replace_matlab_docstring(filename: Path, replacement_str: str): | ||
txt = filename.read_text(encoding="utf-8") | ||
comment = [m.start() for m in re.finditer(r'\n\s*%', txt)] | ||
newline = [m.start() for m in re.finditer(r'\n', txt)] | ||
idx = [cm for cm, nl in zip(comment, newline) if cm == nl] | ||
newtxt = txt[:idx[0]] + replacement_str + txt[idx[-1]:] | ||
with open(filename, 'w') as f: | ||
f.write(newtxt) | ||
|
||
def create_mltbx(): | ||
import fileinput | ||
# replace version string | ||
version = __version__.split('+')[0] if '+' in __version__ else __version__ # Matlab only accepts numbers | ||
with fileinput.FileInput('mltbx/horace_euphonic_interface.prj', inplace=True) as prj: | ||
filename.write_text(newtxt, encoding="utf-8") | ||
|
||
|
||
def create_mltbx(base_path: Path): | ||
""" | ||
Create toolbox assuming files relative to `base_path` | ||
""" | ||
|
||
# replace version string as MATLAB only accepts numbers | ||
version = __version__.split('+')[0] if '+' in __version__ else __version__ | ||
base_path = base_path.absolute() | ||
|
||
lpw_src = base_path / "light_python_wrapper" | ||
eup_src = base_path / "+euphonic" | ||
mdl_src = base_path / "euphonic_sqw_models" / "euphonic_sqw_models" | ||
mltbx_path = base_path / 'mltbx' | ||
lpw_dest = mltbx_path / "+light_python_wrapper" | ||
eup_dest = mltbx_path / "+euphonic" | ||
mdl_dest = mltbx_path / "euphonic_sqw_models" / "euphonic_sqw_models" | ||
|
||
with fileinput.FileInput(mltbx_path / 'horace_euphonic_interface.prj', inplace=True) as prj: | ||
for line in prj: | ||
# FileInput redirect stdout to the file, for inplace replacement; end='' means don't add extra newlines | ||
print(line.replace('<param.version>1.0</param.version>', f'<param.version>{version}</param.version>'), end='') | ||
# FileInput redirects stdout to the file, for inplace replacement | ||
print(line.replace('<param.version>1.0</param.version>', | ||
f'<param.version>{version}</param.version>'), end='') | ||
|
||
update_module_versions.update_module_versions() | ||
# shutil.copytree expects destination to not exist | ||
for dest_folder in ['+light_python_wrapper', 'euphonic_sqw_models', '+euphonic']: | ||
if os.path.isdir('mltbx/' + dest_folder): shutil.rmtree('mltbx/' + dest_folder) | ||
shutil.copyfile('LICENSE', 'mltbx/LICENSE') | ||
shutil.copyfile('CITATION.cff', 'mltbx/CITATION.cff') | ||
shutil.copytree('light_python_wrapper/+light_python_wrapper', 'mltbx/+light_python_wrapper') | ||
shutil.copytree('euphonic_sqw_models/euphonic_sqw_models', 'mltbx/euphonic_sqw_models/euphonic_sqw_models') | ||
shutil.copytree('+euphonic', 'mltbx/+euphonic') | ||
for fil in glob.glob('light_python_wrapper/helputils/*.m'): shutil.copy(fil, 'mltbx/+euphonic') | ||
for fil in glob.glob('light_python_wrapper/helputils/private/*.m'): shutil.copy(fil, 'mltbx/+euphonic/private') | ||
replace_matlab_docstring('mltbx/+euphonic/help.m', HELPDOCSTR) | ||
replace_matlab_docstring('mltbx/+euphonic/doc.m', HELPDOCSTR.replace('help', 'doc')) | ||
subprocess.run(['matlab', '-batch', 'create_mltbx'], cwd='mltbx') | ||
print('.mltbx created') | ||
if (dest := mltbx_path / dest_folder).is_dir(): | ||
shutil.rmtree(dest) | ||
|
||
if __name__ == '__main__': | ||
create_mltbx() | ||
for file in ('LICENSE', 'CITATION.cff'): | ||
shutil.copy(file, mltbx_path) | ||
|
||
shutil.copytree(lpw_src / "+light_python_wrapper", lpw_dest) | ||
shutil.copytree(mdl_src, mdl_dest) | ||
shutil.copytree(eup_src, eup_dest) | ||
for fil in (lpw_src / "helputils").glob("*.m"): | ||
shutil.copy(fil, eup_dest) | ||
for fil in (lpw_src / "helputils/private").glob("*.m"): | ||
shutil.copy(fil, eup_dest / "private") | ||
|
||
replace_matlab_docstring(eup_dest / "help.m", HELPDOCSTR) | ||
replace_matlab_docstring(eup_dest / "doc.m", HELPDOCSTR.replace('help', 'doc')) | ||
|
||
|
||
if __name__ == '__main__': | ||
curr_path = Path(__file__).parent | ||
create_mltbx(curr_path) |
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,2 @@ | ||
sphinx==7.4.7 | ||
sphinx_rtd_theme==2.0.0 |
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
Submodule light_python_wrapper
updated
2 files
+9 −1 | +light_python_wrapper/light_python_wrapper.m | |
+10 −1 | helputils/doc.m |
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
9 changes: 9 additions & 0 deletions
9
test/mymockfuncs/+matlab/+internal/+doc/+reference/getReferencePage.m
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,9 @@ | ||
function [docPage, displayText, primitive] = getReferencePage(varargin) | ||
% Function to overload built-in "getReferencePage" function | ||
global web_called_with; | ||
web_called_with = varargin; | ||
displayText = string.empty; | ||
primitive = true; | ||
docPage = []; | ||
end | ||
|
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 |
---|---|---|
|
@@ -28,4 +28,4 @@ | |
% Set flags on Linux to avoid segfault with libraries | ||
if ~ispc | ||
py.sys.setdlopenflags(int32(10)) | ||
end | ||
end |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Urgh,
os.path
...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing wrong with that... I don't like to divide my paths...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh no!