Skip to content

Commit

Permalink
Format (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
flying-sheep authored Aug 29, 2024
1 parent ec7de24 commit 8a52380
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 87 deletions.
11 changes: 8 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ repos:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "2.2.1"
hooks:
- id: prettier
- id: pyproject-fmt
- repo: https://github.com/biomejs/pre-commit
rev: v0.4.0
hooks:
- id: biome-format
additional_dependencies: ["@biomejs/[email protected]"]
7 changes: 0 additions & 7 deletions .prettierrc.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"configurations": [
{
"name": "Python: Debug Tests",
"type": "python",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"purpose": ["debug-test"],
Expand Down
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"[json][jsonc]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "biomejs.biome",
},
"[python]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "charliermarsh.ruff",
Expand Down
21 changes: 21 additions & 0 deletions biome.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"formatter": {
"indentStyle": "space",
"indentWidth": 4,
},
"overrides": [
{
"include": ["./.vscode/*.json", "**/*.jsonc"],
"json": {
"formatter": {
"trailingCommas": "all",
},
"parser": {
"allowComments": true,
"allowTrailingCommas": true,
},
},
},
],
}
154 changes: 78 additions & 76 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,104 +1,106 @@
[build-system]
build-backend = "hatchling.build"
requires = [ "hatch-vcs", "hatchling" ]

[project]
name = 'anndata2ri'
name = "anndata2ri"
readme = "README.rst"
authors = [
{ name = 'Philipp A.', email = '[email protected]' },
{ name = "Philipp A.", email = "[email protected]" },
]
readme = 'README.rst'
requires-python = ">=3.9"
classifiers = [
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'Programming Language :: Python :: 3',
'Programming Language :: R',
'Topic :: Scientific/Engineering :: Bio-Informatics',
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: R",
"Topic :: Scientific/Engineering :: Bio-Informatics",
]
urls.'Documentation' = 'https://icb-anndata2ri.readthedocs-hosted.com/'
urls.'Source Code' = 'https://github.com/theislab/anndata2ri'
urls.'Issue Tracker' = 'https://github.com/theislab/anndata2ri/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc'
dynamic = ['version']
requires-python = '>= 3.9'
dynamic = [ "version" ]
dependencies = [
'rpy2 >= 3.5.2', # first with get_conversion
'tzlocal', # for pandas2ri
'anndata',
"anndata",
"rpy2>=3.5.2", # first with get_conversion
"tzlocal", # for pandas2ri
]

[project.optional-dependencies]
dev = ['pre-commit', 'setuptools-scm']
test = [
'pytest',
'pytest-faulthandler',
'pygments',
'scanpy',
optional-dependencies.dev = [ "pre-commit", "setuptools-scm" ]
optional-dependencies.doc = [
"lxml", # For scraping the R link info
"scanpydoc[theme,typehints]",
"sphinx>=3",
]
doc = [
'sphinx>=3.0',
'scanpydoc[theme,typehints]',
'lxml', # For scraping the R link info
optional-dependencies.test = [
"pygments",
"pytest",
"pytest-faulthandler",
"scanpy",
]
urls.'Documentation' = "https://icb-anndata2ri.readthedocs-hosted.com/"
urls.'Issue Tracker' = "https://github.com/theislab/anndata2ri/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc"
urls.'Source Code' = "https://github.com/theislab/anndata2ri"

[tool.hatch.version]
source = 'vcs'
raw-options = { local_scheme = 'no-local-version' } # be able to publish dev version
source = "vcs"
raw-options = { local_scheme = "no-local-version" } # be able to publish dev version

[tool.hatch.build.hooks.vcs]
version-file = 'src/anndata2ri/_version.py'
version-file = "src/anndata2ri/_version.py"

[tool.hatch.envs.default]
installer = 'uv'
installer = "uv"

[tool.hatch.envs.docs]
features = ['doc']
features = [ "doc" ]
[tool.hatch.envs.docs.scripts]
build = 'sphinx-build -M html docs docs/_build'
build = "sphinx-build -M html docs docs/_build"

[tool.hatch.envs.hatch-test]
features = ['test']

[tool.pytest.ini_options]
addopts = [
'--import-mode=importlib',
'-panndata2ri.test_utils',
'-Werror',
]
features = [ "test" ]

[tool.ruff]
line-length = 120
[tool.ruff.lint]
select = ['ALL']
ignore = [
'Q', # handled by formatter
'ANN101', # self type doesn’t need to be annotated
'C408', # dict() calls are nice
'COM812', # trailing commas handled by black
'D203', # prefer 0 to 1 blank line before class members
'D213', # prefer docstring summary on first line
'FIX002', # “TODO” comments
'PLR0913', # having many (kw)args is fine
'S101', # asserts are fine
format.quote-style = "single"
lint.select = [ "ALL" ]
lint.ignore = [
"ANN101", # self type doesn’t need to be annotated
"C408", # dict() calls are nice
"COM812", # trailing commas handled by black
"D203", # prefer 0 to 1 blank line before class members
"D213", # prefer docstring summary on first line
"FIX002", # “TODO” comments
"PLR0913", # having many (kw)args is fine
"Q", # handled by formatter
"S101", # asserts are fine
]
allowed-confusables = ['', '×']
[tool.ruff.lint.per-file-ignores]
'**/*.ipynb' = [
'T201', # Allow print in notebooks
'F821', # `%%R -o` means that ruff doesn’t understand which variables exist
lint.per-file-ignores.'**/*.ipynb' = [
"F821", # `%%R -o` means that ruff doesn’t understand which variables exist
"T201", # Allow print in notebooks
]
'src/**/*.py' = ['PT'] # No Pytest checks
'docs/**/*.py' = ['INP001'] # No __init__.py in docs
'tests/**/*.py' = [
'INP001', # No __init__.py in tests
'D100', # test modules don’t need docstrings
'D103', # tests don’t need docstrings
'PD901', # “df” is a fine var name in tests
'PLR2004', # magic numbers are fine in tests
lint.per-file-ignores.'docs/**/*.py' = [ "INP001" ] # No __init__.py in docs
lint.per-file-ignores.'src/**/*.py' = [ "PT" ] # No Pytest checks
lint.per-file-ignores.'tests/**/*.py' = [
"D100", # test modules don’t need docstrings
"D103", # tests don’t need docstrings
"INP001", # No __init__.py in tests
"PD901", # “df” is a fine var name in tests
"PLR2004", # magic numbers are fine in tests
]
[tool.ruff.lint.isort]
known-first-party = ['anndata2ri']
lines-after-imports = 2
[tool.ruff.format]
quote-style = 'single'
lint.allowed-confusables = [ "×", "" ]
lint.isort.known-first-party = [ "anndata2ri" ]
lint.isort.lines-after-imports = 2

[build-system]
requires = ['hatchling', 'hatch-vcs']
build-backend = 'hatchling.build'
[tool.pyproject-fmt]
indent = 4

[tool.pytest.ini_options]
addopts = [
"--import-mode=importlib",
"-panndata2ri.test_utils",
"-Werror",
]

0 comments on commit 8a52380

Please sign in to comment.