Skip to content

Commit

Permalink
Run automated formatting and linters (spacetelescope#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamJamieson authored Nov 14, 2023
2 parents f629c25 + 108608b commit 36d9d14
Show file tree
Hide file tree
Showing 55 changed files with 3,917 additions and 3,135 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
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/stcal-maintainers
50 changes: 25 additions & 25 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
documentation:
- 'docs/**/*'
- any: [ '*.rst', '!CHANGES.rst' ]
- '*.md'
- '.readthedocs.yaml'
- 'LICENSE'
- "docs/**/*"
- any: ["*.rst", "!CHANGES.rst"]
- "*.md"
- ".readthedocs.yaml"
- "LICENSE"

installation:
- 'pyproject.toml'
- 'setup.*'
- 'requirements-*.txt'
- 'MANIFEST.in'
- "pyproject.toml"
- "setup.*"
- "requirements-*.txt"
- "MANIFEST.in"

# --------------------------------------- testing ---------------------------------------

automation:
- '.github/**'
- '.bandit.yaml'
- '.codecov.yml'
- ".github/**"
- ".bandit.yaml"
- ".codecov.yml"

testing:
- '**/tests/**'
- '.github/workflows/ci*.yml'
- 'conftest.py'
- "**/tests/**"
- ".github/workflows/ci*.yml"
- "conftest.py"

# --------------------------------------- modules ---------------------------------------

dark_current:
- '**/*dark_current*'
- '**/*dark_current*/**'
- "**/*dark_current*"
- "**/*dark_current*/**"

jump:
- '**/*jump*'
- '**/*jump*/**'
- "**/*jump*"
- "**/*jump*/**"

linearity:
- '**/*linearity*'
- '**/*linearity*/**'
- "**/*linearity*"
- "**/*linearity*/**"

ramp_fitting:
- '**/*ramp_fitting*'
- '**/*ramp_fitting*/**'
- "**/*ramp_fitting*"
- "**/*ramp_fitting*/**"

saturation:
- '**/*saturation*'
- '**/*saturation*/**'
- "**/*saturation*"
- "**/*saturation*/**"
6 changes: 5 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
<!-- If this PR closes a JIRA ticket, make sure the title starts with the JIRA issue number,
<!-- If this PR closes a JIRA ticket, make sure the title starts with the JIRA issue number,
for example JP-1234: <Fix a bug> -->

Resolves [JP-nnnn](https://jira.stsci.edu/browse/JP-nnnn)
Resolves [RCAL-nnnn](https://jira.stsci.edu/browse/RCAL-nnnn)

<!-- If this PR closes a GitHub issue, reference it here by its number -->

Closes #

<!-- describe the changes comprising this PR here -->

This PR addresses ...

**Checklist**

- [ ] added entry in `CHANGES.rst` (either in `Bug Fixes` or `Changes to API`)
- [ ] updated relevant tests
- [ ] updated relevant documentation
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: build

on:
release:
types: [ released ]
types: [released]
pull_request:
workflow_dispatch:

Expand All @@ -25,4 +25,3 @@ jobs:
sdist: true
secrets:
pypi_token: ${{ secrets.PYPI_PASSWORD_STSCI_MAINTAINER }}

7 changes: 3 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ on:
push:
branches:
- main
- '*x'
- "*x"
tags:
- '*'
- "*"
pull_request:
branches:
- main
Expand All @@ -24,7 +24,6 @@ jobs:
with:
envs: |
- linux: check-style
- linux: check-security
- linux: check-build
test:
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1
Expand All @@ -43,7 +42,7 @@ jobs:
setenv: |
CRDS_PATH: /tmp/crds_cache
CRDS_CLIENT_RETRY_COUNT: 3
CRDS_CLIENT_RETRY_DELAY_SECONDS: 20
CRDS_CLIENT_RETRY_DELAY_SECONDS: 20
envs: |
- linux: py311-jwst-cov-xdist
- linux: py311-romancal-cov-xdist
2 changes: 1 addition & 1 deletion .github/workflows/label_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ jobs:
- uses: actions/labeler@v4
if: github.event_name == 'pull_request_target' || github.event_name == 'pull_request'
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
repo-token: "${{ secrets.GITHUB_TOKEN }}"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,4 @@ docs/source/api
.DS_Store

# VSCode stuff
.vscode
.vscode
69 changes: 69 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-case-conflict
- id: check-yaml
args: ["--unsafe"]
- id: check-toml
- id: check-merge-conflict
- id: check-symlinks
- id: debug-statements
- id: detect-private-key
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-directive-colons
- id: rst-inline-touching-normal
- id: text-unicode-replacement-char

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

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.1.5"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
- id: ruff-format

- repo: https://github.com/MarcoGorelli/cython-lint
rev: v0.15.0
hooks:
- id: cython-lint
- id: double-quote-cython-strings

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (cython)
types: [cython]

- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies:
- black==22.12.0

- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.1"
hooks:
- id: prettier

- repo: https://github.com/scientific-python/cookie
rev: 2023.10.27
hooks:
- id: sp-repo-review
additional_dependencies: ["repo-review[cli]"]
16 changes: 8 additions & 8 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
1.4.5 (unreleased)
==================

Other
-----

- Added ``alignment`` sub-package. [#179]

- Enable automatic linting and code style checks [#187]

ramp_fitting
------------

Expand All @@ -27,11 +32,6 @@ Bug Fixes

-

Other
-----

-

1.4.4 (2023-09-15)
==================

Expand Down Expand Up @@ -174,7 +174,7 @@ ramp_fitting
- Correct the "averaging" of the final image slope by properly excluding
variances as a part of the denominator from integrations with invalid slopes.
[#167]
- Removing the usage of ``numpy.where`` where possible for perfomance
- Removing the usage of ``numpy.where`` where possible for performance
reasons. [#169]

1.3.7 (2023-04-26)
Expand Down Expand Up @@ -218,7 +218,7 @@ Other
-----

- Remove use of deprecated ``pytest-openfiles`` ``pytest`` plugin. This has been replaced by
catching ``ResourceWarning``s. [#159]
catching ``ResourceWarning``. [#159]


1.3.5 (2023-03-30)
Expand Down Expand Up @@ -566,7 +566,7 @@ ramp_fitting
jump
~~~~

- Fix issue in jump detection that occured when there were only 2 usable
- Fix issue in jump detection that occurred when there were only 2 usable
differences with no other groups flagged. This PR also added tests and
fixed some of the logging statements in twopoint difference. [#74]

Expand Down
1 change: 0 additions & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

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,

- We pledge to treat all people with respect and provide a harassment- and bullying-free environment, regardless of sex, sexual orientation and/or gender identity, disability, physical appearance, body size, race, nationality, ethnicity, and religion. In particular, sexual language and imagery, sexist, racist, or otherwise exclusionary jokes are not appropriate.
Expand Down
33 changes: 16 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,20 @@ STScI Calibration algorithms and tools.

**STCAL requires Python 3.9 or above and a C compiler for dependencies.**

**Linux and MacOS platforms are tested and supported. Windows is not currently supported.**

**If installing on MacOS Mojave 10.14, you must install
into an environment with python 3.9. Installation will fail on python 3.10 due
to lack of a stable build for dependency ``opencv-python``.**
**Linux and MacOS platforms are tested and supported. Windows is not currently supported.**

**If installing on MacOS Mojave 10.14, you must install
into an environment with python 3.9. Installation will fail on python 3.10 due
to lack of a stable build for dependency `opencv-python`.**

`STCAL` is intended to be used as a support package for calibration pipeline
software, such as the `JWST` and `Roman` calibration pipelines. `STCAL` is a
software, such as the `JWST` and `Roman` calibration pipelines. `STCAL` is a
separate package because it is also intended to be software that can be reused
by multiple calibration pipelines. Even though it is intended to be a support
by multiple calibration pipelines. Even though it is intended to be a support
package for calibration pipelines, it can be installed and used as a stand alone
package. This could make usage unwieldy as it is easier to use `STCAL` through
calibration software. The main use case for stand alone installation is for
development purposes, such as bug fixes and feature additions. When installing
package. This could make usage unwieldy as it is easier to use `STCAL` through
calibration software. The main use case for stand alone installation is for
development purposes, such as bug fixes and feature additions. When installing
calibration pipelines that depend on `STCAL` this package automatically gets
installed as a dependency.

Expand All @@ -48,17 +47,18 @@ If desired, you can create multiple environments to allow for switching between
versions of the `stcal` package (e.g. a released version versus the current development version).

In all cases, the installation is generally a 3-step process:
* Create a conda environment
* Activate that environment
* Install the desired version of the `stcal` package into that environment

- Create a conda environment
- Activate that environment
- Install the desired version of the `stcal` package into that environment

Details are given below on how to do this for different types of installations,
including tagged releases and development versions.
Remember that all conda operations must be done from within a bash/zsh shell.

### Installing latest releases

You can install the latest released version via `pip`. From a bash/zsh shell:
You can install the latest released version via `pip`. From a bash/zsh shell:

conda create -n <env_name> python
conda activate <env_name>
Expand Down Expand Up @@ -100,7 +100,7 @@ fork and clone the `stcal` repo:
git clone https://github.com/spacetelescope/stcal
cd stcal

*Note: `python setup.py install` and `python setup.py develop` commands do not work.*
_Note: `python setup.py install` and `python setup.py develop` commands do not work._

Install from your local checked-out copy as an "editable" install:

Expand All @@ -117,7 +117,6 @@ Need other useful packages in your development environment?

pip install ipython jupyter matplotlib pylint ipdb


## Contributions and Feedback

We welcome contributions and feedback on the project. Please follow the
Expand All @@ -131,7 +130,7 @@ at https://github.com/spacetelescope/stcal/issues.

## Unit Tests

Unit tests can be run via `pytest`. Within the top level of your local `stcal` repo checkout:
Unit tests can be run via `pytest`. Within the top level of your local `stcal` repo checkout:

pip install -e ".[test]"
pytest
Expand Down
1 change: 0 additions & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,3 @@ linkcheck:

livehtml:
sphinx-autobuild -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html

4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ def setup(app):

# Read the package's `pyproject.toml` so that we can use relevant
# values here:
with open(REPO_ROOT / "pyproject.toml", "rb") as configuration_file:
with (REPO_ROOT / "pyproject.toml").open("rb") as configuration_file:
conf = tomllib.load(configuration_file)
setup_metadata = conf["project"]

project = setup_metadata["name"]
primary_author = setup_metadata["authors"][0]
author = f'{primary_author["name"]} <{primary_author["email"]}>'
copyright = f'{datetime.now().year}, {primary_author["name"]}'
copyright = f'{datetime.now().year}, {primary_author["name"]}' # noqa: A001

package = importlib.import_module(project)
version = package.__version__.split("-", 1)[0]
Expand Down
Loading

0 comments on commit 36d9d14

Please sign in to comment.