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

Remove build hacks #1001

Merged
merged 7 commits into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,8 @@ jobs:
python -m build --sdist --wheel .
twine check dist/*
displayName: "Build & Twine check"

- script: |
pip install dist/*.whl
python -c 'import anndata; print(anndata.__version__)'
displayName: "Check runtime version"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ __pycache__/
# Distribution / packaging
/build/
/dist/
/anndata/_version.py
/*.egg-info/
/requirements*.lock
/.python-version
Expand Down
58 changes: 33 additions & 25 deletions anndata/__init__.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
"""Annotated multivariate observation data."""

from ._metadata import __version__, within_flit
try: # See https://github.com/maresb/hatch-vcs-footgun-example
from setuptools_scm import get_version

if not within_flit():
del within_flit
from ._core.anndata import AnnData
from ._core.merge import concat
from ._core.raw import Raw
from ._io import (
read_h5ad,
read_loom,
read_hdf,
read_excel,
read_umi_tools,
read_csv,
read_text,
read_mtx,
read_zarr,
)
from ._warnings import (
OldFormatWarning,
WriteWarning,
ImplicitModificationWarning,
ExperimentalFeatureWarning,
)
__version__ = get_version(root="..", relative_to=__file__)
except (ImportError, LookupError):
try:
from ._version import __version__
except ModuleNotFoundError:
raise RuntimeError(
"anndata is not correctly installed. Please install it, e.g. with pip."
)

# backwards compat / shortcut for default format
from ._io import read_h5ad as read
from ._core.anndata import AnnData
from ._core.merge import concat
from ._core.raw import Raw
from ._io import (
read_h5ad,
read_loom,
read_hdf,
read_excel,
read_umi_tools,
read_csv,
read_text,
read_mtx,
read_zarr,
)
from ._warnings import (
OldFormatWarning,
WriteWarning,
ImplicitModificationWarning,
ExperimentalFeatureWarning,
)

# backwards compat / shortcut for default format
from ._io import read_h5ad as read
46 changes: 0 additions & 46 deletions anndata/_metadata.py

This file was deleted.

2 changes: 0 additions & 2 deletions benchmarks/asv.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@
"pandas": [""],
"memory_profiler": [""],
"zarr": [""],
"setuptools_scm": [""],
"flit": [""],
"pytoml": [""],
"pytest": [""],
"pooch": [""],
Expand Down
27 changes: 14 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
[build-system]
build-backend = "flit_core.buildapi"
requires = [
"flit_core >=3.4,<4",
"setuptools_scm",
]
build-backend = "hatchling.build"
requires = ["hatchling", "hatch-vcs"]

[project]
name = "anndata"
description = "Annotated data."
requires-python = ">=3.8"
license = {file = "LICENSE"}
license = "BSD-3-Clause"
authors = [
{name = "Philipp Angerer"},
{name = "Alex Wolf"},
Expand All @@ -18,12 +15,11 @@ authors = [
]
maintainers = [
{name = "Isaac Virshup", email = "ivirshup@gmail.com"},
{name = "Philipp Angerer", email = "philipp.angerer@helmholtz-muenchen.de"},
{name = "Philipp Angerer", email = "philipp.angerer@helmholtz-munich.de"},
{name = "Alex Wolf", email = "f.alex.wolf@gmx.de"},
]
readme = {file = "README.md", content-type="text/markdown"}
readme = "README.md"
Copy link
Member

Choose a reason for hiding this comment

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

I recall this throwing errors if I didn't specify the content-type. Was that flit specific?

Copy link
Member Author

Choose a reason for hiding this comment

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

not for many years: pypa/flit#169

Copy link
Member

Choose a reason for hiding this comment

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

Pretty sure I was running into this more recently than that. But I believe twine check was the one complaining, so it's fine as long as the build check is passing.

classifiers = [
"License :: OSI Approved :: BSD License",
"Environment :: Console",
"Framework :: Jupyter",
"Intended Audience :: Developers",
Expand All @@ -36,11 +32,12 @@ classifiers = [
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Scientific/Engineering :: Visualization",
]
dependencies = [
"pandas>=1.1.1,!=2.0.1", # pandas <1.1.1 has pandas/issues/35446
"pandas>=1.1.1", # pandas <1.1.1 has pandas/issues/35446
"numpy>=1.16.5", # required by pandas 1.x
"scipy>1.4",
"h5py>=3",
Expand Down Expand Up @@ -92,11 +89,15 @@ test = [
"pytest_memray",
]

[tool.flit.sdist]
[tool.hatch.build]
exclude = [
'anndata/tests/test_*.py',
'anndata/tests/data',
"anndata/tests/test_*.py",
"anndata/tests/data",
]
[tool.hatch.version]
source = "vcs"
[tool.hatch.build.hooks.vcs]
version-file = "anndata/_version.py"
flying-sheep marked this conversation as resolved.
Show resolved Hide resolved

[tool.coverage.run]
source = ["anndata"]
Expand Down