Skip to content

Commit

Permalink
Merge pull request #355 from BCG-Gamma/dev/2.1rc2
Browse files Browse the repository at this point in the history
BUILD: release pytools 2.1rc2
  • Loading branch information
j-ittner authored Apr 14, 2023
2 parents a7b27f2 + 04016df commit 3c39184
Show file tree
Hide file tree
Showing 11 changed files with 152 additions and 75 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort

Expand All @@ -11,7 +11,7 @@ repos:
language: python_venv
language_version: python39

- repo: https://gitlab.com/pycqa/flake8
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
hooks:
- id: flake8
Expand All @@ -34,11 +34,11 @@ repos:
exclude: condabuild/meta.yaml

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.981
rev: v1.2.0
hooks:
- id: mypy
files: src|sphinx|test
language: python_venv
language_version: python39
additional_dependencies:
- numpy~=1.22
- numpy~=1.24
31 changes: 29 additions & 2 deletions RELEASE_NOTES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,43 @@ Release Notes
correctly.


*pytools* 2.1
-------------

2.1.0
~~~~~

- API: new decorator :obj:`.fitted_only` to mark methods that may only be
called after their associated object has been fitted using :meth:`.FittableMixin.fit`.
- API: remove method ``ensure_fitted`` from :class:`.FittableMixin`, which is no longer
needed due to the new decorator :obj:`.fitted_only`.
- API: new Sphinx callback :class:`.TrackCurrentClass` to keep track of the current
class being processed by *autodoc*.
- API: new Sphinx callback :class:`.RenamePrivateArguments` to rename private
“positional-only” arguments in a function's signature (with two leading underscores)
back to their original names in the source code, so that *autodoc* can pick them up
correctly.
- API: :class:`.Expression` objects support plain text and HTML output in Jupyter
notebooks


*pytools* 2.0
-------------

*pytools* 2.0 features enhanced visualisations together with additional API improvements,
*pytools* 2 introduces enhanced visualisations along with additional API improvements,
and is now subject to static type checking with |mypy|.


2.0.6
~~~~~

- BUILD: add support for :mod:`pandas` |nbsp| 2.0 and above


2.0.5
~~~~~

- API: de-dent docstrings before processing them with the :obj:``.subsdoc`` decorator
- API: de-dent docstrings before processing them with the :obj:`.subsdoc` decorator
- FIX: in method :meth:`.AllTracker.resolve_forward_references`, unwrap functions before
accessing their ``__globals__`` attribute

Expand Down
66 changes: 39 additions & 27 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ stages:
versionSpec: '3.9'
displayName: 'use Python 3.9'
- script: |
python -m pip install isort~=5.10
python -m pip install isort~=5.12
python -m isort --check --diff .
displayName: 'Run isort'
- job:
Expand Down Expand Up @@ -87,7 +87,7 @@ stages:
versionSpec: '3.9'
displayName: 'use Python 3.9'
- script: |
python -m pip install mypy~=0.981 numpy~=1.22
python -m pip install mypy~=1.2.0 numpy~=1.24
python -m mypy src
displayName: 'Run mypy'
Expand All @@ -101,17 +101,20 @@ stages:
displayName: 'detect changes'
steps:
- checkout: self
fetchDepth: 2

- task: Bash@3
name: diff
inputs:
targetType: 'inline'
script: |
set -eux
echo Repo: $(Build.DefinitionName)
cd $(System.DefaultWorkingDirectory)
files_changed=$(git diff $(Build.SourceVersion)^! --name-only)
files_changed=$(git diff $(Build.SourceVersion)^ --name-only)
echo "Files changed since last commit: ${files_changed}"
n_files_changed=$(git diff $(Build.SourceVersion)^! --name-only | grep -i -E 'meta\.yaml|pyproject\.toml|azure-pipelines\.yml|tox\.ini|make\.py' | wc -l | xargs)
n_files_changed=$(git diff $(Build.SourceVersion)^ --name-only | grep -i -E 'meta\.yaml|pyproject\.toml|azure-pipelines\.yml|tox\.ini|make\.py' | wc -l | xargs)
if [ ${n_files_changed} -gt 0 ]
then
build_changed=1
Expand Down Expand Up @@ -141,8 +144,8 @@ stages:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
displayName: 'use Python 3.8'
versionSpec: '3.9'
displayName: 'use Python 3.9'

- checkout: self

Expand All @@ -153,10 +156,15 @@ stages:
targetType: 'inline'
script: |
set -eux
eval "$(conda shell.bash hook)"
conda env create
conda activate $(project_name)-develop
# install micromamba
curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj bin/micromamba
export MAMBA_ROOT_PREFIX=~/micromamba
eval "$(./bin/micromamba shell hook -s posix)"
# install the develop environment
micromamba env create --yes --file environment.yml
micromamba activate $(project_name)-develop
export PYTHONPATH=$(System.DefaultWorkingDirectory)/src/
export RUN_PACKAGE_VERSION_TEST=$(project_name)
Expand Down Expand Up @@ -409,8 +417,8 @@ stages:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
displayName: 'use Python 3.8'
versionSpec: '3.9'
displayName: 'use Python 3.9'

- checkout: pytools
- checkout: self
Expand Down Expand Up @@ -474,8 +482,8 @@ stages:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
displayName: 'use Python 3.8'
versionSpec: '3.9'
displayName: 'use Python 3.9'

- checkout: pytools
- checkout: self
Expand Down Expand Up @@ -601,8 +609,8 @@ stages:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
displayName: 'use Python 3.8'
versionSpec: '3.9'
displayName: 'use Python 3.9'

- task: InstallSSHKey@0
inputs:
Expand All @@ -611,7 +619,6 @@ stages:
sshKeySecureFile: 'deploy_docs_$(project_name)'
displayName: 'Install the deploy SSH key'

- checkout: pytools
- checkout: self

- script: dir $(Build.SourcesDirectory)
Expand All @@ -622,7 +629,7 @@ stages:
script: |
set -eux
cd $(System.DefaultWorkingDirectory)/$(project_root)
cd $(System.DefaultWorkingDirectory)
echo "Checking out github-pages"
git checkout --track origin/github-pages
Expand All @@ -642,16 +649,20 @@ stages:
targetType: 'inline'
script: |
set -eux
eval "$(conda shell.bash hook)"
cd $(System.DefaultWorkingDirectory)/$(project_root)
cd $(System.DefaultWorkingDirectory)
echo "Checking out $(branchName)"
git checkout $(branchName)
conda env create
conda activate $(project_name)-develop
# install micromamba
curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj bin/micromamba
export MAMBA_ROOT_PREFIX=~/micromamba
eval "$(./bin/micromamba shell hook -s posix)"
# install the develop environment
micromamba env create --yes --file environment.yml
micromamba activate $(project_name)-develop
export PYTHONPATH=$(System.DefaultWorkingDirectory)/$(project_root)/src/
export PYTHONPATH=$(System.DefaultWorkingDirectory)/src/
python sphinx/make.py html
Expand All @@ -662,21 +673,22 @@ stages:
targetType: 'inline'
script: |
set -eux
eval "$(conda shell.bash hook)"
export MAMBA_ROOT_PREFIX=~/micromamba
eval "$(./bin/micromamba shell hook -s posix)"
# install the tree utility
sudo apt-get install tree
cd $(System.DefaultWorkingDirectory)/$(project_root)
cd $(System.DefaultWorkingDirectory)
echo "Restoring previous documentation to the docs directory"
mkdir -p docs
mv $(Build.ArtifactStagingDirectory)/docs-version.bak docs/docs-version
ls docs/docs-version
mkdir -p $(System.DefaultWorkingDirectory)/$(project_root)/sphinx/build/
mkdir -p $(System.DefaultWorkingDirectory)/sphinx/build/
conda activate $(project_name)-develop
micromamba activate $(project_name)-develop
python sphinx/make.py prepare_docs_deployment
echo "Current docs contents:"
Expand Down Expand Up @@ -708,7 +720,7 @@ stages:
targetType: 'inline'
script: |
set -eux
cd $(System.DefaultWorkingDirectory)/$(project_root)
cd $(System.DefaultWorkingDirectory)
echo "Adjusting git credentials"
git config --global user.name "Azure Pipelines"
Expand Down
48 changes: 24 additions & 24 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,36 @@ channels:
- bcg_gamma
dependencies:
# run
- joblib ~= 1.1
- matplotlib ~= 3.5
- numpy ~= 1.22
- pandas ~= 1.4
- joblib ~= 1.2
- matplotlib ~= 3.6
- numpy ~= 1.23
- pandas ~= 2.0
- python ~= 3.9
- scipy ~= 1.8
- scipy ~= 1.10
- typing_extensions ~= 4.3
- typing_inspect ~= 0.7
# build/test
- conda-build ~= 3.21
- conda-verify ~= 3.1
- docutils ~= 0.17
- flit ~= 3.0
- jinja2 ~= 2.11
- conda-build ~= 3.23.3
- conda-verify ~= 3.1.1
- docutils ~= 0.17.1
- flit ~= 3.8.0
- jinja2 ~= 2.11.3
- markupsafe ~= 2.0.1 # markupsafe 2.1 breaks support for jinja2
- m2r ~= 0.2
- pluggy ~= 0.13
- pre-commit ~= 2.20
- pytest ~= 7.1
- pytest-cov ~= 2.12
- pyyaml ~= 5.4
- toml ~= 0.10
- tox ~= 3.24
- yaml ~= 0.2
- m2r ~= 0.3.1
- pluggy ~= 0.13.1
- pre-commit ~= 2.21.0
- pytest ~= 7.2.1
- pytest-cov ~= 2.12.1
- pyyaml ~= 5.4.1
- toml ~= 0.10.2
- tox ~= 3.27.1
- yaml ~= 0.2.5
# sphinx
- sphinx ~= 4.5
- sphinx-autodoc-typehints ~= 1.19
- nbsphinx ~= 0.8.9
- sphinx ~= 4.5.0
- sphinx-autodoc-typehints ~= 1.19.2
- pydata-sphinx-theme ~= 0.8.1
# notebooks
- jupyterlab ~= 3.2
- openpyxl ~= 3.0
- seaborn ~= 0.11
- jupyterlab ~= 3.5.2
- openpyxl ~= 3.0.10
- seaborn ~= 0.12.2
17 changes: 7 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ license = "Apache Software License v2.0"
requires = [
"joblib >=0.14,<2a",
"matplotlib ~=3.0",
"numpy >=1.21,<2a",
"pandas >=0.24,<2a",
"numpy >=1.21,<2a", # cannot use ~= due to conda bug
"pandas >=1",
"scipy ~=1.2",
"typing_inspect ~=0.4",
"typing_extensions ~=4.0",
Expand All @@ -44,10 +44,7 @@ classifiers = [
[tool.flit.metadata.requires-extra]
testing = [
"pytest ~= 7.1",
"pytest-cov ~= 2.8",
"flake8 ~= 3.8",
"flake8-comprehensions ~= 3.2",
"isort ~= 5.5",
"pytest-cov ~= 2.12",
]
docs = [
"sphinx ~= 4.5",
Expand All @@ -74,8 +71,8 @@ no-binary.min = ["matplotlib"]
joblib = "~=0.14.0"
matplotlib = "~=3.0.3"
numpy = "==1.21.6" # cannot use ~= due to conda bug
pandas = "~=0.24.2"
python = "==3.7.12" # cannot use ~= due to conda bug
pandas = "~=1.0.5"
python = ">=3.7.12,<3.8a" # cannot use ~= due to conda bug
scipy = "~=1.2.1"
typing_inspect = "~=0.4.0"
typing_extensions = "~=4.0.0"
Expand All @@ -84,8 +81,8 @@ typing_extensions = "~=4.0.0"
# maximum requirements of gamma-pytools
joblib = "~=1.1"
matplotlib = "~=3.5"
numpy = ">=1.23,<2a" # cannot use ~= due to conda bug
pandas = "~=1.4"
numpy = ">=1.24,<2a" # cannot use ~= due to conda bug
pandas = "~=2.0"
python = ">=3.9,<4a" # cannot use ~= due to conda bug
scipy = "~=1.8"
typing_inspect = "~=0.7"
Expand Down
2 changes: 1 addition & 1 deletion src/pytools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
A collection of Python extensions and tools used in BCG GAMMA's open-source libraries.
"""
__version__ = "2.1rc1"
__version__ = "2.1rc2"
2 changes: 1 addition & 1 deletion src/pytools/data/_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def _arg_to_array(
if axis_arg is None:
return None
else:
arr = np.array(axis_arg)
arr = np.asarray(axis_arg)
if arr.ndim != 1:
raise ValueError(
f"arg {arg_name_}[{axis}] must be a 1d array, but has "
Expand Down
Loading

0 comments on commit 3c39184

Please sign in to comment.