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

build: use pyproject.toml to declare configs #112

Merged
merged 13 commits into from
Mar 4, 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
61 changes: 61 additions & 0 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: checks
on: [push, pull_request]
jobs:
test:
name: test build py${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4

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

- name: Install dependencies
run: |
python3 -m pip install ".[tests]"

# TODO -- build CI-ready unit tests
Copy link
Collaborator

Choose a reason for hiding this comment

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

preempted my thoughts here: would it be an easy win to add the current unit tests (pytest tests/unit) to the CI in this PR? Or were you considering it out of scope for the current PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't think too hard about how nontrivial it would be to get these working, but I think there's still some configuration that would have to happen for the CI instance to be able to run them. Here's an example run trying every test: https://github.com/gks-anvil/vrs_anvil_toolkit/actions/runs/13637983594/job/38121227703

Copy link
Collaborator

@quinnwai quinnwai Mar 3, 2025

Choose a reason for hiding this comment

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

okay fair enough, we can make it out of scope then. I think the main problem is the supposed "unit tests" we created are pointing to an already downloaded seqrepo dir when testing occurs. Not sure how you do it in vrs-python but would be inclined to do it that same way.

Copy link
Contributor Author

@jsstevenson jsstevenson Mar 3, 2025

Choose a reason for hiding this comment

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

Ah yeah. For SeqRepo, we use the REST dataproxy in tests and then use something like pytest vcr to capture + stash the HTTP requests so that they can be used during CI/CD. It's a little painful but it works. I can make another issue to work that out.


lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
run: python3 -m pip install ".[dev]"

- name: Check style
run: python3 -m flake8 src tests

precommit_hooks:
runs-on: ubuntu-latest
strategy:
matrix:
cmd:
- "check-ast"
- "debug-statements"
- "end-of-file-fixer"
- "trailing-whitespace"
- "mixed-line-ending"
steps:
- uses: actions/checkout@v4

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

- uses: pre-commit/action@v3.0.1
with:
extra_args: ${{ matrix.cmd }} --all-files
50 changes: 50 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
name: Publish Python distribution to PyPI

on:
release:
types: [created]

jobs:
build:
name: Build distribution
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
publish-to-pypi:
name: >-
Publish Python distribution to PyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/vrs_anvil_toolkit
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: debug-statements #Check for debugger imports and breakpoint() in python files
- id: check-ast #Simply check whether files parse as valid python
Expand All @@ -16,7 +16,7 @@ repos:
- id: end-of-file-fixer #Makes sure files end in a newline and only a newline
- id: trailing-whitespace
- id: mixed-line-ending

args: [ --fix=lf ]
- repo: local
hooks:
- id: run_tests
Expand All @@ -33,3 +33,4 @@ repos:
# language: system
# types: [python]
# exclude: ^venv/ ^.git/ ^.vscode/ ^.DS_Store
minimum_pre_commit_version: 4.0.1
79 changes: 79 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
[project]
name = "vrs_anvil_toolkit"
authors = [
{"name" = "GKS-AnVIL"}
]
readme = "README.md"
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
requires-python = ">=3.10"
description = "Useful tools and methods for applying GA4GH GKS and VRS models on the NHGRI AnVIL platform."
license = {file = "LICENSE.md"}
dependencies = [
"ga4gh.vrs[extras]==2.0.0a13",
"diskcache",
"biocommons.seqrepo",
"glom",
"click",
"pyyaml",
"google",
"requests",
"boto3",
"tqdm",
"google-cloud-storage",
"psutil",
# for CAF generation:
"firecloud",
"ga4gh.va_spec~=0.2.0a0",
"pandas",
"vrsix==0.1.1",
]
dynamic = ["version"]

[project.optional-dependencies]
tests = [
"pytest",
]
dev = [
"flake8",
"black",
"pre-commit>=4.0.1",
]

[project.urls]
Homepage = "https://github.com/gks-anvil/vrs_anvil_toolkit"
Documentation = "https://github.com/gks-anvil/vrs_anvil_toolkit"
Changelog = "https://github.com/gks-anvil/vrs_anvil_toolkit/releases"
Source = "https://github.com/gks-anvil/vrs_anvil_toolkit"
"Bug Tracker" = "https://github.com/gks-anvil/vrs_anvil_toolkit/issues"

[project.scripts]
vrs_bulk = "vrs_anvil.cli:cli"

[build-system]
requires = ["setuptools>=64", "setuptools_scm>=8"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
include-package-data = true

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools.package-data]
vrs_anvil_toolkit = ["**/*.yaml"]

[tool.setuptools_scm]

[tool.pytest.ini_options]
filterwarnings = ["ignore::DeprecationWarning"]
8 changes: 0 additions & 8 deletions pytest.ini

This file was deleted.

9 changes: 0 additions & 9 deletions requirements-dev.txt

This file was deleted.

19 changes: 0 additions & 19 deletions requirements.txt

This file was deleted.

Loading
Loading