Skip to content

Commit

Permalink
histoqc.ui: need to provide package_data via setup.py
Browse files Browse the repository at this point in the history
It would be possible to switch to setup.cfg declarative config style,
if we'd specify the files individually, or add subfolder matching via
multiple single star globs, i.e.:
    *.css,
    */*.css,
    */*/*.css,
but unless all files are specified or
pypa/setuptools#1806 is implemented it
would probably cause confusion for a histoqc developer when they're
modifying the ui.
  • Loading branch information
ap-- committed Mar 28, 2021
1 parent a811eb9 commit 60b6439
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ recursive-exclude . *secrets*

# ini config files
include histoqc/config/*.ini
# include user interface
graft histoqc/ui/UserInterface
31 changes: 16 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
# This setup.py file is just needed to support editable installs via
# `pip install -e .` and `python setup.py develop`
#
# NOTE:
# If you want an editable install `python setup.py develop` should
# not be used and you should always use `pip install -e .`
# But, it's almost guaranteed that some user will install via
# the former, and so let's make setuptools_scm work correctly
# in that case.
#
import glob
import os.path
from setuptools import setup

# glob patterns in setup.cfg dont support recursive patterns
# https://github.com/pypa/setuptools/issues/1806
# so we have to do it in setup.py
ui_files = [
os.path.relpath(f, "histoqc/ui/")
for f in glob.iglob("histoqc/ui/UserInterface/**/*", recursive=True)
if os.path.isfile(f)
]

setup(
# providing the settings is required for `python setup.py develop`
# to work correctly with setuptools_scm
# > set to `True` if we only allow `pip install -e .`
# ^^^ `True` requires a pyproject.toml with the below config!
use_scm_version={
# duplicated config from pyproject.toml; keep in sync
"write_to": "histoqc/_version.py",
"version_scheme": "post-release",
},
setup_requires=['setuptools_scm']
setup_requires=['setuptools_scm'],
package_data={
'histoqc.ui': ui_files
}
)

0 comments on commit 60b6439

Please sign in to comment.