Skip to content

Commit

Permalink
Merge pull request #1 from quadbio/update_paths
Browse files Browse the repository at this point in the history
Set up mini package
  • Loading branch information
Marius1311 authored Apr 24, 2024
2 parents 585c541 + 3c20337 commit 2ff4085
Show file tree
Hide file tree
Showing 16 changed files with 303 additions and 6 deletions.
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[makefile]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = tab
indent_size = 4
39 changes: 39 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: Bug report
about: Create a report to help us improve
title: ""
labels: bug
assignees: ""
---

<!-- Describe the bug -->

## Description

[TEXT HERE]

<!-- To reproduce -->

```python
# Your code here
```

<!-- Put your Error output in this code block (if applicable, else delete the block): -->

<details> <summary> Error output </summary>

```pytb
# Paste the error output here, if applicable
```

</details>

## Versions

<details> <summary> Versions </summary>

```pytb
# Paste the ouput of tradeseq.__version__ and all relevant versions here
```

</details>
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
title: ""
labels: enhancement
assignees: ""
---

## Description

**Is your feature request related to a problem? Please describe.**

<!-- A clear and concise description of what the problem is. For example: I need to do [...] which is not possible because [...]. -->

**Describe the solution you are looking for.**

<!-- A clear and concise description of what you want to happen. -->
23 changes: 23 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Changes

<!-- Please remove section if this PR does change an existing feature -->

- ...

## Bug fixes

<!-- Please give section if this PR does not fix any bugs -->

- ...

## New

<!-- Please give section if this PR does not implement a new feature -->

- ...

## Related issues

<!-- Please list related issues. If none exist, open one and reference it here. -->

Closes #
23 changes: 23 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Lint

on:
push:
branches: main
pull_request:
branches: main

jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pre-commit
- name: Check pre-commit compatibility
run: pre-commit run --all-files --show-diff-on-failure
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,5 @@ figures/

# R stuff
*.Rhistory

.vscode/*
54 changes: 54 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
fail_fast: false
default_language_version:
python: python3
default_stages:
- commit
- push
minimum_pre_commit_version: 2.16.0
repos:
- repo: https://github.com/psf/black
rev: "23.1.0"
hooks:
- id: black-jupyter
- repo: https://github.com/asottile/blacken-docs
rev: 1.13.0
hooks:
- id: blacken-docs
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.4
hooks:
- id: prettier
# Newer versions of node don't work on systems that have an older version of GLIBC
# (in particular Ubuntu 18.04 and Centos 7)
# EOL of Centos 7 is in 2024-06, we can probably get rid of this then.
# See https://github.com/scverse/cookiecutter-scverse/issues/143 and
# https://github.com/jupyterlab/jupyterlab/issues/12675
language_version: "17.9.1"
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.253
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: detect-private-key
- id: check-ast
- id: end-of-file-fixer
- id: mixed-line-ending
args: [--fix=lf]
- id: trailing-whitespace
- id: check-case-conflict
- repo: local
hooks:
- id: forbid-to-commit
name: Don't commit rej files
entry: |
Cannot commit .rej files. These indicate merge conflicts that arise during automated template updates.
Fix the merge conflicts manually and remove the .rej files.
language: fail
files: '.*\.rej$'
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Analysis template repository
This contains the raw structure I usually use when doing single-cell/spatial data analysis.

This contains the raw structure I usually use when doing single-cell/spatial data analysis.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"source": [
"# import standard packages\n",
"import numpy as np\n",
"import pandas as pd \n",
"import pandas as pd\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import seaborn as sns\n",
Expand Down
Empty file removed data/.gitkeep
Empty file.
114 changes: 114 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
[build-system]
requires = ['setuptools', 'setuptools_scm']
build-backend = 'setuptools.build_meta'

[project]
name = "fancypackage"
version = "0.0.0"
description = "Fancy Package"
readme = "README.md"
requires-python = ">=3.10"
license = {file = "LICENSE"}
authors = [
{name = "Jane Doe"},
]
maintainers = [
{name = "Jane Doe", email = "[email protected]"},
]
urls.Source = "https://github.com/url/to/repo.git"
urls.Home-page = "https://github.com/url/to/repo.git"
dependencies = [
"anndata",
"scanpy",
]

[project.optional-dependencies]
dev = [
"pre-commit",
]

[tool.black]
line-length = 120
include = '\.pyi?$|\.ipynb?$'
exclude = '''
(
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
)
'''

[tool.isort]
profile = "black"
use_parentheses = true
known_num = "networkx,numpy,pandas,scipy,sklearn,statmodels"
known_plot = "matplotlib,mplscience,mpl_toolkits,seaborn"
known_bio = "anndata,scanpy"
sections = "FUTURE,STDLIB,THIRDPARTY,NUM,PLOT,BIO,FIRSTPARTY,LOCALFOLDER"
no_lines_before = "LOCALFOLDER"
balanced_wrapping = true
length_sort = "0"
indent = " "
float_to_top = true
order_by_type = false

[tool.ruff]
src = ["."]
line-length = 119
target-version = "py38"
select = [
"F", # Errors detected by Pyflakes
"E", # Error detected by Pycodestyle
"W", # Warning detected by Pycodestyle
"D", # pydocstyle
"B", # flake8-bugbear
"TID", # flake8-tidy-imports
"C4", # flake8-comprehensions
"BLE", # flake8-blind-except
"UP", # pyupgrade
"RUF100", # Report unused noqa directives
]
ignore = [
# line too long -> we accept long comment lines; black gets rid of long code lines
"E501",
# Do not assign a lambda expression, use a def -> lambda expression assignments are convenient
"E731",
# allow I, O, l as variable names -> I is the identity matrix
"E741",
# Missing docstring in public package
"D104",
# Missing docstring in public module
"D100",
# Missing docstring in __init__
"D107",
# Errors from function calls in argument defaults. These are fine when the result is immutable.
"B008",
# __magic__ methods are are often self-explanatory, allow missing docstrings
"D105",
# first line should end with a period [Bug: doesn't work with single-line docstrings]
"D400",
# First line should be in imperative mood; try rephrasing
"D401",
## Disable one in each pair of mutually incompatible rules
# We don’t want a blank line before a class docstring
"D203",
# We want docstrings to start immediately after the opening triple quote
"D213",
# Missing argument description in the docstring TODO: enable
"D417",
# Unable to detect undefined names
"F403",
# Underfined, or defined from star imports: module
"F405",
# Within an except clause, raise exceptions with `raise ... from err`
"B904",
]
3 changes: 3 additions & 0 deletions src/fancypackage/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .core import DATA_DIR, FIG_DIR

__all__ = ["DATA_DIR", "FIG_DIR"]
3 changes: 3 additions & 0 deletions src/fancypackage/core/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from ._constants import DATA_DIR, FIG_DIR

__all__ = ["DATA_DIR", "FIG_DIR"]
4 changes: 1 addition & 3 deletions paths.py → src/fancypackage/core/_constants.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from pathlib import Path

ROOT = Path(__file__).parent.resolve()
ROOT = Path(__file__).parents[3].resolve()


DATA_DIR = ROOT / "data"
FIG_DIR = ROOT / "figures"
CODE_DIR = ROOT / "src"

Empty file removed src/utils/.gitkeep
Empty file.

0 comments on commit 2ff4085

Please sign in to comment.