Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/build-ultraplot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jobs:
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: mamba-org/[email protected]
with:
environment-file: ./environment.yml
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ jobs:
matplotlib-versions: ${{ steps.set-versions.outputs.matplotlib-versions }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: "3.11"
Expand Down
77 changes: 71 additions & 6 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
name: Publish to PyPI
on:
pull_request:
release:
types: [published]
push:
tags: ["v*"]

concurrency:
group: publish-pypi
cancel-in-progress: false

jobs:
publish-pypi-test:
name: Publish to TestPyPI
Expand All @@ -19,18 +24,50 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
shell: bash

- uses: actions/setup-python@v5
with:
python-version: "3.x"
python-version: "3.12"

- name: Build package
run: |
python -m pip install build
python -m build
python -m pip install --upgrade pip wheel setuptools setuptools_scm build twine
python -m build --sdist --wheel . --outdir dist

- name: CheckFiles
run: |
ls dist
shell: bash

- name: Test wheels
run: |
pushd dist
python -m pip install ultraplot*.whl

version=$(python -c "import ultraplot; print(ultraplot.__version__)")
echo "Version: $version"
if [[ "$version" == "0."* ]]; then
echo "Version is not set correctly!"
exit 1
fi

python -m twine check *
popd
shell: bash

- name: Publish to TestPyPI
if: github.event_name != 'pull_request'
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
verbose: true
# releases generate both release and tag events so
# we get a race condition if we don't skip existing
skip-existing: ${{ github.event_name == 'release' && 'true' || 'false' }}

publish-prod:
name: Publish to PyPI
Expand All @@ -47,13 +84,41 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
shell: bash

- uses: actions/setup-python@v5
with:
python-version: "3.x"
python-version: "3.12"

- name: Build package
run: |
python -m pip install build
python -m build
python -m pip install --upgrade pip wheel setuptools setuptools_scm build twine
python -m build --sdist --wheel . --outdir dist

- name: CheckFiles
run: |
ls dist
shell: bash

- name: Test wheels
run: |
pushd dist
python -m pip install ultraplot*.whl

version=$(python -c "import ultraplot; print(ultraplot.__version__)")
echo "Version: $version"
if [[ "$version" == "0."* ]]; then
echo "Version is not set correctly!"
exit 1
fi

python -m twine check *
popd
shell: bash

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ __pycache__
tmp
trash
garbage

# version file
ultraplot/_version.py
24 changes: 8 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
[build-system]
requires = ["setuptools>=64",
"setuptools_scm[toml]>=8",
"wheel",
"numpy>=1.26.0",
"matplotlib>=3.9",
]
requires = [
"setuptools>=64",
"setuptools_scm[toml]>=8",
"wheel",
]
build-backend = "setuptools.build_meta"

[project]
Expand All @@ -13,7 +12,6 @@ authors = [
{name = "Casper van Elteren", email = "[email protected]"},
{name = "Luke Davis", email = "[email protected]"},
]

maintainers = [
{name = "Casper van Elteren", email = "[email protected]"},
]
Expand All @@ -38,21 +36,15 @@ dependencies= [
]
dynamic = ["version"]


[project.urls]
"Documentation" = "https://ultraplot.readthedocs.io"
"Issue Tracker" = "https://github.com/ultraplot/ultraplot/issues"
"Source Code" = "https://github.com/ultraplot/ultraplot"

[project.entry-points."setuptools.finalize_distribution_options"]
setuptools_scm = "setuptools_scm._integration.setuptools:infer_version"



[tool.setuptools]
packages = ["ultraplot"]
packages = {find = {exclude=["docs*", "baseline*", "logo*"]}}
include-package-data = true

[tool.setuptools_scm]
version_scheme = "post-release"
local_scheme = "dirty-tag"
write_to = "ultraplot/_version.py"
write_to_template = "__version__ = '{version}'\n"
12 changes: 5 additions & 7 deletions ultraplot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
name = "ultraplot"

try:
from importlib.metadata import version as get_version
except ImportError: # for Python < 3.8
from importlib_metadata import version as get_version
try:
version = __version__ = get_version(name)
except Exception:
version = __version__ = "unknown"
from ._version import __version__
except ImportError:
__version__ = "unknown"

version = __version__

# Import dependencies early to isolate import times
from . import internals, externals, tests # noqa: F401
Expand Down