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

WIP: Update_packaging #732

Merged
merged 48 commits into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
8e4c872
Do not try to set usetex=False or resave
Adamtaranto Feb 19, 2023
8029175
Replace check_call with check_out in sh()
Adamtaranto Feb 19, 2023
a5225ec
Collect stderr msgs from lastal for use in
Adamtaranto Feb 19, 2023
3f7ad6d
Log suggestion to use --notex if savefig fails
Adamtaranto Feb 19, 2023
00ff793
Add cleanup empty pdf before exit if savefig fails
Adamtaranto Feb 20, 2023
6b986bb
Merge branch 'main' of https://github.com/tanghaibao/jcvi
Adamtaranto Feb 20, 2023
e378e6f
Add logging to clarify why latex is
Adamtaranto Feb 21, 2023
2daf3dc
Merge branch 'main' of https://github.com/tanghaibao/jcvi
Adamtaranto Feb 23, 2023
ae7c0ef
Merge remote-tracking branch 'upstream/main'
Adamtaranto Nov 14, 2024
c70602a
Merge branch 'tanghaibao:main' into main
Adamtaranto Dec 25, 2024
afb75ef
ignore version and cython files
Adamtaranto Nov 14, 2024
4029d67
mv exclude to pyproject
Adamtaranto Nov 14, 2024
6a5359e
use hatch for build
Adamtaranto Nov 14, 2024
eff4eb6
use hatch-vcs version
Adamtaranto Nov 15, 2024
b77c309
log error when no cblast
Adamtaranto Nov 15, 2024
39b70d7
mv pkg into src
Adamtaranto Nov 15, 2024
60ec604
ignore version
Adamtaranto Nov 15, 2024
98752a8
init env yml
Adamtaranto Nov 15, 2024
011d467
rm version, switch to dynamic vcs version
Adamtaranto Dec 25, 2024
ed97aa1
WIP: migrating to hatch
Adamtaranto Dec 25, 2024
2678970
rm cblast.c from tracking
Adamtaranto Jan 3, 2025
b203b88
ignore dev files
Adamtaranto Jan 3, 2025
e5be700
Use setuptools for cython modules
Adamtaranto Jan 3, 2025
a640776
automate run setup.py for cython build
Adamtaranto Jan 3, 2025
e6a722b
setup_magick_home() assumes ImageMagick always installed with homebre…
Adamtaranto Jan 3, 2025
c6d1140
install non-pip deps using conda. Install libmagic without homebrew.
Adamtaranto Jan 3, 2025
66583b8
fix bug - incorrect selection of wget on MocOS without wget
Adamtaranto Jan 3, 2025
f11b1a0
version to _version
Adamtaranto Jan 3, 2025
81ab0b1
bump min Python version.
Adamtaranto Jan 3, 2025
34a5eb9
conda env instructions
Adamtaranto Jan 3, 2025
63310a7
Do not try to set usetex=False or resave
Adamtaranto Feb 19, 2023
5535264
Replace check_call with check_out in sh()
Adamtaranto Feb 19, 2023
95fe1c0
Move files back to jcvi/
Adamtaranto Jan 4, 2025
daf10f3
Move jcvi to src/ directory with git mv
Adamtaranto Jan 4, 2025
6468428
Merge branch 'main' into update_packaging
Adamtaranto Jan 4, 2025
a4c347f
optparse not used
Adamtaranto Jan 4, 2025
067553f
use logger instead of logging
Adamtaranto Jan 4, 2025
e92fa50
fix conda env to py 3.12
Adamtaranto Jan 4, 2025
c17ed8e
init pytest action
Adamtaranto Jan 4, 2025
b259642
black fmt
Adamtaranto Jan 4, 2025
0fe1336
use miniforge
Adamtaranto Jan 4, 2025
c224ef4
switch run order
Adamtaranto Jan 4, 2025
b7c6810
handle testing in build action
Adamtaranto Jan 4, 2025
7b3b890
black fmt
Adamtaranto Jan 4, 2025
a8927ec
Add cython to deps
Adamtaranto Jan 4, 2025
429ee45
typo
Adamtaranto Jan 4, 2025
bba6f13
Add cli entrypoint to check version
Adamtaranto Jan 4, 2025
b72b2c5
update readme
Adamtaranto Jan 4, 2025
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
5 changes: 2 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
max-parallel: 4
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.8", "3.10"]
python-version: ["3.8", "3.10", "3.12"]

steps:
- uses: actions/checkout@v4
Expand All @@ -31,9 +31,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -e '.[tests]'

- name: Test with pytest
run: |
pip install PyYAML pytest pytest-cov pytest-benchmark mock
pytest --cov=jcvi tests
21 changes: 20 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# Created by http://www.gitignore.io
# Mac stuff
.DS_Store

# Development
dev/

# Versioning
src/jcvi/_version.py

# Ignore Cython generated C files
src/jcvi/assembly/chic.c
src/jcvi/formats/cblast.c

# Dev testing
dev
Expand All @@ -7,6 +18,7 @@ dev
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so
Expand All @@ -17,12 +29,15 @@ env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
Expand All @@ -35,9 +50,12 @@ pip-delete-this-directory.txt
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/

# Translations
*.mo
Expand All @@ -51,3 +69,4 @@ docs/_build/

# gffutils temp DB file
*.db
src/jcvi/version.py
4 changes: 0 additions & 4 deletions MANIFEST.in

This file was deleted.

80 changes: 54 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,49 +104,77 @@ full-fledged applications.

## Dependencies

Following are a list of third-party python packages that are used by
some routines in the library. These dependencies are _not_ mandatory
since they are only used by a few modules.
JCVI requires Python3 between v3.8 and v3.12.

- [Biopython](http://www.biopython.org)
- [numpy](http://numpy.scipy.org)
- [matplotlib](http://matplotlib.org/)
A few modules may ask for locations of external programs,
if the executable cannot be found in your `PATH`.

There are other Python modules here and there in various scripts. The
best way is to install them via `pip install` when you see
`ImportError`.
The external programs that are often used are:

- [Kent tools](http://hgdownload.cse.ucsc.edu/admin/jksrc.zip)
- [BEDTOOLS](http://code.google.com/p/bedtools/)
- [EMBOSS](http://emboss.sourceforge.net/)

## Installation

The easiest way is to install it via PyPI:
**Installing JCVI in a Conda environment:**

```console
pip install jcvi
You can create a Conda environment with Python 3.12 and basic dependencies for JCVI using the YAML files in this repo.

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
```

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

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

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

conda activate jcvi-osx64
```

After activating the Conda environment install JCVI using one of the following options.


**Installation options:**

1) Use pip to install the latest development version directly from this repo.

```bash
pip install git+git://github.com/tanghaibao/jcvi.git
```

Alternatively, if you want to install manually:
2) Install latest release from PyPi.

```console
cd ~/code # or any directory of your choice
git clone git://github.com/tanghaibao/jcvi.git
pip install -e .
```bash
pip install jcvi
```

In addition, a few module might ask for locations of external programs,
if the extended cannot be found in your `PATH`. The external programs
that are often used are:
3) Alternatively, if you want to install in development mode.

- [Kent tools](http://hgdownload.cse.ucsc.edu/admin/jksrc.zip)
- [BEDTOOLS](http://code.google.com/p/bedtools/)
- [EMBOSS](http://emboss.sourceforge.net/)
```bash
git clone git://github.com/tanghaibao/jcvi.git && cd jcvi
pip install -e '.[tests]'
```

**Test Installation:**

If installed successfully, you can check the version with:

```bash
jcvi --version
```

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

Most of the scripts in this package contains multiple actions. To use
Most of the modules in this package contains multiple actions. To use
the `fasta` example:

```console
Expand Down
9 changes: 9 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import subprocess
from hatchling.builders.hooks.plugin.interface import BuildHookInterface


class CustomBuildHook(BuildHookInterface):
def initialize(self, version, build_data):
# Run setup.py build_ext before main build
subprocess.check_call(["python", "setup.py", "build_ext", "--inplace"])
return super().initialize(version, build_data)
14 changes: 14 additions & 0 deletions env_osx64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: jcvi-osx64
channels:
- conda-forge/osx-64
- bioconda/osx-64
dependencies:
- python 3.12
- bedtools
- imagemagick
- libmagic # System-level magic library
- wand # Python bindings for ImageMagick
- pip
- pip:
- hatch
- pytest
14 changes: 14 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: jcvi
channels:
- conda-forge
- bioconda
dependencies:
- python 3.12
- bedtools
- imagemagick
- libmagic # System-level magic library
- wand # Python bindings for ImageMagick
- pip
- pip:
- pytest
- hatch
28 changes: 0 additions & 28 deletions jcvi/__init__.py

This file was deleted.

121 changes: 108 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,110 @@
# Specifies the build system requirements and backend
[build-system]
requires = [
"Cython",
"numpy",
"setuptools",
"setuptools_scm[toml]",
"setuptools_scm_git_archive",
"wheel",
]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "jcvi/version.py"
git_describe_command = "git describe --dirty --tags --long --match v* --first-parent"
version_scheme = "no-guess-dev"
"hatchling", # Build backend
"hatch-vcs", # Version control system plugin for dynamic versioning
"setuptools", # Setuptools for compiling C extensions
"cython", # Cython for compiling C extensions
"numpy", # NumPy for numerical operations and C extension includes
]
build-backend = "hatchling.build"

[tool.hatch.build.hooks.custom]
path = "build.py"

# Project metadata and configuration
[project]
name = "jcvi"
description = "Python utility libraries on genome assembly, annotation and comparative genomics"
readme = "README.md"
requires-python = ">=3.8"
license = {text = "BSD"}
authors = [
{name = "Haibao Tang", email = "[email protected]"},
{name = "Vivek Krishnakumar"},
{name = "Jingping Li"}
]

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

dependencies = [
"biopython",
"boto3",
"brewer2mpl",
"CrossMap",
"cython",
"deap",
"ete3",
"ftpretty",
"genomepy",
"gffutils",
"goatools",
"graphviz",
"jinja2",
"matplotlib",
"more-itertools",
"natsort",
"networkx",
"numpy<2",
"ortools",
"pybedtools",
"pyefd",
"pypdf",
"pytesseract",
"rich",
"scikit-image",
"scipy",
"seaborn",
"Wand",
"webcolors"
]

dynamic = ["version"]

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

[project.urls]
homepage = "http://github.com/tanghaibao/jcvi"

# Command-line script entry point
[project.scripts]
jcvi = "jcvi.cli:main"

[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.build]
packages = ["src/jcvi"]

[tool.hatch.version]
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "src/jcvi/_version.py"

[tool.hatch.version.vcs]
tag-pattern = "v*"
fallback-version = "0.0.0"

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

[tool.hatch.build.targets.wheel]
packages = ["src/jcvi"]
Loading
Loading