Skip to content
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

Synchronize setup.cfg and pyproject.toml, bump project versions in both, and add 2-line setup.py #1323

Conversation

goxberry
Copy link

@goxberry goxberry commented May 9, 2022

Summary

This pull request does three things:

  • Attempts to synchronize setup.cfg and pyproject.toml settings so that installing from source via build doesn't yield an installation with a stale version like 5.0.0.
  • Bumps the project versions listed in setup.cfg and pyproject.toml from 5.3.4 and 5.0.0, respectively, to 7.0.1, reflecting a patch version increase above the most recent tag and release on GitHub.
  • Adds a 2-line, pro forma setup.py script.

Rationale

The current project metadata in both setup.cfg and pyproject.toml looks stale, and the data in each is in conflict. Synchronizing them would make dependency data and other metadata clearer to contributors and packagers.

The 2-line setup.py script is intended to ease repackaging of the project. I work at an HPC site and have to convert mesh data amongst multiple formats. This package makes my life much easier, and I am grateful for all the work that has gone into it. In order to use it on some on-site projects, I need to repackage the project from source, ideally both as a wheel and as a source distribution, for security auditing and approval. Part of the rationale for source repackaging is to enable portable installation on air-gapped systems. Given the sometimes ancient software toolchains used at HPC sites, it is much easier to repackage software with setuptools than it is to use build. To wit, I spent several hours today repackaging flit_core, flit, pep517, and build to submit for approval and auditing as a fallback plan in case this pull request adding setup.py is rejected. While I wholeheartedly agree that getting rid of setup.py is a good thing, adding the two-line version is a pragmatic alternative, particularly because it is easier to get approval where I work for code incorporated into an upstream project than it is to carry around a bespoke patch.

Alternatives

  • Regarding setup.py, if the goal is to avoid adding it to the project now and in the future, a simple expedient would be to document that policy in CONTRIBUTING.md. If that is indeed project policy, I am happy to add such text to that file. I saw the discussion in Add developer install instructions #1223 and Add back setup.py for editable installations #1224 also, but I suspect other potential contributors may not see this discussion.
  • I saw a meshio-rewrite project on PyPI, but the homepage listed at https://github.com/meshpro/meshio is inaccessible, and it's not entirely clear to me what the relationship of that project is to this one. If the version of the rewrite is indeed 7.0.6, then perhaps these contributions need to be added to that repo instead, or maybe the version number used in this pull request should be different from version 7.0.1.
  • It seems that build and flit both use pyproject.toml data by default. If the goal is to move away from setuptools, it may be worth getting rid of setup.cfg altogether in favor of pyproject.toml, though it's not clear to me how the ParaView meshio plugin would be distributed using pyproject.toml, given its lack of support for data_files.

goxberry added 4 commits May 9, 2022 14:52
This commit adds a 2-line (3-line, if you count the blank line)
`setup.py` script that provides the bare minimum needed to support
packaging with `setuptools`, e.g.:

```shell
python3 setup.py sdist bdist_wheel
```

This basic `setup.py` should also support editable installations,
as requested in nschloe#1223.

The basic rationale for `setuptools` packaging is for high-performance
computing sites that lag behind in software tooling. While projects
like Spack help update this tooling to permit updating sometimes
ancient toolchains, HPC site policies -- including the HPC site I
work at -- sometimes require repackaging Python packages from source
for internal approval and security auditing, as well as for portable
installation to air-gapped machines.

While I completely agree that `setup.py` is a relic -- and to that
effect, just spent a few hours adding source code and binary wheel
installations of `flit_core`, `flit`, `pep517`, and `build` to my HPC
site for approval -- it's much, much easier to point to upstream code
than it is to have to figure out that these lines must be added for
bespoke packaging, add them, look through project documentation like
`CONTRIBUTING.md`, discover through looking at pull requests and
issues on GitHub that such a pull request may not be accepted, and
then figure out how to pass that information on to security auditors
and colleagues.

If this solution is unacceptable, I welcome other suggestions,
including writing a statement to the effect of "Pull requests adding a
`setup.py` file will not be accepted to this repository" somewhere in
documentation, along with the suggested solution of adding

```python
from setuptools import setup

setup()
```

or similar to a local copy of the repository so as to avoid the sorts
of discussions seen in nschloe#1224.
This commit synchronizes the numpy version requirement from
pyproject.toml to the setup.cfg file. I'm not sure whether this
approach is correct, but it's simple enough to do, and should yield
the same results via `setuptools` or via `pyproject.toml` approaches
such as `build` or `flit`.
This commit synchronizes the `pyproject.toml` file settings with the
amended version of `setup.cfg` that updates the `numpy` version
requirement. The rationale behind this synchronization is, again, to
make a `setuptools`-based installation reading (mostly) from
`setup.cfg` behave the same way as a `build`- or `flit`-based
installation.
This commit bumps the project version in both `pyproject.toml` and
`setup.cfg` to 7.0.1, based on the last release tag in the `meshio`
upstream Git repository at `https://github.com/nschloe/meshio/issues`.

There is also a `meshio-rewrite` project on PyPI that seems to be at
version 7.0.6, but it is unclear to me whether that version is related
to the upstream `meshio` repository above, because the linked homepage
for that PyPI entry is inaccessible.
@MuellerSeb
Copy link
Contributor

What about using setuptools_scm to automatically generate version from latest tag?

@goxberry
Copy link
Author

If maintainers want me to make those changes, I’m happy to do that. I’m also willing to drop setup.py entirely from the PR, if that’s the feedback I get. But as far as I could tell, build and flit read project metadata from pyproject.toml, so I’d like to see that file updated, particularly because the justfile in the project uses build to build the project. The version information is rather unclear to me, because as far as I could tell a few days ago, the most recent version of meshio listed on PyPI is 5.3.4, though there is also the meshio-rewrite package listed in my original post.

@goxberry
Copy link
Author

Closing due to inactivity.

@goxberry goxberry closed this Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants