Skip to content

Commit

Permalink
Merge pull request #19 from astronomy-commons/delucchi/copier
Browse files Browse the repository at this point in the history
Re-run copier
  • Loading branch information
delucchi-cmu authored Feb 6, 2023
2 parents a8680c7 + 7c457d1 commit 736c970
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier
_commit: v0.0.3
_commit: v0.0.5
_src_path: gh:lincc-frameworks/python-project-template
author_email: [email protected]
author_name: Melissa DeLucchi
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ jobs:
pip install .
pip install .[dev]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run unit tests with pytest
run: |
python -m pytest --cov=. --cov-report=xml
60 changes: 60 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
repos:

# Clear output from jupyter notebooks so that only the input cells are committed.
- repo: local
hooks:
- id: jupyter-nb-clear-output
name: jupyter-nb-clear-output
description: Clear output from Jupyter notebooks.
files: \.ipynb$
stages: [commit]
language: system
entry: jupyter nbconvert --ClearOutputPreprocessor.enabled=True --inplace

# Run unit tests, verify that they pass
- repo: local
hooks:
- id: pytest-check
name: pytest-check
description: Run unit tests with pytest.
entry: pytest --cov=. --cov-report=html
language: system
pass_filenames: false
always_run: true

# prevents committing directly branches named 'main' and 'master'.
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: no-commit-to-branch
name: Don't commit to main or master branch
description: Prevent the user from committing directly to the primary branch.

# verify that pyproject.toml is well formed
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.12.1
hooks:
- id: validate-pyproject
name: Validate syntax of pyproject.toml
description: Verify that pyproject.toml adheres to the established schema.

# Automatically sort the imports used in .py files
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
description: Sort and organize imports in .py files.

- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
args:
[
"-rn", # Only display messages
"-sn", # Don't display the score
]
1 change: 1 addition & 0 deletions nb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Put your Jupyter notebooks here :)
32 changes: 32 additions & 0 deletions nb/example.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"a = 2 + 2"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "copier_test",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python",
"version": "3.10.8 | packaged by conda-forge | (main, Nov 22 2022, 08:25:29) [Clang 14.0.6 ]"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "49ec39369c99805342b11327ac0d7c4ce794e7071ab73521f56ecad9648013da"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
12 changes: 10 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ dependencies = [
# On a mac, install optional dependencies with `pip install '.[dev]'` (include the single quotes)
[project.optional-dependencies]
dev = [
"pytest",
"pytest-cov",
"pytest",
"pytest-cov", # Used to report total code coverage
"pre-commit", # Used to run checks before finalizing a git commit
"nbconvert", # Needed for pre-commit check to clear output from Python notebooks
"pylint", # Used for static linting of files
]

[metadata]
Expand All @@ -32,3 +35,8 @@ url = "https://github.com/astronomy-commons/hipscat"
[build-system]
requires = ["setuptools","wheel"]
build-backend = "setuptools.build_meta"

[tool.pylint.'MESSAGES CONTROL']
disable = """
missing-module-docstring,
"""
2 changes: 2 additions & 0 deletions src/hipscat/catalog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@

from .catalog import Catalog
from .catalog_parameters import CatalogParameters
from .pixel_node import PixelNode
from .pixel_node_type import PixelNodeType
3 changes: 2 additions & 1 deletion src/hipscat/catalog/catalog_parameters.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Conatiner class for properties of a catalog that is being created"""

import os
from typing import List


class CatalogParameters:
Expand All @@ -9,7 +10,7 @@ class CatalogParameters:
def __init__(
self,
catalog_name=None,
input_paths: list[str] = None,
input_paths: List[str] = None,
input_format="csv",
output_path=None,
highest_healpix_order=10,
Expand Down
2 changes: 1 addition & 1 deletion tests/hipscat/catalog/test_pixel_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,4 @@ def test_get_leaf_descendants_with_root_node(root_pixel_node, leaf_pixel_node):
def test_get_leaf_descendants_with_multiple_leafs(root_pixel_node, leaf_pixel_node, leaf_pixel_node_data):
leaf_pixel_node_data["hp_pixel"] += 1
second_leaf = PixelNode(**leaf_pixel_node_data)
assert root_pixel_node.get_all_leaf_descendants() == [leaf_pixel_node, second_leaf]
assert root_pixel_node.get_all_leaf_descendants() == [leaf_pixel_node, second_leaf] or root_pixel_node.get_all_leaf_descendants() == [second_leaf, leaf_pixel_node]

0 comments on commit 736c970

Please sign in to comment.