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

Skip to content

Migrate local test runner to tox 4 #157

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

Closed
masklinn opened this issue Apr 27, 2023 · 1 comment
Closed

Migrate local test runner to tox 4 #157

masklinn opened this issue Apr 27, 2023 · 1 comment

Comments

@masklinn
Copy link
Contributor

it's getting 6 months old so odds are it's gotten in a pretty good shape (plus pycon 2023 sprints), and using tox 3 requires manual pip install as its supports for sdist and develop aren't really compatible with PEP 517 packaging (?).

masklinn added a commit to masklinn/uap-python that referenced this issue Apr 27, 2023
PEP 517
=======

Don't migrate away from setuptools, but move "static" packaging
content from `setup.py` to `pyproject.toml` and `setup.cfg`. Building
should now be performed using
[`build`](https://pypa-build.readthedocs.io/en/stable/), as direct
invocations of `setup.py` have been deprecated for a while.

Also remove the legacy `__author__` strictures from the source files,
as `pyproject.toml` supports an authors section which is more suitable.

Codegen Modernization
=====================

The modernization via command overrides and self-invocation still
generated `setup.py` warnings.

Migrate the "invoke commands in commands" method to codegen
sub-commands in `build`, it looks like this suffices for what we
need. This reuses the existing code, though modernizes it
significantly thanks to the previous commit.

This is strongly inspired by @abravalheri's comments on codegen in
setuptools discussions e.g. pypa/setuptools#3180 and
pypa/setuptools#3762, those comments were very helpful in getting a
better understanding of the sub_commands system (also @jaraco's
comments but those were a touch terse so can't say I really got it
until sumbling on @abravalheri's).

Leverages the setuptools subcommands protocol to support editable
wheels, as that might be useful. Don't use editable wheels for testing
though, as I don't see the point.

Note: not sure the git submodule stuff is useful during the codegen,
so currently commented it out.

sdists
======

I'm not entirely clear what sdists should really be about, adding
codegen to sdist using subcommands seems not necessarily trivial, so
for now make them basically an export:

- remove `_regexes.py` from sdist
- add uap-core to the manifest, and thus the sdist, at least
  `regexes.yaml`

Currently the test files (both python and yaml) are also included, but
it's not clear that they *should* be. That seems like [a whole
debate](https://discuss.python.org/t/should-sdists-include-docs-and-tests/14578/117),

One strong argument (to me) in favor of a sdist maximalism is that it
matches the wheels and more official releases, but in that case the
sdist should probably be better crafted than what I threw together.

Tox
===

Switch tox to an explicit `pip install` as its builtin handling for
installing packages (whether via sdist or develop) does not seem
compatible with PEP-517. Need to think about moving to tox 4, which
apparently has native support for PEP 517 packages. Cf ua-parser#157.

Also remove the `docs` tox env, it hasn't been a thing since
8273477 but I forgot to remove it
from the envlist.
masklinn added a commit that referenced this issue Apr 30, 2023
PEP 517
=======

Don't migrate away from setuptools, but move "static" packaging
content from `setup.py` to `pyproject.toml` and `setup.cfg`. Building
should now be performed using
[`build`](https://pypa-build.readthedocs.io/en/stable/), as direct
invocations of `setup.py` have been deprecated for a while.

Also remove the legacy `__author__` strictures from the source files,
as `pyproject.toml` supports an authors section which is more suitable.

Codegen Modernization
=====================

The modernization via command overrides and self-invocation still
generated `setup.py` warnings.

Migrate the "invoke commands in commands" method to codegen
sub-commands in `build`, it looks like this suffices for what we
need. This reuses the existing code, though modernizes it
significantly thanks to the previous commit.

This is strongly inspired by @abravalheri's comments on codegen in
setuptools discussions e.g. pypa/setuptools#3180 and
pypa/setuptools#3762, those comments were very helpful in getting a
better understanding of the sub_commands system (also @jaraco's
comments but those were a touch terse so can't say I really got it
until sumbling on @abravalheri's).

Leverages the setuptools subcommands protocol to support editable
wheels, as that might be useful. Don't use editable wheels for testing
though, as I don't see the point.

Note: not sure the git submodule stuff is useful during the codegen,
so currently commented it out.

sdists
======

I'm not entirely clear what sdists should really be about, adding
codegen to sdist using subcommands seems not necessarily trivial, so
for now make them basically an export:

- remove `_regexes.py` from sdist
- add uap-core to the manifest, and thus the sdist, at least
  `regexes.yaml`

Currently the test files (both python and yaml) are also included, but
it's not clear that they *should* be. That seems like [a whole
debate](https://discuss.python.org/t/should-sdists-include-docs-and-tests/14578/117),

One strong argument (to me) in favor of a sdist maximalism is that it
matches the wheels and more official releases, but in that case the
sdist should probably be better crafted than what I threw together.

Tox
===

Switch tox to an explicit `pip install` as its builtin handling for
installing packages (whether via sdist or develop) does not seem
compatible with PEP-517. Need to think about moving to tox 4, which
apparently has native support for PEP 517 packages. Cf #157.

Also remove the `docs` tox env, it hasn't been a thing since
8273477 but I forgot to remove it
from the envlist.
@masklinn
Copy link
Contributor Author

masklinn commented May 2, 2023

Fixed in 81da21a

@masklinn masklinn closed this as completed May 2, 2023
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

No branches or pull requests

1 participant