Skip to content

Commit 883f9b3

Browse files
committed
Merge branch 'main' into 1.0.0_alpha
2 parents 3a01960 + 4f1e334 commit 883f9b3

40 files changed

Lines changed: 3025 additions & 363 deletions

.azure-pipelines/azure-pipelines-linux.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
python.version: '3.9'
1515
linux-Python310:
1616
python.version: '3.10'
17+
linux-Python311:
18+
python.version: '3.11'
1719
steps:
1820

1921
- bash: |
@@ -33,7 +35,7 @@ jobs:
3335
- bash: |
3436
source "${HOME}/conda/etc/profile.d/conda.sh"
3537
conda activate discretize-test
36-
pip install -e .
38+
pip install --no-build-isolation --editable .
3739
displayName: Install requirements and build
3840
condition: ne(variables['python.version'], '3.10')
3941
@@ -48,8 +50,7 @@ jobs:
4850
- bash: |
4951
source "${HOME}/conda/etc/profile.d/conda.sh"
5052
conda activate discretize-test
51-
export DISC_COV=1
52-
pip install -e .
53+
pip install --no-build-isolation --editable . --config-settings=setup-args="-Dcy_line_trace=true"
5354
displayName: Install requirements and build for Testing
5455
condition: eq(variables['python.version'], '3.10')
5556

.azure-pipelines/azure-pipelines-osx.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ jobs:
1111
python.version: '3.9'
1212
osx-Python310:
1313
python.version: '3.10'
14+
linux-Python311:
15+
python.version: '3.11'
1416
steps:
1517

1618
- bash: |
@@ -30,7 +32,7 @@ jobs:
3032
- bash: |
3133
source "${HOME}/conda/etc/profile.d/conda.sh"
3234
conda activate discretize-test
33-
pip install -e .
35+
pip install --no-build-isolation --editable .
3436
displayName: Install requirements and build
3537
3638
- script: |

.azure-pipelines/azure-pipelines-win.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ jobs:
1111
python.version: '3.9'
1212
win-Python310:
1313
python.version: '3.10'
14+
linux-Python311:
15+
python.version: '3.11'
1416
steps:
1517

1618
- powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
@@ -31,7 +33,7 @@ jobs:
3133
3234
- script: |
3335
call activate discretize-test
34-
pip install -e .
36+
pip install --no-build-isolation --editable .
3537
displayName: Build
3638
3739
- script: |

.git_archival.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node: $Format:%H$
2+
node-date: $Format:%cI$
3+
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
4+
ref-names: $Format:%D$

.gitattributes

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.git_archival.txt export-subst
2+
# Excluding files from an sdist generated by meson-python
3+
4+
.azure-pipelines/* export-ignore
5+
.ci/* export-ignore
6+
docs/* export-ignore
7+
examples/* export-ignore
8+
tests/* export-ignore
9+
tutorials/* export-ignore
10+
11+
.coveragerc export-ignore
12+
.flake8 export-ignore
13+
.git* export-ignore
14+
*.yml export-ignore
15+
*.yaml export-ignore
16+
requirements_style.txt export-ignore

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/psf/black
3-
rev: 23.1a1
3+
rev: 23.9.1
44
hooks:
55
- id: black
66
language_version: python3

MANIFEST.in

Lines changed: 0 additions & 8 deletions
This file was deleted.

azure-pipelines.yml

Lines changed: 75 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ stages:
2525
pool:
2626
vmImage: ubuntu-latest
2727
variables:
28-
python.version: '3.8'
28+
python.version: '3.9'
2929
steps:
3030
- script: |
3131
pip install -r requirements_style.txt
@@ -38,7 +38,7 @@ stages:
3838
pool:
3939
vmImage: ubuntu-latest
4040
variables:
41-
python.version: '3.8'
41+
python.version: '3.9'
4242
steps:
4343
- script: |
4444
pip install -r requirements_style.txt
@@ -53,6 +53,7 @@ stages:
5353
- template: ./.azure-pipelines/azure-pipelines-win.yml
5454

5555
- stage: Deploy
56+
displayName: "Deploy Source Wheels and Docs"
5657
condition: and(succeeded(), startsWith(variables['build.sourceBranch'], 'refs/tags/'))
5758
jobs:
5859
- job:
@@ -92,13 +93,14 @@ stages:
9293
- bash: |
9394
source "${HOME}/conda/etc/profile.d/conda.sh"
9495
conda activate discretize-test
95-
pip install -e .
96+
pip install --no-build-isolation --editable .
9697
displayName: Build package
9798
9899
- bash: |
99100
source "${HOME}/conda/etc/profile.d/conda.sh"
100101
conda activate discretize-test
101-
python setup.py sdist
102+
python -m build --no-isolation --skip-dependency-check --sdist .
103+
ls -la dist
102104
twine upload --skip-existing dist/*
103105
displayName: Deploy source
104106
env:
@@ -129,28 +131,78 @@ stages:
129131
env:
130132
GH_TOKEN: $(gh.token)
131133
132-
- job:
133-
displayName: Windows Wheels
134-
strategy:
135-
matrix:
136-
win-Python38:
137-
python.version: '3.8'
138-
win-Python39:
139-
python.version: '3.9'
140-
win-Python310:
141-
python.version: '3.10'
142-
pool:
143-
vmImage: windows-latest
134+
- job: linux
135+
displayName: Build Linux wheels
136+
pool: { vmImage: 'Ubuntu-20.04' }
137+
steps:
138+
- task: UsePythonVersion@0
139+
- bash:
140+
git fetch --tags
141+
displayName: Fetch tags
142+
- bash: |
143+
set -o errexit
144+
python3 -m pip install --upgrade pip
145+
pip3 install cibuildwheel==2.16.2
146+
pip3 install twine
147+
displayName: Install dependencies
148+
- bash: cibuildwheel --output-dir wheelhouse .
149+
displayName: Build wheels
150+
- script: twine upload --skip-existing wheelhouse/*
151+
displayName: Upload to PYPI
152+
env:
153+
TWINE_USERNAME: $(twine.username)
154+
TWINE_PASSWORD: $(twine.password)
155+
- task: PublishBuildArtifacts@1
156+
inputs: { pathtoPublish: 'wheelhouse' }
157+
158+
- job: macos
159+
displayName: Build Mac wheels
160+
pool: { vmImage: 'macOS-11' }
161+
variables:
162+
CIBW_ARCHS_MACOS: "x86_64 arm64"
144163
steps:
145164
- task: UsePythonVersion@0
146-
inputs:
147-
versionSpec: '$(python.version)'
148-
- script: pip install numpy cython twine wheel setuptools_scm
149-
displayName: Install build dependencies
150-
- script: python setup.py bdist_wheel
151-
displayName: Build Wheel
152-
- script: twine upload --skip-existing dist/*
165+
- bash:
166+
git fetch --tags
167+
displayName: Fetch tags
168+
- bash: |
169+
set -o errexit
170+
python3 -m pip install --upgrade pip
171+
python3 -m pip install cibuildwheel==2.16.2
172+
python3 -m pip install twine
173+
displayName: Install dependencies
174+
- bash: cibuildwheel --output-dir wheelhouse .
175+
displayName: Build wheels
176+
- script: twine upload --skip-existing wheelhouse/*
177+
displayName: Upload to PYPI
178+
env:
179+
TWINE_USERNAME: $(twine.username)
180+
TWINE_PASSWORD: $(twine.password)
181+
- task: PublishBuildArtifacts@1
182+
inputs: { pathtoPublish: wheelhouse }
183+
184+
- job: windows
185+
displayName: Build Windows wheels
186+
pool: { vmImage: 'windows-2019' }
187+
variables:
188+
CIBW_ARCHS_WINDOWS: "AMD64"
189+
steps:
190+
- task: UsePythonVersion@0
191+
- bash:
192+
git fetch --tags
193+
displayName: Fetch tags
194+
- bash: |
195+
set -o errexit
196+
python -m pip install --upgrade pip
197+
pip install cibuildwheel==2.16.2
198+
pip install twine
199+
displayName: Install dependencies
200+
- bash: cibuildwheel --output-dir wheelhouse .
201+
displayName: Build wheels
202+
- script: twine upload --skip-existing wheelhouse/*
153203
displayName: Upload to PYPI
154204
env:
155205
TWINE_USERNAME: $(twine.username)
156206
TWINE_PASSWORD: $(twine.password)
207+
- task: PublishBuildArtifacts@1
208+
inputs: { pathtoPublish: 'wheelhouse' }

discretize/Tests/meson.build

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
python_sources = [
3+
'__init__.py',
4+
]
5+
6+
py.install_sources(
7+
python_sources,
8+
subdir: 'discretize/Tests'
9+
)

discretize/__init__.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
try:
4747
from discretize.tree_mesh import TreeMesh
4848
except ImportError as err:
49-
print(err)
5049
import os
5150

5251
# Check if being called from non-standard location (i.e. a git repository)
@@ -56,29 +55,30 @@
5655
# Then we are being run from a repository
5756
raise ImportError(
5857
"""
59-
Unable to import TreeMesh.
58+
It would appear that discretize is being imported from its source code
59+
directory and is unable to load its compiled extension modules. Try changing
60+
your directory and re-launching your python interpreter.
6061
61-
It would appear that discretize is being imported from its repository.
62-
If this is intentional, you need to run:
63-
64-
python setup.py build_ext --inplace
65-
66-
to compile the cython code.
62+
If this was intentional, you need to install discretize in an editable mode.
6763
"""
6864
)
65+
else:
66+
raise err
6967
from discretize import tests
7068

7169
__author__ = "SimPEG Team"
7270
__license__ = "MIT"
7371
__copyright__ = "2013 - 2023, SimPEG Developers, https://simpeg.xyz"
7472

73+
from importlib.metadata import version, PackageNotFoundError
74+
7575
# Version
7676
try:
7777
# - Released versions just tags: 0.8.0
7878
# - GitHub commits add .dev#+hash: 0.8.1.dev4+g2785721
7979
# - Uncommitted changes add timestamp: 0.8.1.dev4+g2785721.d20191022
80-
from discretize.version import version as __version__
81-
except ImportError:
80+
__version__ = version("discretize")
81+
except PackageNotFoundError:
8282
# If it was not installed, then we don't know the version. We could throw a
8383
# warning here, but this case *should* be rare. discretize should be
8484
# installed properly!

0 commit comments

Comments
 (0)