Skip to content

Conversation

@mhucka
Copy link
Collaborator

@mhucka mhucka commented Jan 2, 2026

This addresses deprecation warnings originating from the use of outdated setuptools functions, and takes the opportunity to modernize the management of the version number and the dependencies in accordance with current Python practices (PEP 621, 735).

Key changes include:

  • All declarative package metadata (e.g., name, author, classifiers) has been moved from setup.py to pyproject.toml. What's left in setup.py has been simplified to only contain the logic necessary for building the C++ extensions and calling setup.

  • The qsim version number is now stored in only one file, qsimcirq/_version.py, and both pyproject.toml and setup.py read it from there. In the case of setup.py, the use of the deprecated self.distribution.get_version() has been replaced with the use of runpy to read the version number from qsimcirq/_version.py. (The latter change fixes Fix use of deprecated setuptools functions #839.)

  • The development dependencies are no longer stored as "extras" but rather use the pyproject.toml [dependency-groups] section introduced in 2024 by PEP 735 and recognized by pip version 25.1+. This means dev-requirements.txt is gone, and development dependencies are installed using

     pip install --group dev
  • pyproject.toml defines the versions of Python for which cibuildwheel builds wheels (in section [tool.cibuildwheel]).

mhucka added 6 commits January 2, 2026 00:58
The modern approach is to put more things into `pyproject.toml`. This
moves most things out of `setup.py`.

The version number is now read from from the file
`qsimcirq/_version.py` in both setup.py and pyproject.toml, so that
there is a single source of truth for that value.
Remove no-longer-needed dev-requirements.txt. Its contents are in
pyproject.toml now.
The more modern way of handling development dependencies is to put them
in pyproject.toml and then use `pip install --group dev` to install them.
Some transitive dependencies have had version updates that cause
conflicts for some combinations of our builds, such as contourpy
requiring Python 3.11. This puts more constraints on this so that
qsimcirq builds everywhere.
1. Need to change the workdir at a different point.
2. Need to activate the venv.
@github-actions github-actions bot added the size: L 250< lines changed <1000 label Jan 2, 2026
@mhucka mhucka marked this pull request as ready for review January 2, 2026 03:05
Copy link
Collaborator

@pavoljuhas pavoljuhas left a comment

Choose a reason for hiding this comment

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

If possible, cmake and pybind should be dropped from runtime dependencies (see inline). Otherwise LGTM with some optional suggestions.

sergeisakov and others added 11 commits January 18, 2026 07:30
This updates some of the jobs in the CI workflow to use the larger
runners we've configured for our org, so that CI runs faster.
This is a simple script to help contributors easily run pylint
recursively on the right directories. It also passes `--jobs=0` to make
it as fast as possible by default.
A better practice for jobs where the first step is to `cd` into a
directory is to use the field `working-directory` in the step definition
and skip the `cd`.
…user know (quantumlib#967)

Due to the fact that the package name is not the same as the module name
(`py-cpuinfo` vs `cpuinfo`), the error that results from trying to run
this script when `py-cpuinfo` is not installed can be confusing. Let's
help users & developers by testing for the package and pointing them in
the right direction.

Also, slightly improve the clarity of the usage message text in this
script.

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
On systems where there is no /proc/cpuinfo, you get an error message. We
don't need to see it; we just need the result of the grep.
Tell Homebrew not to auto-update when running. Auto-updating is not
necessary here and just wastes time when it happens.
IMHO it's useful to see Markdown files as one of the types of files
listed on the GitHub front page in the file statistics section,
alongside other files. It gives a sense for the amount of documentation
present in a project.

On the other hand, some configuration files are not useful to count,
such as .md files in a `.gemini/` subdirectory and configuration files
for tools like git.
`isort` is used in `check/format-incremental`, but there is no
configuration for it. This adds a configuration based on what Cirq
currently uses.
The warning described in quantumlib#929
seems to be the result of using an older version of Eigen. Updating the
version makes the warning go go away.
mhucka and others added 12 commits January 18, 2026 07:31
…umlib#990)

The way `CXXFLAGS` and other flags were being set meant that users had
to add the default values (`-std=c++17 -fopenmp -O3` etc) if they set
the flags at all, or else lose the defaults. This was error-prone and
suboptimal. The change here makes it so that the user values are
appended at the end of the defaults, so that they can override values.

This PR also adds a DEBUG flag that switches between using `-g -O0` and
the regular `-O3` option. Developers can invoke it using, e.g., `make
DEBUG=1`.
…ntumlib#991)

There was an inconsistency in the Makefiles versus `tests/BUILD` and
`tests/make.sh`, in that a couple of the Makewfiles used `-msse4.1`
while the BUILD file and `tests/make.sh` used `-msse4`. In addition, it
seems that `-msse4` subsumes `-msse4.1`, and so overall, it appears
better to use `-msse4`.

Fixes quantumlib#892.
This adds checks to the GitHub Actions workflows for the owner being
Quantumlib, so that users who fork the repo will not be surprised by the
workflows running in their forks.
It looks like it's possible to use the `-mbmi2` flag when `-mavx2` is
used, based on documentation and on testing locally. This was done in
some Makefiles but not consistently. This PR adds the flag to Makefiles
where it was missing, plus also in one BUILD file.
…mlib#995)

The `CMakeBuild` class' `run()` method tests the version of CMake;
however, it did the test only when on Windows. It seems like this is a
test worth doing everywhere, so I removed test for Windows.

In addition, while at it, I slightly updated the way the process output
is captured, and expanded the range of exceptions tested in order to
provide more specific feedback to users.

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
As pointed out by Pavol in the review comments, CMake should only be
needed for building qsim, and not a run-time installation dependency.
Move the installation of the dev dependencies to the top-level
Dockerfile because things fail to build otherwise.
As noted by Pavol in
https://github.com/quantumlib/qsim/pull/985/changes#r2678037600, it's
not necessary to update pip when `--upgrade-deps` is used in the venv creation.
As pointed out by Pavol in review comments, the venv activation command
was pointless.
Setting the workdir makes more sense to do before creating the venv.
@github-actions github-actions bot added size: XL lines changed >1000 and removed size: L 250< lines changed <1000 labels Jan 18, 2026
@github-actions github-actions bot added size: L 250< lines changed <1000 and removed size: XL lines changed >1000 labels Jan 18, 2026
@mhucka mhucka requested a review from pavoljuhas January 18, 2026 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: L 250< lines changed <1000

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix use of deprecated setuptools functions

3 participants