Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transition to pyproject.toml #443

Merged
merged 35 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
e3fd536
create pyproject.toml
martinvonk Dec 27, 2022
a323022
add setup files
martinvonk Dec 27, 2022
16cd48b
import version using importlib
martinvonk Dec 27, 2022
c5d1596
handle python < 3.8 for getting version
martinvonk Dec 27, 2022
e4e74db
Delete setup.py
martinvonk Dec 28, 2022
e726de6
Update version.py
martinvonk Dec 28, 2022
7b9cfa8
Update conf.py
martinvonk Dec 28, 2022
52f22cc
Merge branch 'dev' of https://github.com/pastas/pastas into 442-pypro…
martinvonk Dec 28, 2022
bb1d216
make sure __version__ is available
martinvonk Dec 28, 2022
54759e0
get version using importlib
martinvonk Jan 10, 2023
b120431
ignore src folder
martinvonk Jan 10, 2023
a4afde9
add optional dependencies for different usecases
martinvonk Jan 10, 2023
b6d9e6e
Merge branch 'dev' of https://github.com/pastas/pastas into 442-pypro…
martinvonk Jan 10, 2023
0caf2e5
Update __init__.py
martinvonk Jan 10, 2023
f480a3d
Update pyproject.toml
martinvonk Jan 10, 2023
4f646bf
Merge branch 'dev' of https://github.com/pastas/pastas into 442-pypro…
martinvonk Jan 10, 2023
aa2833c
Update conf.py
martinvonk Jan 10, 2023
33910ae
Update pyproject.toml
martinvonk Jan 10, 2023
3d123c5
Update pyproject.toml
martinvonk Jan 10, 2023
19d2124
empty setup.cfg
martinvonk Jan 10, 2023
325ed5d
Update pyproject.toml
martinvonk Jan 10, 2023
f883b9e
Update __init__.py
martinvonk Jan 10, 2023
55f24b8
Update conf.py
martinvonk Jan 10, 2023
623a3ac
Update pyproject.toml
martinvonk Jan 10, 2023
546568f
update readthedocs config
dbrakenhoff Jan 10, 2023
881a2b1
update ci with black formatting check
dbrakenhoff Jan 10, 2023
9f58ed5
black and isort formatting part2
dbrakenhoff Jan 10, 2023
6d6c6e3
update git ignore blame refs
dbrakenhoff Jan 10, 2023
30fcd9f
Merge branch 'dev' into 442-pyprojecttoml
dbrakenhoff Jan 10, 2023
bff87da
black version.py
dbrakenhoff Jan 10, 2023
0a24d36
update rtd, ci workflows with pyproject.toml
dbrakenhoff Jan 11, 2023
cd10e6c
fix toml
dbrakenhoff Jan 11, 2023
24e9fd6
remove requirements.txt files
martinvonk Jan 11, 2023
55e9c0e
move optional deps a bit
dbrakenhoff Jan 11, 2023
07589b9
bump scipy req to >=1.8
dbrakenhoff Jan 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# .git-blame-ignore-revs
# apply isort, black and docformatter to code base
6a9346b581883b4f29982c8ef1102a4b1a102664
6a9346b581883b4f29982c8ef1102a4b1a102664
# apply isort, black, docformatter to submodules in pastas
9f58ed52e0151a525e7ad67e14bfd9217f4aa773
13 changes: 6 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,12 @@ jobs:
pip install codacy-coverage
pip install -e .

- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=80 --statistics

- name: Lint with black
uses: psf/black@stable
with:
options: "--check --verbose"
jupyter: true

- name: Run tests and notebooks
if: ${{ github.event_name == 'pull_request' }}
run: |
Expand Down
6 changes: 4 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ sphinx:
python:
system_packages: true
install:
- requirements: requirements.rtd.txt
- requirements: requirements.ci.txt
- method: pip
path: .
extra_requirements:
- rtd
- ci

124 changes: 63 additions & 61 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,74 +13,72 @@
# serve to show the default.

import os
import re
import sys
from datetime import date

import requests
import re

year = date.today().strftime("%Y")

from matplotlib import use

use('agg')

from pastas.version import __version__
use("agg")

from dataclasses import dataclass, field
import sphinxcontrib.bibtex.plugin

import sphinxcontrib.bibtex.plugin
from sphinxcontrib.bibtex.style.referencing import BracketStyle
from sphinxcontrib.bibtex.style.referencing.author_year \
import AuthorYearReferenceStyle
from sphinxcontrib.bibtex.style.referencing.author_year import AuthorYearReferenceStyle

from pastas.version import __version__

# 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("."))

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

extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.napoleon',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'IPython.sphinxext.ipython_console_highlighting', # lowercase didn't work
'sphinx.ext.autosectionlabel',
'nbsphinx',
'sphinx_gallery.load_style',
'sphinxcontrib.bibtex',
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.napoleon",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
"sphinx.ext.coverage",
"sphinx.ext.mathjax",
"sphinx.ext.ifconfig",
"sphinx.ext.viewcode",
"IPython.sphinxext.ipython_console_highlighting", # lowercase didn't work
"sphinx.ext.autosectionlabel",
"nbsphinx",
"sphinx_gallery.load_style",
"sphinxcontrib.bibtex",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
source_suffix = '.rst'
source_encoding = 'utf-8'
templates_path = ["_templates"]
source_suffix = ".rst"
source_encoding = "utf-8"

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

# General information about the project.
project = u'Pastas'
copyright = u'{}, R.A. Collenteur, M. Bakker, R. Calje, F. Schaars'.format(
year)
author = u'R.A. Collenteur, M. Bakker, R. Calje, F. Schaars'
project = "Pastas"
copyright = "{}, R.A. Collenteur, M. Bakker, R. Calje, F. Schaars".format(year)
author = "R.A. Collenteur, M. Bakker, R. Calje, F. Schaars"

# The version.
version = __version__
release = __version__
language = 'en'
language = "en"

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

# The reST default role (used for this markup: `text`) to use for all
# documents.
Expand All @@ -98,7 +96,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 All @@ -113,18 +111,18 @@

html_theme = "pydata_sphinx_theme"
html_logo = "_static/logo.png"
html_static_path = ['_static']
html_static_path = ["_static"]
html_short_title = "Pastas"
html_favicon = "_static/favo.ico"
html_css_files = ['css/custom.css']
html_css_files = ["css/custom.css"]
html_show_sphinx = True
html_show_copyright = True
htmlhelp_basename = 'Pastasdoc' # Output file base name for HTML help builder.
htmlhelp_basename = "Pastasdoc" # Output file base name for HTML help builder.
html_use_smartypants = True

html_theme_options = {
"github_url": "https://github.com/pastas/pastas",
"use_edit_page_button": False
"use_edit_page_button": False,
}

html_context = {
Expand All @@ -145,7 +143,10 @@

# support Round brackets
def bracket_style() -> BracketStyle:
return BracketStyle(left='(', right=')', )
return BracketStyle(
left="(",
right=")",
)


@dataclass
Expand All @@ -158,48 +159,41 @@ class MyReferenceStyle(AuthorYearReferenceStyle):


sphinxcontrib.bibtex.plugin.register_plugin(
'sphinxcontrib.bibtex.style.referencing',
'author_year_round', MyReferenceStyle)
"sphinxcontrib.bibtex.style.referencing", "author_year_round", MyReferenceStyle
)

# Generate bibliography-files from Zotero library
# Get a Bibtex reference file from the Zotero group for referencing
url = "https://api.zotero.org/groups/4846685/collections/8UG7PVLY/items/"
params = {"format": "bibtex",
"style": "apa",
"limit": 100}
params = {"format": "bibtex", "style": "apa", "limit": 100}

r = requests.get(url=url, params=params)
with open("references.bib", mode="w") as file:
file.write(r.text)

# Get a Bibtex reference file from the Zotero group for publications list
url = "https://api.zotero.org/groups/4846685/collections/Q4F7R59G/items/"
params = {"format": "bibtex",
"style": "apa",
"limit": 100}
params = {"format": "bibtex", "style": "apa", "limit": 100}

r = requests.get(url=url, params=params)
with open("publications.bib", mode="w") as file:
# Replace citation key to prevent duplicate labels and article now shown
text = re.sub(r'(@([a-z]*){)', r'\1X_', r.text)
text = re.sub(r"(@([a-z]*){)", r"\1X_", r.text)
file.write(text)

# Add some settings for bibtex
bibtex_bibfiles = ['references.bib', 'publications.bib']
bibtex_bibfiles = ["references.bib", "publications.bib"]
bibtex_reference_style = "author_year_round"

# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
# 'preamble': '',

# Latex figure (float) alignment
# 'figure_align': 'htbp',
}
Expand All @@ -208,8 +202,13 @@ class MyReferenceStyle(AuthorYearReferenceStyle):
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'Pastas.tex', u'Pastas Documentation',
u'R.A. Collenteur, M. Bakker, R. Calje, F. Schaars', 'manual'),
(
master_doc,
"Pastas.tex",
"Pastas Documentation",
"R.A. Collenteur, M. Bakker, R. Calje, F. Schaars",
"manual",
),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -237,10 +236,7 @@ class MyReferenceStyle(AuthorYearReferenceStyle):

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'pastas', u'Pastas Documentation',
[author], 1)
]
man_pages = [(master_doc, "pastas", "Pastas Documentation", [author], 1)]

# If true, show URL addresses after external links.
# man_show_urls = False
Expand All @@ -252,9 +248,15 @@ class MyReferenceStyle(AuthorYearReferenceStyle):
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'Pastas', u'Pastas Documentation',
author, 'Pastas', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"Pastas",
"Pastas Documentation",
author,
"Pastas",
"One line description of project.",
"Miscellaneous",
),
]

# Example configuration for intersphinx: refer to the Python standard library.
Expand Down