Skip to content

Commit

Permalink
Update branch names (#1157)
Browse files Browse the repository at this point in the history
* Update scvelo default branch

Update default branch from `master` to `main`.

* Update `ci.yml`

Update branches triggering CI.
  • Loading branch information
WeilerP authored Dec 2, 2023
1 parent c845382 commit d23edc8
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Check Build

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

jobs:
package:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI

on:
push:
branches: [master, develop, "release/**"]
branches: [main]
pull_request:
branches: [master, develop, "release/**"]
branches: [main]

jobs:
# Skip CI if commit message contains `[ci skip]` in the subject
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ The docstrings of scVelo largely follow the `numpy`-style. New docstrings should
Submitting pull requests
^^^^^^^^^^^^^^^^^^^^^^^^

New features and bug fixes are added to the code base through a pull request (PR). To implement a feature or bug fix, create a branch from `master`. The existence of bugs suggests insufficient test coverage. As such, bug fixes should, ideally, include a unit test or extend an existing one. Please ensure that
New features and bug fixes are added to the code base through a pull request (PR). To implement a feature or bug fix, create a branch from `main`. The existence of bugs suggests insufficient test coverage. As such, bug fixes should, ideally, include a unit test or extend an existing one. Please ensure that

- branch names have the prefix `feat/` or `fix/`.
- your code follows the project conventions.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[link-pypi]: https://pypi.org/project/scvelo
[badge-pypidownloads]: https://pepy.tech/badge/scvelo
[link-pypidownloads]: https://pepy.tech/project/scvelo
[badge-ci]: https://img.shields.io/github/actions/workflow/status/theislab/scvelo/ci.yml?branch=master
[badge-ci]: https://img.shields.io/github/actions/workflow/status/theislab/scvelo/ci.yml?branch=main
[link-ci]: https://github.com/theislab/scvelo/actions/workflows/ci.yml

# scVelo - RNA velocity generalized through dynamical modeling
Expand Down
14 changes: 14 additions & 0 deletions debug.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import numpy as np

import scvelo as scv

adata = scv.datasets.pancreas(file_path="data/pancreas.h5ad")
obs_names = adata.obs_names.tolist()
obs_names[0] = f"blah-{obs_names[0]}"
obs_names[1] = f"blah-{obs_names[0]}"
adata.obs_names = obs_names

bdata = adata.copy()
bdata.obs_names = np.arange(0, bdata.n_obs).astype(str)

adata = scv.utils.merge(adata, bdata)
2 changes: 1 addition & 1 deletion docs/source/_ext/edit_on_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def html_page_context(app, pagename, templatename, context, doctree):
# For sphinx_rtd_theme.
context["display_github"] = True
context["github_user"] = "theislab"
context["github_version"] = "master"
context["github_version"] = "main"
context["github_repo"] = repo
context["conf_py_path"] = conf_py_path

Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
<a href="https://colab.research.google.com/{{ docname|e }}" target="_parent">
<img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
<a href="https://nbviewer.jupyter.org/{{ docname|e }}" target="_parent">
<img src="https://github.com/theislab/scvelo/raw/master/docs/source/_static/nbviewer-badge.svg" alt="Open In nbviewer"/></a>
<img src="https://github.com/theislab/scvelo/raw/main/docs/source/_static/nbviewer-badge.svg" alt="Open In nbviewer"/></a>
</div>
"""

Expand Down Expand Up @@ -252,7 +252,7 @@ def get_linenos(obj):

# set project_dir: project/docs/source/conf.py/../../.. → project/
project_dir = Path(__file__).parent.parent.parent
github_url_scvelo = "https://github.com/theislab/scvelo/tree/master"
github_url_scvelo = "https://github.com/theislab/scvelo/tree/main"
github_url_read_loom = "https://github.com/theislab/anndata/tree/master/anndata"
github_url_read = "https://github.com/theislab/scanpy/tree/master"
github_url_scanpy = "https://github.com/theislab/scanpy/tree/master/scanpy"
Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ For further information visit `scvelo.org <https://scvelo.org>`_.
.. |Docs| image:: https://readthedocs.org/projects/scvelo/badge/?version=latest
:target: https://scvelo.readthedocs.io

.. |travis| image:: https://travis-ci.org/theislab/scvelo.svg?branch=master
.. |travis| image:: https://travis-ci.org/theislab/scvelo.svg?branch=main
:target: https://travis-ci.org/theislab/scvelo

.. _Scanpy: https://scanpy.readthedocs.io
Expand Down
Empty file added scvelo/datasets/_biomart.py
Empty file.
Empty file added scvelo/datasets/_load.py
Empty file.
52 changes: 52 additions & 0 deletions scvelo/datasets/_read.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import os
from pathlib import Path
from urllib.request import urlretrieve

import numpy as np
import pandas as pd


def load(filename, backup_url=None, header="infer", index_col="infer", **kwargs):
"""Load a csv, txt, tsv or npy file."""
numpy_ext = {"npy", "npz"}
pandas_ext = {"csv", "txt", "tsv"}

if not os.path.exists(filename) and backup_url is None:
raise FileNotFoundError(f"Did not find file {filename}.")

elif not os.path.exists(filename):
d = os.path.dirname(filename)
if not os.path.exists(d):
os.makedirs(d)
urlretrieve(backup_url, filename)

ext = Path(filename).suffixes[-1][1:]

if ext in numpy_ext:
return np.load(filename, **kwargs)

elif ext in pandas_ext:
df = pd.read_csv(
filename,
header=header,
index_col=None if index_col == "infer" else index_col,
**kwargs,
)
if index_col == "infer" and len(df.columns) > 1:
is_int_index = all(np.arange(0, len(df)) == df.iloc[:, 0])
is_str_index = isinstance(df.iloc[0, 0], str) and all(
[not isinstance(d, str) for d in df.iloc[0, 1:]]
)
if is_int_index or is_str_index:
df.set_index(df.columns[0], inplace=True)
return df

else:
raise ValueError(
f"'{filename}' does not end on a valid extension.\n"
"Please, provide one of the available extensions.\n"
f"{numpy_ext | pandas_ext}\n"
)


read_csv = load

0 comments on commit d23edc8

Please sign in to comment.