Skip to content

Commit

Permalink
Merge pull request #14 from PFLeget/dev/pleget/run_black
Browse files Browse the repository at this point in the history
Run Black and add it to actions workflow
  • Loading branch information
PFLeget authored Dec 3, 2023
2 parents 313252e + 10876d1 commit 776845e
Show file tree
Hide file tree
Showing 15 changed files with 761 additions and 527 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/test_treegp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ jobs:
pip install pytest-codecov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install Black
run: pip install black

- name: Check code formatting with Black
run: black --check .

- name: Install treegp
run: |
python setup.py install
Expand Down
58 changes: 30 additions & 28 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,30 @@
extensions = []

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

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ".rst"

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

# General information about the project.
project = u'treegp'
copyright = u'2021, Pierre-Francois Leget'
author = u'Pierre-Francois Leget'
project = "treegp"
copyright = "2021, Pierre-Francois Leget"
author = "Pierre-Francois Leget"

# 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 = u'0.5.0'
version = "0.5.0"
# The full version, including alpha/beta/rc tags.
release = u''
release = ""

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand All @@ -68,10 +68,10 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

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

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
Expand All @@ -82,7 +82,7 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
#html_theme = 'alabaster'
# html_theme = 'alabaster'
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

Expand All @@ -95,13 +95,13 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]


# -- Options for HTMLHelp output ------------------------------------------

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


# -- Options for LaTeX output ---------------------------------------------
Expand All @@ -110,15 +110,12 @@
# 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 @@ -128,19 +125,21 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'treegp.tex', u'treegp Documentation',
u'Pierre-Francois Leget', 'manual'),
(
master_doc,
"treegp.tex",
"treegp Documentation",
"Pierre-Francois Leget",
"manual",
),
]


# -- Options for manual page output ---------------------------------------

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


# -- Options for Texinfo output -------------------------------------------
Expand All @@ -149,10 +148,13 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'treegp', u'treegp Documentation',
author, 'treegp', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"treegp",
"treegp Documentation",
author,
"treegp",
"One line description of project.",
"Miscellaneous",
),
]



55 changes: 33 additions & 22 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
from setuptools import setup, find_packages

# Print some useful information in case there are problems, this info will help troubleshoot.
print("Using setuptools version",setuptools.__version__)
print("Python version = ",sys.version)
print("Using setuptools version", setuptools.__version__)
print("Python version = ", sys.version)

with open('README.rst') as f:
with open("README.rst") as f:
long_description = f.read()

# Read in the version from treegp/_version.py
# cf. http://stackoverflow.com/questions/458550/standard-way-to-embed-version-into-python-package
version_file = os.path.join('treegp', '_version.py')
version_file = os.path.join("treegp", "_version.py")
with open(version_file, "rt") as f:
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
txt = f.read()
Expand All @@ -31,7 +31,7 @@
print("treegp version is %s" % (treegp_version))

# Package name
name = 'treegp'
name = "treegp"

# Packages
packages = find_packages()
Expand All @@ -40,25 +40,36 @@
scripts = glob.glob("scripts/*.py")

# Dependencies
dependencies = ['numpy', 'scipy', 'treecorr>=4.2', 'fitsio>=0.9.12', 'scikit-learn>=0.18']
if sys.version >= '3.0':
dependencies += ['iminuit>2']
dependencies = [
"numpy",
"scipy",
"treecorr>=4.2",
"fitsio>=0.9.12",
"scikit-learn>=0.18",
]
if sys.version >= "3.0":
dependencies += ["iminuit>2"]
else:
# iminuit 1.4 fails on python 2.7
dependencies += ['iminuit>=1.3,<1.4']
dependencies += ["iminuit>=1.3,<1.4"]

package_data = {}

setup(name=name,
description="treegp",
long_description=long_description,
license = "BSD License",
classifiers=["Topic :: Scientific/Engineering :: Astronomy",
"Intended Audience :: Science/Research"],
author="PFLeget",
url="https://github.com/PFLeget/treegp",
download_url="https://github.com/PFLeget/treegp/releases/tag/v%s.zip"%treegp_version,
install_requires=dependencies,
version=treegp_version,
packages=packages,
scripts=scripts)
setup(
name=name,
description="treegp",
long_description=long_description,
license="BSD License",
classifiers=[
"Topic :: Scientific/Engineering :: Astronomy",
"Intended Audience :: Science/Research",
],
author="PFLeget",
url="https://github.com/PFLeget/treegp",
download_url="https://github.com/PFLeget/treegp/releases/tag/v%s.zip"
% treegp_version,
install_requires=dependencies,
version=treegp_version,
packages=packages,
scripts=scripts,
)
Loading

0 comments on commit 776845e

Please sign in to comment.