Skip to content

Commit

Permalink
version handling unstable
Browse files Browse the repository at this point in the history
  • Loading branch information
mazzalab committed Nov 19, 2024
1 parent d76bc7f commit d6c81e1
Show file tree
Hide file tree
Showing 9 changed files with 118 additions and 17 deletions.
4 changes: 3 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@
"ms-azuretools.vscode-docker"
]
}
}
},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
"remoteUser": "root"
}
File renamed without changes.
25 changes: 23 additions & 2 deletions conda-recipe/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
#!/bin/sh
# $PYTHON setup.py install --single-version-externally-managed --record=$RECIPE_DIR/record.txt
$PYTHON -m pip install --no-deps --ignore-installed .

mkdir -p $PREFIX/lib/python$PY_VER/site-packages/tests/testdata
cp -r tests/testdata/* $PREFIX/lib/python$PY_VER/site-packages/tests/testdata/

# Read the "versions" file located one directory up
VERSION_FILE="../versions"

# Extract the version for "wipertools"
if [ -f "$VERSION_FILE" ]; then
WIPERTOOLS_VERSION=$(grep "^wipertools:" "$VERSION_FILE" | cut -d':' -f2 | tr -d '[:space:]')
export WIPERTOOLS_VERSION
else
echo "Error: versions file not found!"
exit 1
fi

WIPERTOOLS_VERSION=1.1.1
export WIPERTOOLS_VERSION

# # Print the version (optional, for debugging)
# echo "WIPERTOOLS_VERSION is set to $WIPERTOOLS_VERSION"

$PYTHON setup.py install --single-version-externally-managed --record=$RECIPE_DIR/record.txt
23 changes: 17 additions & 6 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,41 @@
{% set data = load_setup_py_data(setup_file="setup.py") %}
{% set version = data.get('version') %}

# https://docs.conda.io/projects/conda-build/en/latest/resources/define-metadata.html
# https://docs.conda.io/projects/conda-build/en/latest/resources/define-metadata.html#:~:text=%7B%7B%20version%20%7D%7D-,load_file_data,-%3A%20Parse%20JSON%2C%20TOML

{% set sha256 = "898812fc8d2ac86f22f4da9e24eb707383a681c8553aa6813a05b108c8e10582" %}

package:
name: wipertools
version: {{ wipertools_version }}
version: {{ version }}

#app:
# icon: icon_64x64.png

source:
# git_url: https://github.com/mazzalab/fastqwiper.git
path: ./
path: ../
# url: https://github.com/mazzalab/fastqwiper/archive/refs/tags/2024_11.zip
# sha256: {{ sha256 }}

build:
# number: { { environ.get('GITHUB_RUN_NUMBER', 0) } }
number: 0
noarch: python
# script: python -m pip install --no-deps --ignore-installed .
# script: {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation
run_exports:
- {{ pin_subpackage('wipertools', max_pin="x.x") }}
entry_points:
- wipertools = fastqwiper.wipertools:main

requirements:
host:
- python
- python >=3.7
- pip

- setuptools
run:
- python
- python >=3.7

test:
imports:
Expand All @@ -43,3 +53,4 @@ about:
extra:
recipe-maintainers:
- mazzalab
- irongraft
25 changes: 25 additions & 0 deletions conda-recipe/record.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/opt/conda/conda-bld/wipertools_1731963283217/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python3.13/site-packages/tests/test_fastq_wiper.py
/opt/conda/conda-bld/wipertools_1731963283217/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python3.13/site-packages/tests/__init__.py
/opt/conda/conda-bld/wipertools_1731963283217/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python3.13/site-packages/fastqwiper/wipertools.py
/opt/conda/conda-bld/wipertools_1731963283217/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python3.13/site-packages/fastqwiper/fastq_gather.py
/opt/conda/conda-bld/wipertools_1731963283217/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python3.13/site-packages/fastqwiper/summary_gather.py
/opt/conda/conda-bld/wipertools_1731963283217/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python3.13/site-packages/fastqwiper/fastq_wiper.py
/opt/conda/conda-bld/wipertools_1731963283217/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python3.13/site-packages/fastqwiper/__init__.py
/opt/conda/conda-bld/wipertools_1731963283217/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python3.13/site-packages/fastqwiper/fastq_scatter.py
/opt/conda/conda-bld/wipertools_1731963283217/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python3.13/site-packages/fastqwiper/wipertool_abstract.py
/opt/conda/conda-bld/wipertools_1731963283217/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python3.13/site-packages/tests/__pycache__/test_fastq_wiper.cpython-313.pyc
/opt/conda/conda-bld/wipertools_1731963283217/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python3.13/site-packages/tests/__pycache__/__init__.cpython-313.pyc
/opt/conda/conda-bld/wipertools_1731963283217/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python3.13/site-packages/fastqwiper/__pycache__/wipertools.cpython-313.pyc
/opt/conda/conda-bld/wipertools_1731963283217/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python3.13/site-packages/fastqwiper/__pycache__/fastq_gather.cpython-313.pyc
/opt/conda/conda-bld/wipertools_1731963283217/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python3.13/site-packages/fastqwiper/__pycache__/summary_gather.cpython-313.pyc
/opt/conda/conda-bld/wipertools_1731963283217/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python3.13/site-packages/fastqwiper/__pycache__/fastq_wiper.cpython-313.pyc
/opt/conda/conda-bld/wipertools_1731963283217/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python3.13/site-packages/fastqwiper/__pycache__/__init__.cpython-313.pyc
/opt/conda/conda-bld/wipertools_1731963283217/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python3.13/site-packages/fastqwiper/__pycache__/fastq_scatter.cpython-313.pyc
/opt/conda/conda-bld/wipertools_1731963283217/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python3.13/site-packages/fastqwiper/__pycache__/wipertool_abstract.cpython-313.pyc
/opt/conda/conda-bld/wipertools_1731963283217/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python3.13/site-packages/wipertools-1.1.1-py3.13.egg-info/SOURCES.txt
/opt/conda/conda-bld/wipertools_1731963283217/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python3.13/site-packages/wipertools-1.1.1-py3.13.egg-info/dependency_links.txt
/opt/conda/conda-bld/wipertools_1731963283217/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python3.13/site-packages/wipertools-1.1.1-py3.13.egg-info/PKG-INFO
/opt/conda/conda-bld/wipertools_1731963283217/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python3.13/site-packages/wipertools-1.1.1-py3.13.egg-info/entry_points.txt
/opt/conda/conda-bld/wipertools_1731963283217/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python3.13/site-packages/wipertools-1.1.1-py3.13.egg-info/top_level.txt
/opt/conda/conda-bld/wipertools_1731963283217/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python3.13/site-packages/wipertools-1.1.1-py3.13.egg-info/requires.txt
/opt/conda/conda-bld/wipertools_1731963283217/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/wipertools
14 changes: 6 additions & 8 deletions fastqwiper/wipertool_abstract.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
from abc import ABC, abstractmethod
from argparse import Namespace
import os
import yaml


class WiperTool(ABC):
name: str
config: str
config: dict

def __init__(self, name):
self.name = name

yaml_file_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'conda-recipe', 'conda_build_config.yaml')
# Read the YAML file
with open(yaml_file_path, 'r') as yaml_file:
self.config = yaml.safe_load(yaml_file)

versions_file_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'versions')
with open(versions_file_path, 'r') as file:
self.config = {line.split(':')[0]: line.split(':')[1].strip() for line in file if line.strip()}

def version(self):
return self.config.get(self.name + "_version", [None])[0]
return self.config.get(self.name, "")

@abstractmethod
def set_parser(self, parser):
Expand Down
39 changes: 39 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import os
from setuptools import setup, find_packages

# version='0.0.1'
# if '--wipertools_version' in sys.argv:
# version_idx = sys.argv.index('--wipertools_version')
# version = sys.argv[version_idx + 1]
# sys.argv.remove('--wipertools_version')
# sys.argv.pop(version_idx)

version_string = os.environ.get("WIPERTOOLS_VERSION", "0.0.0.dev0")

setup(
name="wipertools",
version=version_string,
packages=find_packages(),
# https://setuptools.pypa.io/en/latest/userguide/datafiles.html
# package_data={"": ["*.txt"], "mypkg1": ["data1.rst"]},
# include_package_data=True,
# exclude_package_data={"mypkg": [".gitattributes"]},
install_requires=["setuptools"],
entry_points={
"console_scripts": [
"wipertools=fastqwiper.wipertools:main"
]
},
author="Tommaso Mazza",
author_email="[email protected]",
description="A suite of programs that drop or fix pesky lines in FASTQ files and that split or merge FASTQ chunk files.",
long_description=open("README.md").read() if os.path.exists("README.md") else "",
long_description_content_type="text/markdown",
url="https://github.com/mazzalab/fastqwiper",
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License",
"Operating System :: OS Independent",
],
python_requires='>=3.7',
)
Empty file added version.json
Empty file.
5 changes: 5 additions & 0 deletions versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
wipertools:1.1.0
fastqwiper:1.0.1
fastqscatter:1.0.0
fastqgather:1.0.0
summarygather:1.0.0

0 comments on commit d6c81e1

Please sign in to comment.