Skip to content

Commit

Permalink
Update package infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
JureZmrzlikar committed Nov 4, 2024
1 parent f684fec commit bb262b0
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 263 deletions.
68 changes: 17 additions & 51 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,26 @@
name: Python package
name: Package testing

on:
push:
branches: [ master ]
branches:
- master
tags:
- "[0-9]+.[0-9]+.[0-9]+*"

pull_request:
branches: [ master ]
types: [opened, reopened, ready_for_review, synchronize]

workflow_dispatch:

jobs:
tests:
runs-on: ubuntu-latest
test:
if: github.event.pull_request.draft == false
runs-on: arc-runner
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Tox
run: pip install tox
- name: Run tox using the version of Python in `PATH`
run: tox -e py
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install Tox
run: pip install tox
- name: Check that docs build successfully
run: tox -e docs
linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install Tox
run: pip install tox
- name: Check code is compliant with linters
run: tox -e linters
packaging:
runs-on: ubuntu-latest
tox-env: [py311, py312, py313, linters, docs, package]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install Tox
run: pip install tox twine
- name: Check package structure
run: tox -e packaging
- uses: actions/checkout@v4
- name: Run Tests
run: |
tox -e ${{ matrix.tox-env }}
10 changes: 1 addition & 9 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# Include setup.py.
# NOTE: This is needed until setuptools is fixed to include setup.py file by
# default for scenarios where the invoking script is not setup.py.
# For more details, see: https://github.com/pypa/setuptools/issues/1506.
include setup.py
# Include meta data.
include LICENSE
# Include documentation and files needed by documentation.
recursive-include docs *.py *.rst
# Include tests and files needed by tests
include tox.ini
include pyproject.toml
recursive-include tests *.py
recursive-include tests *.py
77 changes: 7 additions & 70 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,75 +1,12 @@
import os.path
"""Configuration."""

# Get package metadata from '__about__.py' file.
about = {}
base_dir = os.path.dirname(os.path.abspath(os.path.dirname(__file__)))
with open(
os.path.join(base_dir, 'src', 'ngs_test_utils', '__about__.py'), 'r'
) as fh:
exec(fh.read(), about)
if '__version__' not in about:
raise AttributeError(
"Package's version is not defined. Please, install the package."
)
from importlib.metadata import metadata

# -- General configuration ------------------------------------------------

# The extension modules to enable.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.extlinks',
'sphinx.ext.intersphinx',
'sphinx.ext.coverage',
'sphinx.ext.viewcode',
]

# The suffix(es) of source filenames.
source_suffix = '.rst'

# The master toctree document.
master_doc = 'index'
meta = metadata("ngs-test-utils")

# General information about the project.
project = 'NGS test utils'
version = about['__version__']
project = "NGS test utils"
version = meta["version"]
release = version
author = about['__author__']
copyright = about['__copyright__']

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False

# Warn about all references where the target cannot be found.
nitpicky = True
# Except for the following:
nitpick_ignore = [
# This is needed to prevent warnings for container types, e.g.:
# :type foo: tuple(bool, str).
('py:obj', '')
]

# -- Options for HTML output ----------------------------------------------

# The theme to use for HTML and HTML Help pages.
html_theme = 'sphinx_rtd_theme'

# Output file base name for HTML help builder.
htmlhelp_basename = 'NgsTestUtilsdoc'

# Configuration for intersphinx.
intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}
author = meta["author"]
copyright = "2024, " + author
106 changes: 101 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,106 @@
[build-system]
requires = [
"setuptools",
"wheel",
"setuptools >= 64.0.0",
"setuptools_scm >= 6.4.0",
]
build-backend = "setuptools.build_meta"

[tool.black]
target-version = ["py36", "py37", "py38"]
line-length = 119
[project]
name = "ngs_test_utils"
description = "Utilities for generation of synthetic NGS files"
authors = [
{name = "Genialis, Inc."},
{email = "[email protected]"},
]
dynamic = ["version"]
readme = "README.rst"
license = {text = "Apache 2.0"}
requires-python = ">=3.11, <3.14"
keywords = [
"ngs",
"test",
"bioinformatics",
]
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Environment :: Console",
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries :: Python Modules",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dependencies = [
"numpy",
"pybedtools",
"pysam",
]

[project.optional-dependencies]
docs = [
"sphinx",
]
package = [
"build>=0.8.0",
"check-manifest>=0.48",
"twine>=4.0.1",
]
test = [
"ruff",
"pytest>=7.2.0",
"pytest-cov>=4.0.0",
"pytest-mock>=3.10.0",
"toml>=0.10.2",
]

[project.urls]
repository = "https://github.com/genialis/ngs-test-utils"

[tool.setuptools_scm]

[tool.ruff]
line-length = 99
target-version = "py312"
# Necessary for isort
src = ["src"]

[tool.ruff.lint]
select = [
# pydocstyle
"D",
# pycodestyle
"E", "W",
# pyflakes
"F",
# isort
"I",
# Pyupgrade - use a more modern / newer syntax if it exists
"UP",
# Mccabe - detect too complex code
"C901",
# flake8-2022 - Checks for misuse of sys.version or sys.version_info
"YTT",
# flake8 bugbear - find common bugs and design problems
"B",
# find unused `noqa` directive
"RUF100",
]
ignore = [
# `one-blank-line-before-class` (D203) and
# `no-blank-line-before-class` (D211) are incompatible.
"D203",
# `multi-line-summary-first-line` (D212) and
# `multi-line-summary-second-line` (D213) are incompatible.
"D213",
# Setting an explicit stacklevel in warnings.warn(...) is just a reccomendation
"B028",
# We need assert statemets in tests
"S101",
]

[tool.ruff.lint.per-file-ignores]
# tests folder does not enforce pydocstyle
"tests/*" = ["D"]
62 changes: 0 additions & 62 deletions setup.py

This file was deleted.

24 changes: 0 additions & 24 deletions src/ngs_test_utils/__about__.py

This file was deleted.

Loading

0 comments on commit bb262b0

Please sign in to comment.