Skip to content

Commit

Permalink
Update to PPT v1.4.3 (#144)
Browse files Browse the repository at this point in the history
* Update to PPT v1.4.3

* Remove duplicate block

* Update docs/guide/contributing.rst

Co-authored-by: Olivia R. Lynn <[email protected]>

---------

Co-authored-by: Olivia R. Lynn <[email protected]>
  • Loading branch information
delucchi-cmu and OliviaLynn authored Oct 11, 2023
1 parent 8d1112f commit f697f2a
Show file tree
Hide file tree
Showing 11 changed files with 126 additions and 42 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: v1.4.2
_commit: v1.4.3
_src_path: gh:lincc-frameworks/python-project-template
author_email: [email protected]
author_name: LINCC Frameworks
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/build-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
pull_request:
branches: [ main ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ on:
pull_request:
branches: [ main ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
python-version: '3.10'
- name: Install dependencies
run: |
sudo apt-get update
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/pre-commit-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This workflow runs pre-commit hooks on pull requests to enforce coding style.
# To ensure correct configuration, please refer to:
# https://lincc-ppt.readthedocs.io/en/latest/practices/ci_precommit.html

name: Run pre-commit hooks

on:
pull_request:

jobs:
pre-commit-ci:
runs-on: ubuntu-latest
env:
SKIP: "check-lincc-frameworks-template-version,pytest-check,no-commit-to-branch,validate-pyproject,check-added-large-files,sphinx-build"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
sudo apt-get update
python -m pip install --upgrade pip
pip install .
pip install .[dev]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- uses: pre-commit/[email protected]
with:
extra_args: --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}
- uses: pre-commit-ci/[email protected]
if: always()
4 changes: 4 additions & 0 deletions .github/workflows/type-checking.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
pull_request:
branches: [ main ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,7 @@ tmp/

# Mac OS
.DS_Store

# Airspeed Velocity performance results
_results/
_html/
50 changes: 27 additions & 23 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
fail_fast: true
repos:

# Compare the local template version to the latest remote template version
Expand All @@ -22,22 +23,7 @@ repos:
language: system
entry: jupyter nbconvert --clear-output

# Run unit tests, verify that they pass. Note that coverage is run against
# the ./src directory here because that is what will be committed. In the
# github workflow script, the coverage is run against the installed package
# and uploaded to Codecov by calling pytest like so:
# `python -m pytest --cov=<package_name> --cov-report=xml`
- repo: local
hooks:
- id: pytest-check
name: Run unit tests
description: Run unit tests with pytest.
entry: bash -c "if python -m pytest --co -qq; then python -m pytest --cov=./src --cov-report=html; fi"
language: system
pass_filenames: false
always_run: true

# prevents committing directly branches named 'main' and 'master'.
# Prevents committing directly branches named 'main' and 'master'.
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
Expand All @@ -49,23 +35,24 @@ repos:
description: Prevent the user from committing very large files.
args: ['--maxkb=500']

# verify that pyproject.toml is well formed
# Verify that pyproject.toml is well formed
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.12.1
hooks:
- id: validate-pyproject
name: Validate 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 files in src/ and tests/)
description: Sort and organize imports in .py files.
types: [python]
files: ^(src|tests)/
name: Run isort
description: Sort and organize imports in .py and .pyi files.
types_or: [python, pyi]



# Analyze the src code style and report code that doesn't adhere.
Expand All @@ -83,15 +70,16 @@ repos:
"-sn", # Don't display the score
"--rcfile=src/.pylintrc",
]

# Analyze the tests code style and report code that doesn't adhere.
- repo: local
hooks:
- id: pylint
name: pylint (python files in tests/)
name: pylint (python files in tests/ and benchmarks/)
entry: pylint
language: system
types: [python]
files: ^tests/
files: ^(tests|benchmarks)/
args:
[
"-rn", # Only display messages
Expand All @@ -100,6 +88,7 @@ repos:
]



# Analyze type hints and report errors.
- repo: local
hooks:
Expand All @@ -116,6 +105,21 @@ repos:

]


# Run unit tests, verify that they pass. Note that coverage is run against
# the ./src directory here because that is what will be committed. In the
# github workflow script, the coverage is run against the installed package
# and uploaded to Codecov by calling pytest like so:
# `python -m pytest --cov=<package_name> --cov-report=xml`
- repo: local
hooks:
- id: pytest-check
name: Run unit tests
description: Run unit tests with pytest.
entry: bash -c "if python -m pytest --co -qq; then python -m pytest --cov=./src --cov-report=html; fi"
language: system
pass_filenames: false
always_run: true
# Make sure Sphinx can build the documentation while explicitly omitting
# notebooks from the docs, so users don't have to wait through the execution
# of each notebook or each commit. By default, these will be checked in the
Expand Down
34 changes: 30 additions & 4 deletions docs/guide/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,39 @@ branches and tickets, but it's nice when it's in the name.
Setting up a development environment
-------------------------------------------------------------------------------

Most folks use conda for virtual environments. You may want to as well.
Before installing any dependencies or writing code, it's a great idea to create a
virtual environment. LINCC-Frameworks engineers primarily use `conda` to manage virtual
environments. If you have conda installed locally, you can run the following to
create and activate a new environment.

.. code-block:: bash
$ git clone https://github.com/astronomy-commons/hipscat-import
$ cd hipscat-import
$ pip install -e .
>> conda create env -n <env_name> python=3.10
>> conda activate <env_name>
Once you have created a new environment, you can install this project for local
development using the following commands:

.. code-block:: bash
>> pip install -e .'[dev]'
>> pre-commit install
>> conda install pandoc
Notes:

1) The single quotes around ``'[dev]'`` may not be required for your operating system.
2) ``pre-commit install`` will initialize pre-commit for this local repository, so
that a set of tests will be run prior to completing a local commit. For more
information, see the Python Project Template documentation on
`pre-commit <https://lincc-ppt.readthedocs.io/en/latest/practices/precommit.html>`_.
3) Installing ``pandoc`` allows you to verify that automatic rendering of Jupyter notebooks
into documentation for ReadTheDocs works as expected. For more information, see
the Python Project Template documentation on
`Sphinx and Python Notebooks <https://lincc-ppt.readthedocs.io/en/latest/practices/sphinx.html#python-notebooks>`_.


.. tip::
Installing on Mac
Expand Down
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,10 @@ target-version = ["py38"]

[tool.isort]
profile = "black"
line_length = 110
line_length = 110

[tool.coverage.run]
omit = [
"src/hipscat_import/_version.py", # auto-generated
"src/hipscat_import/pipeline.py", # too annoying to test
]
9 changes: 5 additions & 4 deletions src/.pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ good-names=i,
k,
ex,
Run,
ra,
_

# Good variable names regexes, separated by a comma. If names match any regex,
Expand Down Expand Up @@ -277,16 +278,16 @@ exclude-too-few-public-methods=
ignored-parents=

# Maximum number of arguments for function / method.
max-args=5
max-args=10

# Maximum number of attributes for a class (see R0902).
max-attributes=7
max-attributes=20

# Maximum number of boolean expressions in an if statement (see R0916).
max-bool-expr=5

# Maximum number of branch for function / method body.
max-branches=15
max-branches=20

# Maximum number of locals for function / method body.
max-locals=25
Expand Down Expand Up @@ -501,7 +502,7 @@ ignore-imports=yes
ignore-signatures=yes

# Minimum lines number of a similarity.
min-similarity-lines=4
min-similarity-lines=6


[SPELLING]
Expand Down
7 changes: 4 additions & 3 deletions tests/.pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ good-names=i,
k,
ex,
Run,
ra,
_

# Good variable names regexes, separated by a comma. If names match any regex,
Expand Down Expand Up @@ -280,16 +281,16 @@ ignored-parents=
max-args=10

# Maximum number of attributes for a class (see R0902).
max-attributes=7
max-attributes=20

# Maximum number of boolean expressions in an if statement (see R0916).
max-bool-expr=5

# Maximum number of branch for function / method body.
max-branches=12
max-branches=20

# Maximum number of locals for function / method body.
max-locals=15
max-locals=30

# Maximum number of parents for a class (see R0901).
max-parents=7
Expand Down

0 comments on commit f697f2a

Please sign in to comment.