Skip to content

Commit

Permalink
Add pre-commit and implement automatic linting and formatting (#544)
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamJamieson authored Jan 6, 2025
2 parents 4a5fad4 + 877716d commit 4e438c6
Show file tree
Hide file tree
Showing 57 changed files with 4,482 additions and 3,197 deletions.
3 changes: 0 additions & 3 deletions .bandit.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions .flake8

This file was deleted.

4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# automatically requests pull request reviews for files matching the given pattern; the last match takes precendence
# automatically requests pull request reviews for files matching the given pattern; the last match takes precedence

* @spacetelescope/gwcs-maintainers
* @spacetelescope/gwcs-maintainers
1 change: 0 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ updates:
actions:
patterns:
- "*"

1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ jobs:
with:
envs: |
- linux: check-style
- linux: check-security
test:
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@9f1f43251dde69da8613ea8e11144f05cdea41d5 # v1.15.0
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
GALSIM_CAT_PATH: ${{ needs.romanisim_data.outputs.cache_path }}/galsim_data/real_galaxy_catalog_23.5_example.fits
FFTW_DIR: /opt/homebrew/opt/fftw/lib/
cache-path: ${{ needs.romanisim_data.outputs.cache_path }}
cache-key: ${{ needs.romanisim_data.outputs.cache_key }}
cache-key: ${{ needs.romanisim_data.outputs.cache_key }}
envs: |
- linux: py311-test-romanisim-cov-xdist
Expand Down
61 changes: 61 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
ci:
autofix_prs: false

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
args: ["--enforce-all", "--maxkb=300"]
# Prevent giant files from being committed.
- id: check-case-conflict
# Check for files with names that would conflict on a case-insensitive
# filesystem like MacOS HFS+ or Windows FAT.
- id: check-json
# Attempts to load all json files to verify syntax.
- id: check-merge-conflict
# Check for files that contain merge conflict strings.
- id: check-symlinks
# Checks for symlinks which do not point to anything.
- id: check-toml
# Attempts to load all TOML files to verify syntax.
- id: check-xml
# Attempts to load all xml files to verify syntax.
- id: check-yaml
# Attempts to load all yaml files to verify syntax.
- id: detect-private-key
# Checks for the existence of private keys.
- id: end-of-file-fixer
# Makes sure files end in a newline and only a newline.
exclude: ".*(data.*)$"
# - id: fix-encoding-pragma # covered by pyupgrade
- id: trailing-whitespace
# Trims trailing whitespace.
exclude_types: [python] # Covered by Ruff W291.
exclude: ".*(data.*)$"

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-directive-colons
# Detect mistake of rst directive not ending with double colon.
- id: rst-inline-touching-normal
# Detect mistake of inline code touching normal text in rst.
- id: text-unicode-replacement-char
# Forbid files which have a UTF-8 Unicode replacement character.

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
args: ["--write-changes"]
additional_dependencies:
- tomli
exclude: ".*.asdf"

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
- id: ruff-format
13 changes: 9 additions & 4 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
0.22.0 (2024-12-19)
0.23.0 (unreleased)
-------------------

- Coordinate frames now have a "native" order and then are sorted based on ``axes_order``. [#457]
Expand All @@ -11,6 +11,12 @@

- Inputs to ``CelestialFrame``, such as ``axes_names`` are now explicitly in lon, lat order and will re sorted based on ``axes_order=``. [#457]

- Implement code linting and automatic formatting. [#544]


0.22.0 (2024-12-19)
-------------------

- Replace usages of ``copy_arrays`` with ``memmap`` [#503]

- Fix an issue with units in ``wcs_from_points``. [#507]
Expand All @@ -21,7 +27,6 @@

- Add support for compound bounding boxes and ignored bounding box entries. [#519]


- Add ``gwcs.examples`` module, based on the examples located in the testing ``conftest.py``. [#521]

- Force ``bounding_box`` to always be returned as a ``F`` ordered box. [#522]
Expand Down Expand Up @@ -221,7 +226,7 @@ New Features
- Added ``insert_frame`` method to modify the pipeline of a ``WCS`` object. [#299]

- Added ``to_fits_tab`` method to generate FITS header and binary table
extension following FITS WCS ``-TAB`` convension. [#295]
extension following FITS WCS ``-TAB`` convention. [#295]

- Added ``in_image`` function for testing whether a point in world coordinates
maps back to the domain of definition of the forward transformation. [#322]
Expand Down Expand Up @@ -277,7 +282,7 @@ New Features

- Removed astropy-helpers from package. [#249]

- Added a method ``fix_inputs`` which rturns an unique WCS from a compound
- Added a method ``fix_inputs`` which returns an unique WCS from a compound
WCS by fixing inputs. [#254]

- Added two new transforms - ``ToDirectionCosines`` and ``FromDirectionCosines``. [#256]
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Spacetelescope Open Source Code of Conduct

We expect all "spacetelescope" organization projects to adopt a code of conduct that ensures a productive, respectful environment for all open source contributors and participants. We are committed to providing a strong and enforced code of conduct and expect everyone in our community to follow these guidelines when interacting with others in all forums. Our goal is to keep ours a positive, inclusive, successful, and growing community. The community of participants in open source Astronomy projects is made up of members from around the globe with a diverse set of skills, personalities, and experiences. It is through these differences that our community experiences success and continued growth.
We expect all "spacetelescope" organization projects to adopt a code of conduct that ensures a productive, respectful environment for all open source contributors and participants. We are committed to providing a strong and enforced code of conduct and expect everyone in our community to follow these guidelines when interacting with others in all forums. Our goal is to keep ours a positive, inclusive, successful, and growing community. The community of participants in open source Astronomy projects is made up of members from around the globe with a diverse set of skills, personalities, and experiences. It is through these differences that our community experiences success and continued growth.


As members of the community,
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Please open a new issue or new pull request for bugs, feedback, or new features you would like to see. If there is an issue you would like to work on, please leave a comment and we will be happy to assist. New contributions and contributors are very welcome!

New to github or open source projects? If you are unsure about where to start or haven't used github before, please feel free to contact the package maintainers.
New to github or open source projects? If you are unsure about where to start or haven't used github before, please feel free to contact the package maintainers.

Feedback and feature requests? Is there something missing you would like to see? Please open an issue or send an email to the maintainers. This package follows the Spacetelescope [Code of Conduct](CODE_OF_CONDUCT.md) strives to provide a welcoming community to all of our users and contributors.
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ GWCS - Generalized World Coordinate System
.. image:: http://img.shields.io/badge/powered%20by-AstroPy-orange.svg?style=flat
:target: http://www.astropy.org
:alt: Powered by Astropy Badge

.. image:: https://img.shields.io/badge/powered%20by-STScI-blue.svg?colorA=707170&colorB=3e8ddd&style=flat
:target: http://www.stsci.edu
:alt: Powered by STScI Badge
Expand All @@ -37,15 +37,15 @@ Installation

To install::

pip install gwcs
pip install gwcs

To clone from github and install the master branch::

git clone https://github.com/spacetelescope/gwcs.git
cd gwcs
pip install --editable .


Contributing Code, Documentation, or Feedback
---------------------------------------------

Expand Down
Loading

0 comments on commit 4e438c6

Please sign in to comment.