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

add tools api docs to content collection #2268

Merged
merged 27 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
670077f
add tools api docs to content collection
mashehu Feb 2, 2024
53e385d
wrap tools doc in markdown wrapper
mashehu Feb 2, 2024
beee63d
fix build
mashehu Feb 2, 2024
bd9e0bc
fix memory overflow with optimized section generation
mashehu Feb 2, 2024
3a778dd
fix sidebar
mashehu Feb 3, 2024
4f3ce84
fix subsection names
mashehu Feb 3, 2024
7ecfb6b
wrap sidebar in code tags
mashehu Feb 3, 2024
bf736c2
wrap in template string
mashehu Feb 3, 2024
486eba5
use correct attribute
mashehu Feb 3, 2024
e3ded74
try span element
mashehu Feb 4, 2024
2e28ec3
Merge branch 'main' of github.com:nf-core/nf-co.re into restart-new-a…
mashehu Feb 12, 2024
20359e6
use sphinx markdown builder
mashehu Feb 15, 2024
bcc030b
fix dangling code blocks
mashehu Feb 15, 2024
6aac08c
remove redirect to old site
mashehu Feb 15, 2024
16b874e
fix astro build
mashehu Feb 15, 2024
3e6dcaa
render "latest" api doc pages explicetly
mashehu Feb 15, 2024
f6cdb07
add github action to trigger build
mashehu Feb 15, 2024
01d5084
add version selector
mashehu Feb 15, 2024
0b2937c
move dev to start of list. add top index page to sidebar
mashehu Feb 15, 2024
0057e46
update download page
mashehu Feb 15, 2024
4090d88
try css only accordion
mashehu Feb 15, 2024
036ecb5
Revert "try css only accordion"
mashehu Feb 15, 2024
1829fda
nicer accordion
mashehu Feb 15, 2024
cd1e0c2
fix navbar element
mashehu Feb 15, 2024
8ce892a
try to guess source file
mashehu Feb 16, 2024
28da626
simplify api index
mashehu Feb 16, 2024
9a62994
only add contents section once
mashehu Feb 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
80 changes: 80 additions & 0 deletions .github/workflows/add-tools-api-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Open PR with tools API docs based on webhook call
on:
workflow_dispatch:
inputs:
ref_name:
description: 'The name of the release branch'
required: true
default: 'dev'

jobs:
api-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Checkout tools code
uses: actions/checkout@v4
with:
repository: 'nf-core/tools'
ref: ${{ inputs.ref_name }}
path: 'tools'

- name: setup node
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: |
npm install remark unist-util-visit

- name: run API generation script
run: |
cd tools
bash docs/api/generate-api-docs.sh --release ${{ inputs.ref_name }}

# Install and run pre-commit
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5
with:
python-version: 3.11

# install prettier plugins
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4
with:
node-version: 20

- run: npm install --only=dev

- name: Install pre-commit
run: pip install pre-commit

- name: Run pre-commit
id: pre-commit
run: pre-commit run --all-files
continue-on-error: true

- name: Commit & push changes
id: commit-and-push
run: |
git config user.email "core@nf-co.re"
git config user.name "nf-core-bot"
git config push.default upstream
git add .
git status
git commit -m "[automated] Update nf-core/tools API docs for ${{ inputs.ref_name }}"
git push

- name: Create PR
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update nf-core/tools API docs for ${{github.ref_name}}
title: Update nf-core/tools API docs for ${{github.ref_name}}
body: |
This PR updates the nf-core/tools API docs for ${{github.ref_name}}.
Please review the changes and merge if they look good.
branch: 'update-api-docs-${{github.ref_name}}'
delete-branch: true
base: 'main'
draft: false
34 changes: 20 additions & 14 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,40 @@ import icon from "astro-icon";
const latestToolsRelease = await fetch('https://api.github.com/repos/nf-core/tools/releases/latest')
.then((res) => res.json())
.then((json) => json.tag_name);
let latestPipelineReleases = {};

let latestPipelineReleases = {};
pipelines_json.remote_workflows.map(
(pipeline) => (latestPipelineReleases[pipeline.name] = `/${pipeline.name}/${pipeline.releases[0].tag_name}/`),
);
const latestTollsURL = `/tools/docs/'+${latestToolsRelease}`;
// https://astro.build/config
export default defineConfig({
site: 'https://nf-co.re/',
output: 'hybrid',
adapter: netlify(),
redirects: {
[latestTollsURL]: 'https://oldsite.nf-co.re/tools/docs/latest/',
...latestPipelineReleases,
},
integrations: [
svelte(),
icon({
include:{
// only include a subset of icons
"file-icons":["nextflow"],
logos:["twitter","mastodon-icon","slack-icon","aws","microsoft-azure","github-actions", "youtube-icon"],
fa:["github"],
"fa-brands":["github"],
"line-md":["check-list-3-twotone"],
"mdi":["aws","slack","youtube"],
octicon:["link-external-16","table-16"],
}
include: {
// only include a subset of icons
'file-icons': ['nextflow'],
logos: [
'twitter',
'mastodon-icon',
'slack-icon',
'aws',
'microsoft-azure',
'github-actions',
'youtube-icon',
],
fa: ['github'],
'fa-brands': ['github'],
'line-md': ['check-list-3-twotone'],
mdi: ['aws', 'slack', 'youtube'],
octicon: ['link-external-16', 'table-16'],
},
}),
sitemap(),
prefetch(),
Expand Down Expand Up @@ -190,7 +196,7 @@ export default defineConfig({
theme: {
dark: 'github-dark',
light: 'github-light',
}
},
},
],
rehypeKatex,
Expand Down
4 changes: 1 addition & 3 deletions public/_redirects
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

# Temporary oldsite redirections
/logo/* https://oldsite.nf-co.re/logo/:splat 200

/tools-docs/lint_tests/* https://oldsite.nf-co.re/tools/docs/latest/pipeline_lint_tests/:splat
/tools/docs/* https://oldsite.nf-co.re/tools/docs/:splat
/pipeline_schema_builder/* https://oldsite.nf-co.re/pipeline_schema_builder/:splat 200
/launch/* https://oldsite.nf-co.re/launch/:splat 200
/assets/* https://oldsite.nf-co.re/assets/:splat 200
Expand All @@ -16,4 +13,5 @@
/developers/* /docs/contributing/:splat
/contributing/* /docs/contributing/:splat
/assets/img/* /images/:splat
/tools-docs/lint_tests/* /tools/docs/latest/pipeline_lint_tests/:splat

3 changes: 3 additions & 0 deletions src/components/navbar/Navbar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ newBlogPost = await getCollection('blog').then((posts) => {
<li><span class="dropdown-header">Configs & tools</span></li>
<li><a class="dropdown-item" href="/configs/">Shared configs</a></li>
<li><a class="dropdown-item" href="/tools/">Tools</a></li>
<li>
<a class="dropdown-item" href="/tools/docs/latest/index">Linting Errors</a>
</li>
</ul>
</li>
<li class="nav-item p-1 px-3 px-xl-1">
Expand Down
23 changes: 18 additions & 5 deletions src/components/sidebar/SidebarNav.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
const { items, minimal } = Astro.props;
const { items, minimal, accordion } = Astro.props;

export interface Props {
items: {
Expand All @@ -12,13 +12,14 @@ export interface Props {
}[];
}[];
minimal?: boolean;
accordion?: boolean;
}

let url = Astro.url.pathname.endsWith('/') ? Astro.url.pathname.slice(0, -1) : Astro.url.pathname;
url = url.replace(/\.html$/, '');
---

<div class="nav">
<div class:list={['nav', { accordion: accordion }]}>
<div class="w-100 sticky-top-under">
{
items &&
Expand Down Expand Up @@ -68,9 +69,8 @@ url = url.replace(/\.html$/, '');
'stretched-link',
]}
href={child.slug}
>
{child.title}
</a>
/>
<span set:html={child.title} />
</li>
);
})}
Expand Down Expand Up @@ -185,4 +185,17 @@ url = url.replace(/\.html$/, '');
}
}
}
// show only the active section
.nav.accordion {
ul {
display: none;
}
h6:has(.active) ~ ul,
ul:has(.active) {
display: block;
}
div.mb-3:not(:has(.active)) {
margin-bottom: 0 !important;
}
}
</style>
6 changes: 3 additions & 3 deletions src/components/sidebar/SidebarToc.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
// make margin classes from min to max heading depth
let headingMargin = {};
for (let i = minHeadingDepth; i <= 4; i++) {
headingMargin[i] = 'ps-' + (i - minHeadingDepth) * 2;
headingMargin[i] = 'ps-' + (i - minHeadingDepth);
}
let activeHeading = {};
onMount(() => {
Expand All @@ -47,7 +47,7 @@
</script>

<div class="nav flex-column sticky-top-under align-items-end pt-1">
<div class="d-none d-md-inline">
<div class="d-none d-md-block w-100">
{#if headings.length > 1}
<strong class="h6 my-2 text-body">On this page</strong>
{/if}
Expand All @@ -57,7 +57,7 @@
<ul class="mb-0 mt-1">
{#each headings as heading (heading)}
<li
class={'nav-item ' + headingMargin[heading.depth]}
class={'nav-item' + headingMargin[heading.depth]}
class:active={heading.slug === activeHeading}
class:collapse={heading.hidden && !$showHidden}
>
Expand Down
3 changes: 3 additions & 0 deletions src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,13 @@ const blog = defineCollection({

const pipelines = defineCollection({});

const tools = defineCollection({});

export const collections = {
events: events,
docs: docs,
about: about,
pipelines: pipelines,
blog: blog,
tools: tools,
};
36 changes: 36 additions & 0 deletions src/content/tools/docs/1.10.1/bump_version.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# nf_core.bump_version

Bumps the version number in all appropriate files for
a nf-core pipeline.

### `nf_core.bump_version.bump_nextflow_version(lint_obj, new_version){:python}`

Bumps the required Nextflow version number of a pipeline.

- **Parameters:**
- **lint_obj** ([_nf_core.lint.PipelineLint_](lint#nf_core.lint.PipelineLint)) – A PipelineLint object that holds information
about the pipeline contents and build files.
- **new_version** (_str_) – The new version tag for the required Nextflow version.

### `nf_core.bump_version.bump_pipeline_version(lint_obj, new_version){:python}`

Bumps a pipeline version number.

- **Parameters:**
- **lint_obj** ([_nf_core.lint.PipelineLint_](lint#nf_core.lint.PipelineLint)) – A PipelineLint object that holds information
about the pipeline contents and build files.
- **new_version** (_str_) – The new version tag for the pipeline. Semantic versioning only.

### `nf_core.bump_version.update_file_version(filename, lint_obj, pattern, newstr, allow_multiple=False){:python}`

Updates the version number in a requested file.

- **Parameters:**
- **filename** (_str_) – File to scan.
- **lint_obj** ([_nf_core.lint.PipelineLint_](lint#nf_core.lint.PipelineLint)) – A PipelineLint object that holds information
about the pipeline contents and build files.
- **pattern** (_str_) – Regex pattern to apply.
- **newstr** (_str_) – The replaced string.
- **allow_multiple** (_bool_) – Replace all pattern hits, not only the first. Defaults to False.
- **Raises:**
**SyntaxError**\*\*,\*\* **if the version number cannot be found.** –
1 change: 1 addition & 0 deletions src/content/tools/docs/1.10.1/create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# nf_core.create
68 changes: 68 additions & 0 deletions src/content/tools/docs/1.10.1/download.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# nf_core.download

Downloads a nf-core pipeline to the local file system.

### _`class{:python}`_`nf_core.download.DownloadWorkflow(pipeline, release=None, singularity=False, outdir=None, compress_type='tar.gz'){:python}`

Downloads a nf-core workflow from GitHub to the local file system.

Can also download its Singularity container image if required.

- **Parameters:**
- **pipeline** (_str_) – A nf-core pipeline name.
- **release** (_str_) – The workflow release version to download, like 1.0. Defaults to None.
- **singularity** (_bool_) – Flag, if the Singularity container should be downloaded as well. Defaults to False.
- **outdir** (_str_) – Path to the local download directory. Defaults to None.

#### `compress_download(){:python}`

Take the downloaded files and make a compressed .tar.gz archive.

#### `download_configs(){:python}`

Downloads the centralised config profiles from nf-core/configs to `self.outdir`.

#### `download_wf_files(){:python}`

Downloads workflow files from GitHub to the `self.outdir`.

#### `download_workflow(){:python}`

Starts a nf-core workflow download.

#### `fetch_workflow_details(wfs){:python}`

Fetches details of a nf-core workflow to download.

- **Parameters:**
**wfs** ([_nf_core.list.Workflows_](list#nf_core.list.Workflows)) – A nf_core.list.Workflows object
- **Raises:**
**LockupError**\*\*,\*\* **if the pipeline can not be found.** –

#### `find_container_images(){:python}`

Find container image names for workflow

#### `pull_singularity_image(container){:python}`

Uses a local installation of singularity to pull an image from Docker Hub.

- **Parameters:**
**container** (_str_) – A pipeline’s container name. Usually it is of similar format
to nfcore/name:dev.
- **Raises:**
**Various exceptions possible from subprocess execution** **of** **Singularity.** –

#### `validate_md5(fname, expected=None){:python}`

Calculates the md5sum for a file on the disk and validate with expected.

- **Parameters:**
- **fname** (_str_) – Path to a local file.
- **expected** (_str_) – The expected md5sum.
- **Raises:**
**IOError**\*\*,\*\* **if the md5sum does not match the remote sum.** –

#### `wf_use_local_configs(){:python}`

Edit the downloaded nextflow.config file to use the local config files
Loading
Loading