napari / napari-console

A plugin that adds a console to napari
BSD 3-Clause "New" or "Revised" License
3 stars 12 forks source link

Migrate to declarative setup. #20

Closed Carreau closed 2 years ago

Carreau commented 2 years ago

Mostly best practices, also use python -m build to build the sdist/wheel in an isolated environment

codecov[bot] commented 2 years ago

Codecov Report

Merging #20 (ad0fdeb) into main (91c55d8) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##             main      #20   +/-   ##
=======================================
  Coverage   83.76%   83.76%           
=======================================
  Files           4        4           
  Lines         117      117           
=======================================
  Hits           98       98           
  Misses         19       19           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Czaki commented 2 years ago

why not move everything to pyproject.toml?

Carreau commented 2 years ago

why not move everything to pyproject.toml?

If we can move to pyproject.toml why not. I just didn't found all corresponding options in pyproject.toml, inparticular:

[metadata]
url = https://github.com/napari/napari-console
license = BSD 3-Clause

long_description = file: README.md
long_description_content_type = text/markdown

[options]
zip_safe = False
packages = find:
python_requires = >=3.7
include_package_data = True

[options.package_data]
* = *.pyi
napari_builtins =
    builtins.yaml

Is what I am left with once I updated pyproject.toml:

[build-system]
requires = [
  "setuptools >= 42",
  "wheel",
  "setuptools_scm>=3.4"
]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "napari_console/_version.py"

[project]
name = "napari-console"
description = "A plugin that adds a console to napari"
readme = "README.md"
requires-python = ">=3.7"
license = {file = "LICENSE"}
authors = [
  {email = "sofroniewn@gmail.com", name="Nicholas Sofroniew"},
]
classifiers = [
    "Development Status :: 4 - Beta",
    "Intended Audience :: Developers",
    "Framework :: napari",
    "Topic :: Software Development :: Testing",
    "Programming Language :: Python",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3.7",
    "Programming Language :: Python :: 3.8",
    "Programming Language :: Python :: 3.9",
    "Programming Language :: Python :: 3.10",
    "Operating System :: OS Independent",
    "License :: OSI Approved :: BSD License"
]

dependencies = [
    "ipykernel>=5.2.0",
    "IPython>=7.7.0",
    "napari-plugin-engine>=0.1.9",
    "qtconsole>=4.5.1,!=4.7.6",
    "qtpy>=1.7.0",
]

[project.entry-points."napari.plugin"]
console = "napari_console"

I also can't build anymore because of setuptools_scm,

ValueError: invalid pyproject.toml config: `project`.
configuration error: `project` must contain ['version'] properties

But if you know how to do those things, I'm happy to get guidance and do the same migration on napari side.

Czaki commented 2 years ago

pyproject.toml allows to set fields as dynamic: https://github.com/Czaki/nme/blob/2fbc1dabf2d91ada3fee272994bb0dd2e41a662d/pyproject.toml#L29

long_description is readme https://github.com/Czaki/nme/blob/2fbc1dabf2d91ada3fee272994bb0dd2e41a662d/pyproject.toml#L4 https://peps.python.org/pep-0621/#readme

other things that look like they should be stored in [tool.setuptools] but it is marked as beta, so, after reading this, I'm not sure if total migration to pyroject.toml. is a good idea.

https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html#setuptools-specific-configuration

alisterburt commented 2 years ago

let's merge what we have here and iterate? I'll then push a tag to build v0.0.5

alisterburt commented 2 years ago

tag pushed to deploy 0.0.5 https://github.com/napari/napari-console/actions/runs/2999115117