Skip to content

Commit

Permalink
Migrate hatch (#13)
Browse files Browse the repository at this point in the history
* Use pyproject.toml

* dev env yml

* bump version

* placeholder test

* Init actions

* use scm versioning

* ruff format

* remove rU and remove .ix

* Add blast

* Style fixes by Ruff

---------

Co-authored-by: Adamtaranto <[email protected]>
  • Loading branch information
Adamtaranto and Adamtaranto authored Oct 28, 2024
1 parent b00ee59 commit 051c537
Show file tree
Hide file tree
Showing 23 changed files with 1,943 additions and 1,364 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish to PyPI

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- name: Check out the code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Install Hatch
run: pip install hatch

- name: Build the package with Hatch
run: hatch build

- name: Publish to PyPI
env:
HATCH_INDEX_USER: __token__
HATCH_INDEX_AUTH: ${{ secrets.TIRMITE_PYPI_TOKEN }}
run: hatch publish
35 changes: 35 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

name: Python Tests

on: [pull_request]

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] # Test with Python 3.8 to the latest available version

steps:
# Checkout the latest commit associated with the PR
- uses: actions/checkout@v4

- name: Debug matrix value
run: echo "Python version is ${{ matrix.python-version }}"

# Set up Python based on the matrix version
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

# Install dependencies, including test dependencies from pyproject.toml
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install '.[tests]' # Install all dependencies, including test-specific ones
# Run pytest on the specified directory
- name: Run tests
run: pytest tests
23 changes: 23 additions & 0 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Ruff Formatting
on: [pull_request]
jobs:
ruff:
if: ${{ github.actor != 'dependabot[bot]' }} # Do not run on commits created by dependabot
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the changed files.
contents: write # Allows reading and writing repository contents (e.g., commits)
pull-requests: write # Allows reading and writing pull requests
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
- uses: chartboost/ruff-action@v1
with:
src: './src/tirmite'
args: 'format --target-version py310'
- uses: stefanzweifel/git-auto-commit-action@v5
id: auto-commit-action
with:
commit_message: 'Style fixes by Ruff'
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Three classes of output are produced:

### Installing TIRmite

TIRmite requires Python >= v3.6
TIRmite requires Python >= v3.8

Dependencies:
- TIR-pHMM build and search
Expand Down
15 changes: 15 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: tirmite
channels:
- conda-forge
- bioconda
dependencies:
- python 3.12
- "pymummer>=0.10.3"
- hmmer
- blast
- pip
- pip:
- "biopython>=1.70"
- "pandas>=0.20.3"
- hatch
- pytest
56 changes: 56 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "tirmite"
description = "Map TIR-pHMM models to genomic sequences for annotation of MITES and complete DNA-Transposons."
readme = "README.md"
requires-python = ">=3.8"
license = { text = "MIT" }
authors = [
{ name = "Adam Taranto", email = "[email protected]" }
]

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

dependencies = ["pandas>=0.20.3", 'biopython>=1.70', "pymummer>=0.10.3",]

dynamic = ["version"]

[project.urls]
homepage = "https://github.com/adamtaranto/TIRmite"
documentation = "https://github.com/adamtaranto/TIRmite"
repository = "https://github.com/adamtaranto/TIRmite"

[project.scripts]
tirmite="tirmite.cmd_tirmite:main"
tsplit-LTR="tirmite.cmd_LTR:main"
tsplit-TIR="tirmite.cmd_TIR:main"

[tool.hatch.build]
source = "src"

exclude = [
"environment.yml",
".github",
".vscode",
]

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

[tool.hatch.version.vcs]
tag-pattern = "v*" # Git tags starting with 'v' will be used for versioning
fallback-version = "0.0.0"

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

[project.optional-dependencies]
tests = ["pytest"]
5 changes: 0 additions & 5 deletions setup.cfg

This file was deleted.

51 changes: 0 additions & 51 deletions setup.py

This file was deleted.

Loading

0 comments on commit 051c537

Please sign in to comment.