Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Remove setuptools_scm_git_archive dependency and add sdist test #23387

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

Merged
merged 2 commits into from
Aug 14, 2022
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 .git_archival.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true)$
ref-names: $Format:%D$
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this line? the refs name includes both branches and tags and is the source of a lot of trouble with non-reproducible downloads from github...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea. I just copied from https://github.com/Changaco/setuptools_scm_git_archive where they have that line in the migration guide.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets defer this question to a later time. It is a can of worms I do not want to block this moving forward.

64 changes: 64 additions & 0 deletions .github/workflows/cibuildsdist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build CI sdist and wheel

on:
# Save CI by only running this on release branches or tags.
push:
branches:
- main
- v[0-9]+.[0-9]+.x
tags:
- v*
# Also allow running this action on PRs if requested by applying the
# "Run cibuildwheel" label.
pull_request:
types:
- opened
- synchronize
- reopened
- labeled

jobs:
build_sdist:
if: |
github.event_name == 'push' ||
github.event_name == 'pull_request' && (
(
github.event.action == 'labeled' &&
github.event.label.name == 'Run cibuildwheel'
) ||
contains(github.event.pull_request.labels.*.name, 'Run cibuildwheel')
)
name: Build sdist and wheel on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
python-version: ['3.8', '3.9', '3.10', '3.11.0-alpha - 3.11']

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-python@v4
name: Install Python
with:
python-version: ${{ matrix.python-version }}

- name: Install build
run: pip install build

- name: Build sdist and wheel
run: python -m build .

- name: Install built matplotlib sdist
run: pip install dist/matplotlib*.tar.gz

- name: Check version number is not 0
run: python ./ci/check_version_number.py

- name: Install built matplotlib wheel
run: pip install dist/matplotlib*.whl --force-reinstall

- name: Check version number is not 0
run: python ./ci/check_version_number.py
23 changes: 23 additions & 0 deletions ci/check_version_number.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env python3

"""
Check that the version number of the install Matplotlib does not start with 0

To run:
$ python3 -m build .
$ pip install dist/matplotlib*.tar.gz for sdist
$ pip install dist/matplotlib*.whl for wheel
$ ./ci/check_version_number.py
"""
import matplotlib

import sys

EXIT_SUCCESS = 0
EXIT_FAILURE = 1


print(f"Version {matplotlib.__version__} installed")
if matplotlib.__version__[0] == "0":
sys.exit(EXIT_FAILURE)
sys.exit(EXIT_SUCCESS)
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,7 @@ def make_release_tree(self, base_dir, files):
setup_requires=[
"certifi>=2020.06.20",
"numpy>=1.19",
"setuptools_scm>=4",
"setuptools_scm_git_archive",
"setuptools_scm>=7",
],
install_requires=[
"contourpy>=1.0.1",
Expand All @@ -317,7 +316,7 @@ def make_release_tree(self, base_dir, files):
"python-dateutil>=2.7",
] + (
# Installing from a git checkout that is not producing a wheel.
["setuptools_scm>=4"] if (
["setuptools_scm>=7"] if (
Path(__file__).with_name(".git").exists() and
os.environ.get("CIBUILDWHEEL", "0") != "1"
) else []
Expand Down