Skip to content

Commit

Permalink
Bug fix in validation of documentation construction.
Browse files Browse the repository at this point in the history
Refactoring the way of declaring requirements.
Devcontainer fix.
  • Loading branch information
crisingulani committed Apr 29, 2024
1 parent e1becbc commit 53c9c7f
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 53 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ FROM mcr.microsoft.com/devcontainers/python:0-3.10
ENV PYTHONUNBUFFERED 1

# [Optional] If your requirements rarely change, uncomment this section to add them to the image.
COPY docs/requirements.txt /tmp/pip-tmp/
RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
COPY requirements-dev.txt /tmp/pip-tmp/
RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements-dev.txt \
&& rm -rf /tmp/pip-tmp

RUN apt-get update && apt-get -y install pandoc
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ jobs:
pip install .
pip install .[dev]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f docs/requirements.txt ]; then pip install -r docs/requirements.txt; fi
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
- name: Install notebook requirements
run: |
sudo apt-get install pandoc
- name: Build docs
run: |
sphinx-build -T -E -b html -d docs/build/doctrees ./docs docs/build/html
sphinx-build -T -E -b html -d docs/build/doctrees ./docs docs/build/html -D exclude_patterns="notebooks/*"
- name: Run ghp-import
run: |
ghp-import -n -p -f -x docs/ docs/build/html
1 change: 1 addition & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
pip install .
pip install .[dev]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
- name: Analyze code with linter

run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
pip install .
pip install .[dev]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
- name: Run unit tests with pytest
run: |
python -m pytest tests
1 change: 1 addition & 0 deletions .github/workflows/testing-and-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
pip install .
pip install .[dev]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
- name: Run unit tests with pytest
run: |
python -m pytest tests --cov=pzserver --cov-report=xml
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repos:
# This hook should always pass. It will print a message if the local version
# is out of date.
- repo: https://github.com/lincc-frameworks/pre-commit-hooks
rev: v0.1
rev: v0.1.2
hooks:
- id: check-lincc-frameworks-template-version
name: Check template version
Expand Down Expand Up @@ -40,7 +40,7 @@ repos:

# prevents committing directly branches named 'main' and 'master'.
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: no-commit-to-branch
name: Prevent main branch commits
Expand All @@ -52,15 +52,15 @@ repos:

# verify that pyproject.toml is well formed
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.12.1
rev: v0.16
hooks:
- id: validate-pyproject
name: Validate pyproject.toml
description: Verify that pyproject.toml adheres to the established schema.

# Automatically sort the imports used in .py files
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
name: isort (python files in src/ and tests/)
Expand Down
10 changes: 0 additions & 10 deletions docs/requirements.txt

This file was deleted.

40 changes: 5 additions & 35 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "pzserver"
license = {file = "LICENSE"}
dynamic = ["version"]
dynamic = ["version", "dependencies", "optional-dependencies"]
readme = "README.md"
authors = [
{ name = "LIneA", email = "[email protected]" }
Expand All @@ -20,40 +20,6 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"deprecated",
"numpy>=1.23",
"pandas>=1.2.0",
"requests>=2.23.0",
"astropy>=5.0.0",
"matplotlib>=3.6.0",
"tables_io>=0.7.9",
"Jinja2>=3.1.2",
"ipython>=8.5.0",
"h5py>=3.8.0",
"pyarrow>=15.0.2",
]

# On a mac, install optional dependencies with `pip install '.[dev]'` (include the single quotes)
[project.optional-dependencies]
dev = [
"pytest",
"pytest-cov", # Used to report total code coverage
"pre-commit", # Used to run checks before finalizing a git commit
"sphinx>=7.0.0,<8", # Used to automatically generate documentation
"sphinx_rtd_theme>=1.2.0,<2", # Used to render documentation
"sphinx-autoapi>=3.0.0,<4", # Used to automatically generate api documentation
"pylint", # Used for static linting of files
# if you add dependencies here while experimenting in a notebook and you
# want that notebook to render in your documentation, please add the
# dependencies to ./docs/requirements.txt as well.
"ipykernel", # Support for Jupyter notebooks
"nbconvert", # Needed for pre-commit check to clear output from Python notebooks
"nbsphinx", # Used to integrate Python notebooks into Sphinx documentation
"ipython", # Also used in building notebooks into Sphinx
"jupyterlab",
"matplotlib", # Used in sample notebook intro_notebook.ipynb
]

[build-system]
requires = [
Expand All @@ -64,3 +30,7 @@ build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "src/pzserver/_version.py"

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
optional-dependencies = {dev = { file = ["requirements-dev.txt"] }}
13 changes: 13 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
pytest
pytest-cov
pre-commit
sphinx>=7.0.0,<8
sphinx_rtd_theme>=1.2.0,<2
sphinx-autoapi>=3.0.0,<4
pylint
ipykernel
nbconvert
nbsphinx
ipython
jupyterlab
matplotlib
11 changes: 11 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
deprecated
numpy>=1.23
pandas>=1.2.0
requests>=2.23.0
astropy>=5.0.0
matplotlib>=3.6.0
tables_io>=0.7.9
Jinja2>=3.1.2
ipython>=8.5.0
h5py>=3.8.0
pyarrow>=15.0.2

0 comments on commit 53c9c7f

Please sign in to comment.