Skip to content

Commit

Permalink
Merge pull request #169 from adybbroe/switch-to-pyproject-toml
Browse files Browse the repository at this point in the history
  • Loading branch information
djhoese authored Nov 21, 2024
2 parents 19f444b + e27a1d4 commit 9700076
Show file tree
Hide file tree
Showing 34 changed files with 883 additions and 3,647 deletions.
3 changes: 3 additions & 0 deletions .bandit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[bandit]
skips: B506
exclude: pyorbital/tests
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
```
#### Problem description

[this should also explain **why** the current behaviour is a problem and why the
[this should also explain **why** the current behaviour is a problem and why the
expected output is a better solution.]

#### Expected Output
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-sdist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.pypi_password }}
password: ${{ secrets.pypi_password }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ nosetests.xml

# rope
.ropeproject

pyorbital/version.py
42 changes: 38 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,42 @@
exclude: '^$'
fail_fast: false
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: 'v0.7.2'
hooks:
- id: flake8
additional_dependencies: [flake8-docstrings, flake8-debugger, flake8-bugbear]
- id: ruff
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
exclude: pyorbital/tests/SGP4-VER.TLE
- id: end-of-file-fixer
- id: check-yaml
args: [--unsafe]
- repo: https://github.com/PyCQA/bandit
rev: '1.7.10' # Update me!
hooks:
- id: bandit
args: [--ini, .bandit]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.13.0' # Use the sha / tag you want to point at
hooks:
- id: mypy
additional_dependencies:
- types-docutils
- types-setuptools
- types-PyYAML
- types-requests
- types-pytz
args: ["--python-version", "3.10", "--ignore-missing-imports"]
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
language_version: python3
ci:
# To trigger manually, comment on a pull request with "pre-commit.ci autofix"
autofix_prs: false
autoupdate_schedule: "monthly"
skip: [bandit]
4 changes: 0 additions & 4 deletions .stickler.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ In this release 5 pull requests were closed.
### Issues Closed

* [Issue 63](https://github.com/pytroll/pyorbital/issues/63) - Runtime error in get_next_passes ([PR 64](https://github.com/pytroll/pyorbital/pull/64))
* [Issue 62](https://github.com/pytroll/pyorbital/issues/62) - can this tool run
* [Issue 62](https://github.com/pytroll/pyorbital/issues/62) - can this tool run
* [Issue 22](https://github.com/pytroll/pyorbital/issues/22) - get_next_passes returns max-elevation-time time not between rise & fall time ([PR 76](https://github.com/pytroll/pyorbital/pull/76))

In this release 3 issues were closed.
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ This is the Pyorbital, a Python package for computing orbital parameters from TL
files, and making various astronomical computations.

It is part of the Pytroll project: http://pytroll.org

3 changes: 0 additions & 3 deletions changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,3 @@ v0.1.0 (2011-10-03)
- Cleanup of astronomy file. [Martin Raspaud]
- Added a readme file. [Martin Raspaud]
- Added astronomy.py file. [Martin Raspaud]



1 change: 1 addition & 0 deletions continuous_integration/environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dependencies:
- pytest
- pytest-cov
- fsspec
- defusedxml
- pip
- pip:
- trollsift
39 changes: 21 additions & 18 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@
# serve to show the default.
"""Configurations for sphinx based documentation."""

import sys
import datetime as dt
import os
import sys

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.

sys.path.insert(0, os.path.abspath('../../'))
sys.path.insert(0, os.path.abspath('../../pyorbital'))
from pyorbital import __version__ # noqa
sys.path.insert(0, os.path.abspath("../../"))
sys.path.insert(0, os.path.abspath("../../pyorbital"))
from pyorbital.version import __version__ # noqa

# -- General configuration -----------------------------------------------------

Expand All @@ -30,30 +31,32 @@

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.coverage', 'sphinx.ext.napoleon']
extensions = ["sphinx.ext.autodoc", "sphinx.ext.doctest", "sphinx.ext.coverage", "sphinx.ext.napoleon"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['.templates']
templates_path = [".templates"]

# The suffix of source filenames.
source_suffix = '.rst'
source_suffix = ".rst"

# The encoding of source files.
# #source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = u'pyorbital'
copyright = u'2012-2023, The Pytroll crew'
project = u"pyorbital"
copyright = u"2012, 2024-{}, The PyTroll Team".format(dt.datetime.utcnow().strftime("%Y")) # noqa: A001



# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = __version__.split('+')[0]
version = __version__.split("+")[0]
# The full version, including alpha/beta/rc tags.
release = __version__

Expand All @@ -69,7 +72,7 @@

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = []
# exclude_patterns = []

# The reST default role (used for this markup: `text`) to use for all documents.
# #default_role = None
Expand All @@ -86,7 +89,7 @@
# show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# A list of ignored prefixes for module index sorting.
# #modindex_common_prefix = []
Expand Down Expand Up @@ -180,7 +183,7 @@
# #html_file_suffix = None

# Output file base name for HTML help builder.
htmlhelp_basename = 'pyorbitaldoc'
htmlhelp_basename = "pyorbitaldoc"


# -- Options for LaTeX output --------------------------------------------------
Expand All @@ -194,8 +197,8 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'pyorbital.tex', u'pyorbital Documentation',
u'The Pytroll crew', 'manual'),
("index", "pyorbital.tex", u"pyorbital Documentation",
u"The Pytroll crew", "manual"),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -227,6 +230,6 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'pyorbital', u'pyorbital Documentation',
[u'The Pytroll crew'], 1)
("index", "pyorbital", u"pyorbital Documentation",
[u"The Pytroll crew"], 1)
]
4 changes: 2 additions & 2 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ the conda-forge conda channel. To install from PyPI in an existing environment:
.. code-block:: bash
pip install pyorbital
Or in an existing conda-based environment:

.. code-block:: bash
Expand All @@ -31,7 +31,7 @@ from the latest in-development version on GitHub you can run:
.. code-block:: bash
pip install git+https://github.com/pytroll/pyorbital.git
However, if you instead want to edit the source code and see the changes reflected
when you run the code you can clone the git repository and install it in
"editable" mode:
Expand Down
16 changes: 7 additions & 9 deletions pyorbital/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# -*- coding: utf-8 -*-

# Copyright (c) 2017

# Author(s):

# Martin Raspaud <[email protected]>
# Copyright (c) 2017-2024 Pytroll Community

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -19,14 +15,16 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

"""Package file."""

import numpy as np
from .version import get_versions
__version__ = get_versions()['version']
del get_versions

from pyorbital.version import __version__ # noqa


def dt2np(utc_time):
"""Convert datetime to numpy datetime64 object."""
try:
return np.datetime64(utc_time)
except ValueError:
return utc_time.astype('datetime64[ns]')
return utc_time.astype("datetime64[ns]")
Loading

0 comments on commit 9700076

Please sign in to comment.