Re-organizing repositories by splitting this into two

This commit is contained in:
Harrison Deng 2025-02-17 15:13:27 +00:00
parent eba984e43f
commit 9d117a37ea
8 changed files with 162 additions and 8 deletions

16
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,16 @@
FROM mcr.microsoft.com/devcontainers/miniconda:1-3
# Copy environment.yml (if found) to a temp location so we update the environment. Also
# copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists.
COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/
RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
&& rm -rf /tmp/conda-tmp
# [Optional] Uncomment to install a different version of Python than the default
# RUN conda install -y python=3.6 \
# && pip install --no-cache-dir pipx \
# && pipx reinstall-all
# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

View File

@ -0,0 +1,24 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/miniconda
{
"name": "Miniconda (Python 3)",
"build": {
"context": "..",
"dockerfile": "Dockerfile"
}
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "python --version",
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}

3
.devcontainer/noop.txt Normal file
View File

@ -0,0 +1,3 @@
This file is copied into the container along with environment.yml* from the
parent folder. This is done to prevent the Dockerfile COPY instruction from
failing if no environment.yml is found.

19
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,19 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Current File with Arguments",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"args": [
"${command:pickArgs}"
]
}
]
}

54
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,54 @@
pipeline {
agent {
kubernetes {
cloud 'rsys-devel'
defaultContainer 'miniforge3'
inheritFrom 'miniforge'
}
}
stages {
stage("prepare") {
parallel {
stage("recipes repo") {
steps {
sh 'git clone https://github.com/RealYHD/bioconda-recipes.git'
dir('bioconda-recipes') {
sh 'git pull'
sh 'git pull origin update-autobigs-engine'
sh 'git pull origin update-autobigs-engine'
}
}
}
stage("conda") {
steps {
sh 'conda env update -n base --file environment.yml'
}
}
}
}
stage("update recipes") {
parallel {
stage("autoBIGS.cli") {
steps {
sh 'grayskull pypi autobigs.cli --maintainers "Harrison Deng"'
sh 'python scripts/adapt_names.py autobigs.cli'
}
}
stage("autoBIGS.engine") {
steps {
sh 'grayskull pypi autobigs.cli --maintainers "Harrison Deng"'
sh 'python scripts/adapt_names.py autobigs.engine'
}
}
}
stage("overwrite") {
steps {
dir('bioconda-recipes') {
sh 'checkout '
sh 'cp autobigs-engine/* '
}
}
}
}
}
}

View File

@ -1,4 +1,4 @@
{% set name = "autoBIGS.engine" %}
{% set name = "autobigs.engine" %}
{% set version = "0.11.0" %}
package:
@ -13,8 +13,6 @@ build:
noarch: python
script: {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation
number: 0
run_exports:
- {{ pin_subpackage( name|lower|replace(".", "-"), max_pin="x.x") }}
requirements:
host:
@ -24,8 +22,8 @@ requirements:
- pip
run:
- python >=3.12
- biopython
- aiohttp
- biopython ==1.85
- aiohttp ==3.11.*
test:
imports:
@ -36,11 +34,11 @@ test:
- pip
about:
home: https://github.com/RealYHD/autoBIGS.engine
summary: A library to rapidly fetch fetch MLST profiles given sequences for various diseases.
license: GPL-3.0-or-later
dev_url: https://github.com/RealYHD/autoBIGS.engine
license: GPL-3.0
license_file: LICENSE
extra:
recipe-maintainers:
- Harrison Deng
- RealYHD

10
environment.yml Normal file
View File

@ -0,0 +1,10 @@
name: base
channels:
- conda-forge
- bioconda
dependencies:
- conda-build
- grayskull
- bioconda-utils
- python=3.10
- git

30
scripts/adapt_names.py Normal file
View File

@ -0,0 +1,30 @@
import argparse
from os import fdopen, path
import os
import re
import shutil
from sys import argv
import tempfile
def main():
original_recipe = path.abspath(argv[1])
original_meta = path.join(original_recipe, "meta.yaml")
new_fd, new_file_path = tempfile.mkstemp()
with fdopen(new_fd, "w") as new_file_handle:
with open(original_meta, "r") as original_file_handle:
for line in original_file_handle:
matches = re.finditer(r"\{\{\s*name\|lower()\s+\}\}", line)
modified_line = line
for match in matches:
modified_line = modified_line[:match.start(1)] + r'|replace(".", "-")' + modified_line[match.end(1):]
new_file_handle.write(modified_line)
shutil.move(new_file_path, original_meta)
new_recipe_name = path.join(
path.dirname(original_recipe),
path.basename(original_recipe).replace(".", "-").lower())
shutil.rmtree(new_recipe_name, ignore_errors=True)
os.replace(original_recipe,
new_recipe_name)
if __name__ == "__main__":
main()