Skip to content

Commit

Permalink
Migrate from setup.py to pyproject.toml (#422)
Browse files Browse the repository at this point in the history
`pyproject.toml` is now the standardized way to set packaging metadata
for Python packages. When possible, setuptools recommends using it
rather than a dynamic `setup.py` time.

Switching to `pyproject.toml` specifically unblocks
#419.

Another benefit is we can deduplicate setting the version in two places.

## Gets rid of "universal" wheel

We were incorrectly claiming in `setup.cfg` that the package is
"universal", which means it works with both Python 2 and Python 3. That
is a lie. We don't support Python 2.
  • Loading branch information
Eric-Arellano authored Jun 27, 2023
1 parent 5e359ed commit 4549f2c
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 55 deletions.
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ When adding changes, document the rationale unless the code is already self-docu
You can change [Furo's CSS variable values](https://github.com/pradyunsg/furo/tree/main/src/furo/assets/styles/variables) by setting them in the `body` rule at the top. When introducing our own CSS variables, prefix it with `--qiskit` for clarity, e.g. `--qiskit-top-nav-bar-height`.

### How to update the Furo version
Update the version in `setup.py`. Always pin to an exact version of Furo.
Update the version in `pyproject.toml`. Always pin to an exact version of Furo.

However, when updating, closely analyze each commit in the release to check for any changes that would break our fork. We want to make sure that our HTML files are always in sync with Furo. If they have made any changes, then add them back to our copy of the file.

Expand Down Expand Up @@ -187,7 +187,7 @@ The release process changes whether you are releasing the very first `rc1` for t
1. `git checkout main`
2. `git pull upstream main`
3. `git checkout -b release-<version-number>`, e.g. `release-1.11.0rc1`
4. Bump `setup.py` and `src/qiskit_sphinx_theme/__init__.py` to use the new version, e.g. https://github.com/Qiskit/qiskit_sphinx_theme/pull/207
4. Bump `src/qiskit_sphinx_theme/__init__.py` to use the new version, e.g. https://github.com/Qiskit/qiskit_sphinx_theme/pull/207
5. PR the change and land it
2. Push the Git tag:
1. `git checkout main`
Expand Down Expand Up @@ -221,7 +221,7 @@ Use this process for:
1. `git checkout <release-branch>`, e.g. `1.11`.
2. `git pull upstream <release-branch>`, e.g. `1.11`.
3. `git checkout -b release-<full-version>`, e.g. `release-1.11.0rc3`
4. Bump `setup.py` and `src/qiskit_sphinx_theme/__init__.py` to use the new version, e.g. https://github.com/Qiskit/qiskit_sphinx_theme/pull/207
4. Bump `src/qiskit_sphinx_theme/__init__.py` to use the new version, e.g. https://github.com/Qiskit/qiskit_sphinx_theme/pull/207
5. PR the change and land it. Change the PR's merge base in the top to the release branch; it defaults to `main`.
3. Push the Git tag:
1. `git checkout <release-branch>`, e.g. `1.11`.
Expand Down
43 changes: 40 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,48 @@
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.pytest.ini_options]
addopts = [
"--import-mode=importlib",
[project]
name = "qiskit-sphinx-theme"
description = "A Sphinx theme for Qiskit and Qiskit Ecosystem projects"
dynamic = ["version"]

license = { text = "Apache 2" }
authors = [{ name = "Qiskit Development Team", email = "hello@qiskit.org" }]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Topic :: Internet",
"Topic :: Software Development :: Documentation",
"Framework :: Sphinx :: Theme",
]

dependencies = [
"docutils",
# Keep in sync with Furo's constraint.
"sphinx>=6.0",
# Remove jQuery once we get rid of the Pytorch theme.
"sphinxcontrib-jquery",
# See CONTRIBUTING.md for how to upgrade Furo.
"furo==2023.5.20",
]

[project.entry-points."sphinx.html_themes"]
qiskit_sphinx_theme = "qiskit_sphinx_theme"
_qiskit_furo = "qiskit_sphinx_theme"

[project.urls]
"Bug Tracker" = "https://github.com/Qiskit/qiskit_sphinx_theme/issues"
"Source Code" = "https://github.com/Qiskit/qiskit_sphinx_theme"


[tool.pytest.ini_options]
addopts = ["--import-mode=importlib"]

[tool.black]
line-length = 100
target-version = ["py37", "py38", "py39", "py310", "py311"]
Expand Down
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

43 changes: 0 additions & 43 deletions setup.py

This file was deleted.

8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ commands = sphinx-build -b doctest -W --keep-going -j auto {posargs} docs_guide/
deps =
-r requirements-dev.txt
commands =
black docs_guide/ example_docs/ src/ tests/ setup.py
isort docs_guide/ example_docs/ src/ tests/ setup.py
black docs_guide/ example_docs/ src/ tests/
isort docs_guide/ example_docs/ src/ tests/

[testenv:lint]
deps =
-r requirements-dev.txt
commands =
black --check docs_guide/ example_docs/ src/ tests/ setup.py
isort --check docs_guide/ example_docs/ src/ tests/ setup.py
black --check docs_guide/ example_docs/ src/ tests/
isort --check docs_guide/ example_docs/ src/ tests/
mypy src/

0 comments on commit 4549f2c

Please sign in to comment.