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

Fix dists linux #737

Merged
merged 6 commits into from
Jan 5, 2025
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ computation related to assembly, annotation, and comparative genomics.
| ------- | ---------------------------------------------------------------- |
| Authors | Haibao Tang ([tanghaibao](http://github.com/tanghaibao)) |
| | Vivek Krishnakumar ([vivekkrish](https://github.com/vivekkrish)) |
| | Adam Taranto ([Adamtaranto](https://github.com/Adamtaranto)) |
tanghaibao marked this conversation as resolved.
Show resolved Hide resolved
| | Xingtan Zhang ([tangerzhang](https://github.com/tangerzhang)) |
| | Won Cheol Yim ([wyim-pgl](https://github.com/wyim-pgl)) |
| Email | <tanghaibao@gmail.com> |
Expand Down Expand Up @@ -106,7 +107,7 @@ full-fledged applications.

JCVI requires Python3 between v3.8 and v3.12.

Some graphics modules require the [ImageMagick](https://imagemagick.org/index.php) library.
Some graphics modules require the [ImageMagick](https://imagemagick.org/index.php) library.

On MacOS this can be installed using Conda (see next section). If you are using a linux system (i.e. Ubuntu) you can install ImageMagick using apt-get:

Expand All @@ -115,8 +116,10 @@ sudo apt-get update
sudo apt-get install libmagickwand-dev
```

See the [Wand](https://docs.wand-py.org/en/0.2.4/guide/install.html) docs for instructions on installing ImageMagick on other systems.

A few modules may ask for locations of external programs,
if the executable cannot be found in your `PATH`.
if the executable cannot be found in your `PATH`.

The external programs that are often used are:

Expand All @@ -130,14 +133,13 @@ You can use the the YAML files in this repo to create an environment with basic

If you are new to Conda, we recommend the [Miniforge](https://conda-forge.org/download/) distribution.


```bash
conda env create -f environment.yml

conda activate jcvi
```

Note: If you are using a Mac with an ARM64 (Apple Silicon) processor, some dependencies are not currently available from Bioconda for this architecture.
Note: If you are using a Mac with an ARM64 (Apple Silicon) processor, some dependencies are not currently available from Bioconda for this architecture.

You can instead create a virtual OSX64 (intel) env like this:

Expand Down Expand Up @@ -180,7 +182,7 @@ If installed successfully, you can check the version with:
jcvi --version
```

## Usage
## Usage

Use `python -m` to call any of the modules installed with JCVI.

Expand Down
16 changes: 16 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
import subprocess

from hatchling.builders.hooks.plugin.interface import BuildHookInterface
from setuptools.command.bdist_wheel import get_abi_tag, get_platform, tags


class CustomBuildHook(BuildHookInterface):
def initialize(self, version, build_data):
# Set the custom wheel tag
build_data["tag"] = self._get_wheel_tag()
tanghaibao marked this conversation as resolved.
Show resolved Hide resolved
print(f"Using custom wheel tag: {build_data['tag']}")
# Run setup.py build_ext before main build
subprocess.check_call(["python", "setup.py", "build_ext", "--inplace"])
return super().initialize(version, build_data)

def _get_wheel_tag(self):
# Without the tag, the wheel will be named jcvi-0.0.0-py3-none-any.whl
impl_name = tags.interpreter_name()
impl_ver = tags.interpreter_version()
abi_tag = get_abi_tag()
plat_tag = get_platform(None)
plat_tag = ( # macosx_11.0 => macosx_11_0
plat_tag.lower().replace("-", "_").replace(".", "_").replace(" ", "_")
)
return f"{impl_name}{impl_ver}-{abi_tag}-{plat_tag}"
47 changes: 19 additions & 28 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
requires = [
"hatchling", # Build backend
"hatch-vcs", # Version control system plugin for dynamic versioning
"setuptools", # Setuptools for compiling C extensions
"cython", # Cython for compiling C extensions
"setuptools", # Setuptools for compiling C extensions
"wheel", # Wheel for packaging
"cython", # Cython for compiling C extensions
"numpy", # NumPy for numerical operations and C extension includes
]
build-backend = "hatchling.build"
Expand All @@ -16,19 +17,19 @@ name = "jcvi"
description = "Python utility libraries on genome assembly, annotation and comparative genomics"
readme = "README.md"
requires-python = ">=3.8"
license = {text = "BSD"}
license = { text = "BSD" }
authors = [
{name = "Haibao Tang", email = "tanghaibao@gmail.com"},
{name = "Vivek Krishnakumar"},
{name = "Jingping Li"}
{ name = "Haibao Tang", email = "tanghaibao@gmail.com" },
{ name = "Vivek Krishnakumar" },
{ name = "Adam Taranto" },
]

classifiers = [
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering :: Bio-Informatics"
"Topic :: Scientific/Engineering :: Bio-Informatics",
]

dependencies = [
Expand Down Expand Up @@ -60,19 +61,13 @@ dependencies = [
"scipy",
"seaborn",
"Wand",
"webcolors"
"webcolors",
]

dynamic = ["version"]

[project.optional-dependencies]
tests = [
"mock",
"pytest-benchmark",
"pytest-cov",
"pytest",
"PyYAML",
]
tests = ["mock", "pytest-benchmark", "pytest-cov", "pytest", "PyYAML"]

[project.urls]
homepage = "http://github.com/tanghaibao/jcvi"
Expand All @@ -86,11 +81,6 @@ allow-direct-references = true

[tool.hatch.build]
packages = ["src"]
artifacts = [
"src/jcvi/**/*.so", # Linux/Mac shared objects
"src/jcvi/**/*.pyd", # Windows shared objects
"src/jcvi/**/*.c" # Generated C files
]

[tool.hatch.build.hooks.custom]
path = "build.py"
Expand All @@ -106,13 +96,14 @@ tag-pattern = "v*"
fallback-version = "0.0.0"

[tool.hatch.build.targets.sdist]
include = [
"src/**/*.py",
"src/**/*.pyx",
"README.md",
]

force-include = { "build.py" = "build.py", "setup.py" = "setup.py"}
include = ["src/**/*.py", "src/**/*.pyx", "README.md"]
force-include = { "build.py" = "build.py", "setup.py" = "setup.py" }
exclude = ["src/jcvi/**/*.so", "src/jcvi/**/*.pyd", "src/jcvi/**/*.c"]

[tool.hatch.build.targets.wheel]
packages = ["src/jcvi"]
packages = ["src/jcvi"]
artifacts = [
"src/jcvi/**/*.so", # Linux/Mac shared objects
"src/jcvi/**/*.pyd", # Windows shared objects
"src/jcvi/**/*.c", # Generated C files
]
1 change: 1 addition & 0 deletions src/jcvi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
__author__ = (
"Haibao Tang",
"Vivek Krishnakumar",
"Adam Taranto",
"Xingtan Zhang",
"Won Cheol Yim",
)
Expand Down
Loading