Skip to content

Commit

Permalink
chore: remove Python 3.8 support (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkanche authored Dec 20, 2024
1 parent d12588e commit 0e16c4c
Show file tree
Hide file tree
Showing 11 changed files with 113 additions and 118 deletions.
75 changes: 38 additions & 37 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,44 @@ on:

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest tox
# - name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# # flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with tox
run: |
tox
- name: Build docs
run: |
tox -e docs
- run: touch ./docs/_build/html/.nojekyll
- name: GH Pages Deployment
uses: JamesIves/[email protected]
with:
branch: gh-pages # The branch the action should deploy to.
folder: ./docs/_build/html
clean: true # Automatically remove deleted files from the deploy branch
- name: Build Project and Publish
run: |
python -m tox -e clean,build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
- uses: actions/checkout@v4

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

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Test with tox
run: |
tox
- name: Build docs
run: |
tox -e docs
- run: touch ./docs/_build/html/.nojekyll

- name: GH Pages Deployment
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: ./docs/_build/html
clean: true # Automatically remove deleted files from the deploy branch

- name: Build Project and Publish
run: |
python -m tox -e clean,build
- name: Publish package
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
47 changes: 20 additions & 27 deletions .github/workflows/pypi-test.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,33 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Test the library
name: Run tests

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

name: Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest tox
# - name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# # flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with tox
run: |
tox
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Test with tox
run: |
tox
15 changes: 8 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ repos:
- id: mixed-line-ending
args: ['--fix=auto'] # replace 'auto' with 'lf' to enforce Linux/Mac line endings or 'crlf' for Windows

- repo: https://github.com/PyCQA/docformatter
rev: eb1df347edd128b30cd3368dddc3aa65edcfac38
hooks:
- id: docformatter
additional_dependencies: [tomli]
args: [--in-place, --wrap-descriptions=120, --wrap-summaries=120]
# --config, ./pyproject.toml
# - repo: https://github.com/PyCQA/docformatter
# rev: master
# hooks:
# - id: docformatter
# additional_dependencies: [tomli]
# args: [--in-place, --wrap-descriptions=120, --wrap-summaries=120]
# # --config, ./pyproject.toml

# - repo: https://github.com/psf/black
# rev: 24.8.0
Expand All @@ -37,6 +37,7 @@ repos:
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

## If like to embrace black styles even in the docs:
# - repo: https://github.com/asottile/blacken-docs
Expand Down
11 changes: 7 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Changelog

## Version 0.1 (development)
## Version 0.2.0

- Feature A added
- FIX: nasty bug #1729 fixed
- add your changes here!
- chore: Remove Python 3.8 (EOL)
- precommit: Replace docformatter with ruff's formatter

## Version 0.1.0

- Initial version of the package
3 changes: 0 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,6 @@
autosummary_generate = True
autosummary_imported_members = True




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

# The theme to use for HTML and HTML Help pages. See the documentation for
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ extend-ignore = ["F821"]
[tool.ruff.pydocstyle]
convention = "google"

[tool.ruff.format]
docstring-code-format = true
docstring-code-line-length = 20

[tool.ruff.per-file-ignores]
"__init__.py" = ["E402", "F401"]

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ package_dir =
=src

# Require a min/specific Python version (comma-separated conditions)
python_requires = >=3.8
python_requires = >=3.9

# Add here dependencies of your project (line-separated), e.g. requests>=2.2,<3.0.
# Version specifiers like >=2.2,<3.0 avoid problems due to API changes in
Expand Down
12 changes: 9 additions & 3 deletions src/genomicarrays/GenomicArrayDataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@
.. code-block:: python
from genomicarray import GenomicArrayDataset
from genomicarray import (
GenomicArrayDataset,
)
garr = GenomicArrayDataset(dataset_path="/path/to/genomicarray/dir")
result1 = garr[0:10, 0]
garr = GenomicArrayDataset(
dataset_path="/path/to/genomicarray/dir"
)
result1 = garr[
0:10, 0
]
print(result1)
"""
Expand Down
17 changes: 13 additions & 4 deletions src/genomicarrays/GenomicArrayDatasetSlice.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,20 @@
.. code-block:: python
from genomicarray import GenomicArrayDataset
from genomicarray import (
GenomicArrayDataset,
)
garr = GenomicArrayDataset(dataset_path="/path/to/genomicarray/dir")
feature_indices = slice(0, 10)
result1 = garr[feature_indices, 0]
garr = GenomicArrayDataset(
dataset_path="/path/to/genomicarray/dir"
)
feature_indices = (
slice(0, 10)
)
result1 = garr[
feature_indices,
0,
]
print(result1)
"""
Expand Down
41 changes: 10 additions & 31 deletions src/genomicarrays/build_genomicarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,7 @@ def build_genomicarray(
missing = required_cols - set(input_intervals.columns)
raise ValueError(f"Missing required columns: {missing}")
else:
raise TypeError(
"'input_intervals' is not an expected type (either 'str' or 'Dataframe')."
)
raise TypeError("'input_intervals' is not an expected type (either 'str' or 'Dataframe').")

# append start index for each interval
input_intervals["widths"] = input_intervals["ends"] - input_intervals["starts"]
Expand All @@ -190,16 +188,13 @@ def build_genomicarray(
counter = [1] * len(input_intervals)
total_length = len(input_intervals)
counter[0] = 0
input_intervals["genarr_feature_start_index"] = (
pd.Series(counter).cumsum().astype(int)
)
input_intervals["genarr_feature_start_index"] = pd.Series(counter).cumsum().astype(int)

ends = input_intervals["genarr_feature_start_index"].shift(-1)
ends.iloc[-1] = total_length
input_intervals["genarr_feature_end_index"] = ends.astype(int)

if not feature_annotation_options.skip:

if "sequence" not in input_intervals.columns:
gen_fa = Fasta(genome_fasta, as_raw=True)
sequences = []
Expand All @@ -209,19 +204,13 @@ def build_genomicarray(

input_intervals["sequences"] = sequences

_col_types = utf.infer_column_types(
input_intervals, feature_annotation_options.column_types
)
_col_types = utf.infer_column_types(input_intervals, feature_annotation_options.column_types)

if "genarr_feature_index" not in input_intervals.columns:
input_intervals["genarr_feature_index"] = range(0, len(input_intervals))

_feature_output_uri = (
f"{output_path}/{feature_annotation_options.tiledb_store_name}"
)
utf.create_tiledb_frame_from_dataframe(
_feature_output_uri, input_intervals, column_types=_col_types
)
_feature_output_uri = f"{output_path}/{feature_annotation_options.tiledb_store_name}"
utf.create_tiledb_frame_from_dataframe(_feature_output_uri, input_intervals, column_types=_col_types)

if optimize_tiledb:
uta.optimize_tiledb_array(_feature_output_uri)
Expand Down Expand Up @@ -251,16 +240,10 @@ def build_genomicarray(
raise TypeError("'sample_metadata' is not an expected type.")

if not sample_metadata_options.skip:
_col_types = utf.infer_column_types(
sample_metadata, sample_metadata_options.column_types
)
_col_types = utf.infer_column_types(sample_metadata, sample_metadata_options.column_types)

_sample_output_uri = (
f"{output_path}/{sample_metadata_options.tiledb_store_name}"
)
utf.create_tiledb_frame_from_dataframe(
_sample_output_uri, sample_metadata, column_types=_col_types
)
_sample_output_uri = f"{output_path}/{sample_metadata_options.tiledb_store_name}"
utf.create_tiledb_frame_from_dataframe(_sample_output_uri, sample_metadata, column_types=_col_types)

if optimize_tiledb:
uta.optimize_tiledb_array(_sample_output_uri)
Expand Down Expand Up @@ -311,9 +294,7 @@ def build_genomicarray(
)


def _write_intervals_to_tiledb(
outpath, intervals, bwpath, bwidx, agg_func, total_length
):
def _write_intervals_to_tiledb(outpath, intervals, bwpath, bwidx, agg_func, total_length):
"""Wrapper to extract the data for the given intervals from the bigwig file and write the output to the tiledb
file."""
data = ubw.wrapper_extract_bw_values(
Expand All @@ -330,6 +311,4 @@ def _write_intervals_to_tiledb(
def _wrapper_extract_bwinfo(args):
"""Wrapper for multiprocessing multiple files and intervals."""
counts_uri, input_intervals, bwpath, idx, agg_func, total_length = args
return _write_intervals_to_tiledb(
counts_uri, input_intervals, bwpath, idx, agg_func, total_length
)
return _write_intervals_to_tiledb(counts_uri, input_intervals, bwpath, idx, agg_func, total_length)
4 changes: 3 additions & 1 deletion src/genomicarrays/dataloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
.. code-block:: python
from genomicarrays.dataloader import TorchDataset
from genomicarrays.dataloader import (
TorchDataset,
)
ds = TorchDataset(
dataset_path="/path/to/genarr/dir"
Expand Down

0 comments on commit 0e16c4c

Please sign in to comment.