Skip to content

Define metadata in setup.cfg#243

Merged
bors[bot] merged 6 commits intomasterfrom
metadata
Apr 20, 2021
Merged

Define metadata in setup.cfg#243
bors[bot] merged 6 commits intomasterfrom
metadata

Conversation

@nicoonoclaste
Copy link
Collaborator

@nicoonoclaste nicoonoclaste commented Apr 10, 2021

  • Move version number to /version file, define __version__ based on package metadata
    That file doesn't need to be included in the built package, but stays separate for Cirrus to pick up on.
  • Move author definition to setup.cfg
  • Drop setup-time dependencies
    We aren't using attr: anymore in setup.cfg, so emanate needs not be importable at setup-time.

I'm much happier with this; there's presumably a bit of import-time overhead, but
it's worth the reduction in complexity.

Pull __version__ from the package's metadata directly
We are not using `attr:` anymore, so the `emanate`
module does not need to be importable at setup time.
@nicoonoclaste
Copy link
Collaborator Author

@duckinator There might be complications when merging this, since it will match the changesInclude('version') condition in Cirrus; does the release task fail cleanly if a release with that number already exists?

@nicoonoclaste
Copy link
Collaborator Author

Oh, importlib.metadata was introduced in Python 3.8 >_>'
I added a conditional dependency on a polyfill (by the CPython maintainers, unlike the dataclasses mess)

@nicoonoclaste
Copy link
Collaborator Author

Oh FFS. Now it barfs up because of a dependency conflict with bork.

@duckinator, can we move away from specifying exact versions?

@nicoonoclaste
Copy link
Collaborator Author

nicoonoclaste commented Apr 10, 2021

@AstraLuma, I'd be interested in your opinion on this PR. 💜

import importlib_metadata as metadata # type: ignore

# Set the module-level dunders suggested in PEP8
__author__ = metadata.metadata('emanate').get('author')
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is there a way to pass metadata the current module, instead of hardcoding a name?

Choose a reason for hiding this comment

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

__name__

@nicoonoclaste
Copy link
Collaborator Author

Annoyingly, we presumably care about OpenSUSE (at least, @duckinator included it in versions.boop.ws) and even their current beta still ships Python 3.6 😭

@duckinator
Copy link
Owner

@nbraud I can't really give this a proper review because GitHub is incomprehensible on a 1366x768 display, but:

  1. the release task should fail cleanly.
  2. ok @ the importlib.metadata polyfill. this will make the zipapp Py3.8+ unless we make it unconditional, but i'm not terribly worried about that unless people actively ask for 3.7 support in the zipapp.
  3. Bork is already moving away from pinning exact versions, and I am okay with doing the same for Emanate.
  4. i don't care about OpenSUSE unless people are trying to use one of my projects on it.

@nicoonoclaste
Copy link
Collaborator Author

nicoonoclaste commented Apr 10, 2021

  1. the release task should fail cleanly.

OK, then there should be no special handling needed for this PR (moving the version file).

  1. ok @ the importlib.metadata polyfill. this will make the zipapp Py3.8+ unless we make it unconditional, but i'm not terribly worried about that unless people actively ask for 3.7 support in the zipapp.

Ayup. I'm not terribly-worried either about that polyfill.
Ideally, we could make the dependency conditional on something like python_version < '3.8' or building_as_zipapp but there seem to be no way to express that in the PEP 508 language.

  1. Bork is already moving away from pinning exact versions, and I am okay with doing the same for Emanate.

OK. Let's do another PR afterwards I opened #244 to un-pin all our dependencies.

  1. i don't care about OpenSUSE unless people are trying to use one of my projects on it.

Good to know. Given that I don't think we'd want to drop Py3.7 compatibility just yet, we need to deal with the polyfills anyway (and edge-cases like zipapps) so I guess we could keep Py3.6 compatibility so long as the dataclasses shim doesn't get in the way.

On the other hand, it's in my experience a problematic library (badly maintained, had bugs that had been fixed in the Python stdlib for years, ...) so I'd be happy not to have a dependency on it, even a conditional one.

@nicoonoclaste
Copy link
Collaborator Author

Modified to use the ~= version specifier, since that will (presumably) be what unpinned dependencies will use.

nicoonoclaste added a commit that referenced this pull request Apr 10, 2021
Pinning exact versions makes software that share dependencies
essentially-impossible to install in the same environment. See #243.

We use the “compatible version” operator, `~=`, to specify version constraints,
essentially assuming that our dependencies follow SemVer.
@duckinator
Copy link
Owner

@nbraud This looks good to me — if you're happy with it, go ahead and merge it when you're ready.

@nicoonoclaste
Copy link
Collaborator Author

bors r=duckinator

bors bot added a commit that referenced this pull request Apr 20, 2021
243: Define metadata in setup.cfg r=duckinator a=nbraud

- [x] Move version number to `/version` file, define `__version__` based on package metadata
  That file doesn't need to be included in the built package, but stays separate for Cirrus to pick up on.
- [x] Move author definition to `setup.cfg`
- [x] Drop setup-time dependencies
  We aren't using `attr:` anymore in `setup.cfg`, so `emanate` needs not be importable at setup-time.


I'm much happier with this; there's presumably a bit of import-time overhead, but
it's worth the reduction in complexity.


Co-authored-by: nicoo <nicoo@mur.at>
@nicoonoclaste
Copy link
Collaborator Author

bors abort

@bors
Copy link
Contributor

bors bot commented Apr 20, 2021

Canceled.

@nicoonoclaste
Copy link
Collaborator Author

Oops I had forgotten to push a commit >_>'

@nicoonoclaste
Copy link
Collaborator Author

bors r=duckinator

@bors
Copy link
Contributor

bors bot commented Apr 20, 2021

Build succeeded:

@bors bors bot merged commit 493ec26 into master Apr 20, 2021
@bors bors bot deleted the metadata branch April 20, 2021 23:02
nicoonoclaste added a commit that referenced this pull request Apr 20, 2021
Pinning exact versions makes software that share dependencies
essentially-impossible to install in the same environment. See #243.

We use the “compatible version” operator, `~=`, to specify version constraints,
essentially assuming that our dependencies follow SemVer.
bors bot added a commit that referenced this pull request Apr 20, 2021
244: setup.cfg: Relax version constraints on all dependencies r=duckinator a=nbraud

Pinning exact versions makes software that share dependencies essentially-impossible to install in the same environment. See #243 for an example of this kind of issue.

We use the “compatible version” operator, `~=`, to specify version constraints, essentially assuming that our dependencies follow SemVer.



Co-authored-by: nicoo <nicoo@mur.at>
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.

3 participants