Skip to content
Snippets Groups Projects
Unverified Commit d988a63e authored by Chris Holdgraf's avatar Chris Holdgraf Committed by GitHub
Browse files

:wrench: MAINTAIN: Move to flit for PEP 621 package builds (#1645)

parent abf11838
No related branches found
No related tags found
No related merge requests found
...@@ -194,15 +194,16 @@ jobs: ...@@ -194,15 +194,16 @@ jobs:
- name: Checkout source - name: Checkout source
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Set up Python 3.8 - name: Set up Python 3.8
uses: actions/setup-python@v1 uses: actions/setup-python@v2
with: with:
python-version: 3.8 python-version: 3.8
- name: Build package - name: Install flit
run: | run: |
pip install wheel pip install flit~=3.6
python setup.py sdist bdist_wheel
- name: Publish - name: Build and publish
uses: pypa/gh-action-pypi-publish@v1.1.0 run: |
with: flit publish
user: __token__ env:
password: ${{ secrets.PYPI_KEY }} FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.PYPI_KEY }}
...@@ -19,28 +19,16 @@ repos: ...@@ -19,28 +19,16 @@ repos:
- id: end-of-file-fixer - id: end-of-file-fixer
- id: trailing-whitespace - id: trailing-whitespace
# this is not used for now,
# since it converts jupyter-book to jupyter_book and removes comments
# - repo: https://github.com/asottile/setup-cfg-fmt
# rev: v1.17.0
# hooks:
# - id: setup-cfg-fmt
- repo: https://github.com/mgedmin/check-manifest
rev: "0.47"
hooks:
- id: check-manifest
args: [--no-build-isolation]
additional_dependencies: [setuptools>=46.4.0]
- repo: local - repo: local
hooks: hooks:
- id: check-doc-req - id: check-doc-req
name: Check docs/requirements.txt up-to-date name: Check docs/requirements.txt up-to-date
pass_filenames: false pass_filenames: false
additional_dependencies:
- tomli
files: >- files: >-
(?x)^( (?x)^(
setup.cfg| pyproject.toml|
docs/requirements.txt| docs/requirements.txt|
scripts/check_doc_requirements.py| scripts/check_doc_requirements.py|
)$ )$
......
exclude docs
recursive-exclude docs *
exclude tests
recursive-exclude tests *
exclude .binder
recursive-exclude .binder *
exclude .github
recursive-exclude .github *
exclude .circleci
recursive-exclude .circleci *
exclude scripts
recursive-exclude scripts *
exclude .pre-commit-config.yaml
exclude .pre-commit-hooks.yaml
exclude .readthedocs.yml
exclude tox.ini
exclude codecov.yml
exclude RELEASES.md
exclude conftest.py
include LICENSE
include CHANGELOG.md
include docs/requirements.txt
recursive-include examples *
include jupyter_book/default_config.yml
include jupyter_book/config_schema.json
recursive-include jupyter_book/book_template *
...@@ -74,9 +74,16 @@ This mapping allows for "true" error reporting, as described in [](myst-nb:myst/ ...@@ -74,9 +74,16 @@ This mapping allows for "true" error reporting, as described in [](myst-nb:myst/
between Jupyter Notebook `.ipynb` files and between Jupyter Notebook `.ipynb` files and
[a variety of text-based files](https://jupytext.readthedocs.io/en/latest/formats.html). [a variety of text-based files](https://jupytext.readthedocs.io/en/latest/formats.html).
Jupyter Book natively supports the Jupytext file format: [notebooks with MyST Markdown](./myst-notebooks.md), but you can add other formats like [RMarkdown](https://rmarkdown.rstudio.com/) or Python files. Jupyter Book natively supports the Jupytext file format: [notebooks with MyST Markdown](./myst-notebooks.md).
The configuration looks like: You can also add other formats like [RMarkdown](https://rmarkdown.rstudio.com/) or Python files.
To do so, first ensure Jupytext is installed:
```console
$ pip install jupytext
```
Then configure Jupyter book like so:
```yaml ```yaml
sphinx: sphinx:
...@@ -101,9 +108,6 @@ Now you can use RMarkdown blocks: ...@@ -101,9 +108,6 @@ Now you can use RMarkdown blocks:
print("Hallo I'm an RMarkdown block!") print("Hallo I'm an RMarkdown block!")
``` ```
:::{important}
For full compatibility with `myst-parser`, it is necessary to use `jupytext>=1.6.0`.
:::
(file-types:custom:jupytext)= (file-types:custom:jupytext)=
## Convert a Jupytext file into a MyST notebook ## Convert a Jupytext file into a MyST notebook
......
...@@ -160,10 +160,10 @@ jobs: ...@@ -160,10 +160,10 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
# Install dependencies # Install dependencies
- name: Set up Python 3.7 - name: Set up Python 3.8
uses: actions/setup-python@v1 uses: actions/setup-python@v2
with: with:
python-version: 3.7 python-version: 3.8
- name: Install dependencies - name: Install dependencies
run: | run: |
......
# Copied from 'sphinx' extra of setup.cfg # Copied from 'sphinx' extra of pyproject.toml
altair altair
bokeh bokeh
folium folium
ipywidgets ipywidgets
jupytext
matplotlib matplotlib
nbclient nbclient
numpy numpy
......
[build-system] [build-system]
requires = ["setuptools>=46.4.0", "wheel"] requires = ["flit_core >=3.5,<4"]
build-backend = "setuptools.build_meta" build-backend = "flit_core.buildapi"
[project]
name = "jupyter-book"
authors = [{name = "Executable Book Project", email = "executablebooks@gmail.com"}]
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Text Processing :: Markup",
]
keywords = [
"reproducible",
"science",
"environments",
"scholarship",
"notebook",
]
dynamic = ["description", "version"]
requires-python = ">=3.7"
dependencies = [
"click>=7.1,<9",
"docutils>=0.15,<0.18",
"jsonschema<4",
"linkify-it-py~=1.0.1",
"myst-nb~=0.13.1",
"pyyaml",
"sphinx>=3,<5",
"sphinx-comments",
"sphinx-copybutton",
"sphinx-external-toc~=0.2.3",
"sphinx-jupyterbook-latex~=0.4.6",
"sphinx-panels~=0.6.0",
"sphinx-thebe~=0.1.1",
"sphinx_book_theme~=0.1.4",
"sphinx_togglebutton",
"sphinxcontrib-bibtex>=2.2.0,<=2.5.0",
"sphinx-multitoc-numbering~=0.1.3",
]
[project.license]
file = "LICENSE"
[project.readme]
file = "README.md"
content-type = "text/markdown"
[project.urls]
Homepage = "https://executablebooks.org/"
Documentation = "https://jupyterbook.org"
Funding = "https://executablebooks.org"
Source = "https://github.com/executablebooks/jupyter-book/"
Tracker = "https://github.com/executablebooks/jupyter-book/issues"
[project.optional-dependencies]
code_style = ["pre-commit~=2.12"]
pdfhtml = ["pyppeteer"]
sphinx = [
"altair",
"bokeh",
"folium",
"ipywidgets",
"jupytext",
"matplotlib",
"nbclient",
"numpy",
"pandas",
"plotly",
"sphinx-click",
"sphinx_inline_tabs",
"sphinxext-rediraffe~=0.2.3",
"sympy",
"sphinx-proof",
]
testing = [
"altair",
"beautifulsoup4",
"beautifulsoup4",
"cookiecutter",
"coverage",
"jupytext",
"matplotlib",
"pyppeteer",
"pytest>=6.2.4",
"pytest-cov",
"pytest-regressions",
"pytest-timeout",
"pytest-xdist",
"sphinx_click",
"sphinx_tabs",
"texsoup",
]
[project.scripts]
jb = "jupyter_book.cli.main:main"
jupyter-book = "jupyter_book.cli.main:main"
[tool.flit.module]
name = "jupyter_book"
[tool.flit.sdist]
exclude = [
".*", # Any hidden folders or files
"docs/",
"tests/",
"scripts/",
"tox.ini",
"codecov.yml",
"conftest.py",
]
[tool.isort] [tool.isort]
profile = "black" profile = "black"
#!/usr/bin/env python3 #!/usr/bin/env python3
import sys import sys
from configparser import ConfigParser
from pathlib import Path from pathlib import Path
import tomli
def check_reqs(setup_path="setup.cfg", req_path="docs/requirements.txt"):
parser = ConfigParser() def check_reqs(pyproject_path="pyproject.toml", req_path="docs/requirements.txt"):
parser.read(setup_path) with open(pyproject_path, "rb") as f:
setup_content = parser["options.extras_require"]["sphinx"] toml_dict = tomli.load(f)
setup_content = (
"# Copied from 'sphinx' extra of setup.cfg\n" + setup_content.strip() optional_deps = toml_dict["project"]["optional-dependencies"]
) sphinx_content = "\n".join(optional_deps["sphinx"]).strip()
sphinx_content = "# Copied from 'sphinx' extra of pyproject.toml\n" + sphinx_content
req_content = Path(req_path).read_text() req_content = Path(req_path).read_text()
if setup_content != req_content.strip(): if sphinx_content != req_content.strip():
Path(req_path).write_text(setup_content + "\n") Path(req_path).write_text(sphinx_content + "\n")
sys.exit(1) sys.exit(1)
sys.exit(0) sys.exit(0)
......
[metadata]
name = jupyter-book
version = attr: jupyter_book.__version__
description = Jupyter Book: Create an online book with Jupyter Notebooks
long_description = file: README.md
long_description_content_type = text/markdown
url = https://executablebooks.org/
author = Executable Book Project
author_email = jupyter@googlegroups.com
license = BSD-3-Clause
license_file = LICENSE
classifiers =
Development Status :: 4 - Beta
License :: OSI Approved :: BSD License
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: Implementation :: CPython
Topic :: Software Development :: Libraries :: Python Modules
Topic :: Text Processing :: Markup
keywords =
reproducible
science
environments
scholarship
notebook
project_urls =
Documentation = https://jupyterbook.org
Funding = https://executablebooks.org
Source = https://github.com/executablebooks/jupyter-book/
Tracker = https://github.com/executablebooks/jupyter-book/issues
[options]
packages = find:
install_requires =
click>=7.1,<9
docutils>=0.15,<0.18
jsonschema<4
# Include Jupytext to ensure users have the right version, even if not strictly necessary
jupytext>=1.11.2,<1.12 #markdown-it-py~=1 required and support from 1.11.2
linkify-it-py~=1.0.1
myst-nb~=0.13.1
pyyaml
sphinx>=3,<5
sphinx-comments
sphinx-copybutton
sphinx-external-toc~=0.2.3
sphinx-jupyterbook-latex~=0.4.6
sphinx-panels~=0.6.0
sphinx-thebe~=0.1.1
sphinx_book_theme~=0.1.4
sphinx_togglebutton
sphinxcontrib-bibtex>=2.2.0,<=2.5.0
sphinx-multitoc-numbering~=0.1.3
python_requires = >=3.7
include_package_data = True
[options.entry_points]
console_scripts =
jb = jupyter_book.cli.main:main
jupyter-book = jupyter_book.cli.main:main
[options.extras_require]
code_style =
pre-commit~=2.12
pdfhtml =
pyppeteer
sphinx =
altair
bokeh
folium
ipywidgets
matplotlib
nbclient
numpy
pandas
plotly
sphinx-click
sphinx_inline_tabs
sphinxext-rediraffe~=0.2.3
sympy
sphinx-proof
testing =
altair
beautifulsoup4
beautifulsoup4
cookiecutter
coverage
matplotlib
pyppeteer
pytest>=6.2.4
pytest-cov
pytest-regressions
pytest-timeout
pytest-xdist
sphinx_click
sphinx_tabs
texsoup
[flake8]
max-line-length = 100
extend-ignore = E203
# This file is needed for editable installs (`pip install -e .`).
# Can be removed once the following is resolved
# https://github.com/pypa/packaging-problems/issues/256
from setuptools import setup
setup()
...@@ -67,3 +67,8 @@ markers = ...@@ -67,3 +67,8 @@ markers =
filterwarnings = filterwarnings =
ignore::DeprecationWarning:pyee.* ignore::DeprecationWarning:pyee.*
ignore::DeprecationWarning:pybtex.* ignore::DeprecationWarning:pybtex.*
# Use tox.ini for flake8 config because it does not yet support pyproject.toml
[flake8]
max-line-length = 100
extend-ignore = E203
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment