From 53c9c7fcdaf1543fa5b6dc0168246ca6f14cfae7 Mon Sep 17 00:00:00 2001 From: Cristiano Singulani Date: Mon, 29 Apr 2024 20:20:08 +0000 Subject: [PATCH 1/2] Bug fix in validation of documentation construction. Refactoring the way of declaring requirements. Devcontainer fix. --- .devcontainer/Dockerfile | 4 +-- .github/workflows/build-documentation.yml | 4 +-- .github/workflows/linting.yml | 1 + .github/workflows/smoke-test.yml | 1 + .github/workflows/testing-and-coverage.yml | 1 + .pre-commit-config.yaml | 8 ++--- docs/requirements.txt | 10 ------ pyproject.toml | 40 +++------------------- requirements-dev.txt | 13 +++++++ requirements.txt | 11 ++++++ 10 files changed, 40 insertions(+), 53 deletions(-) delete mode 100644 docs/requirements.txt create mode 100644 requirements-dev.txt create mode 100644 requirements.txt diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 7ba8109..8a1f5ca 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -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 diff --git a/.github/workflows/build-documentation.yml b/.github/workflows/build-documentation.yml index 055f647..869a6b0 100644 --- a/.github/workflows/build-documentation.yml +++ b/.github/workflows/build-documentation.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index e13ed83..bf902ec 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -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: | diff --git a/.github/workflows/smoke-test.yml b/.github/workflows/smoke-test.yml index e632649..1182210 100644 --- a/.github/workflows/smoke-test.yml +++ b/.github/workflows/smoke-test.yml @@ -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 diff --git a/.github/workflows/testing-and-coverage.yml b/.github/workflows/testing-and-coverage.yml index ec1a849..7f845dc 100644 --- a/.github/workflows/testing-and-coverage.yml +++ b/.github/workflows/testing-and-coverage.yml @@ -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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e8f4453..a5c544c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 @@ -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 @@ -52,7 +52,7 @@ 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 @@ -60,7 +60,7 @@ repos: # 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/) diff --git a/docs/requirements.txt b/docs/requirements.txt deleted file mode 100644 index 4104a2b..0000000 --- a/docs/requirements.txt +++ /dev/null @@ -1,10 +0,0 @@ -sphinx>=7.0.0,<8 -sphinx_rtd_theme>1.2.0,<2 -sphinx-autoapi>=3.0.0,<4 -ghp-import -nbsphinx -ipython -jupytext -jupyter -matplotlib -numpy \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 2d186c5..695c0a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "pzserver" license = {file = "LICENSE"} -dynamic = ["version"] +dynamic = ["version", "dependencies", "optional-dependencies"] readme = "README.md" authors = [ { name = "LIneA", email = "itteam@linea.org.br" } @@ -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 = [ @@ -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"] }} diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..e6c841f --- /dev/null +++ b/requirements-dev.txt @@ -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 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..cac94cd --- /dev/null +++ b/requirements.txt @@ -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 \ No newline at end of file From 7ae22df195e35eef811ac7018733df2a2dc45b99 Mon Sep 17 00:00:00 2001 From: Julia Gschwend Date: Mon, 6 May 2024 20:18:44 +0000 Subject: [PATCH 2/2] Update intro notebooks Remove output leftovers and update date and time fields. --- docs/notebooks/intro_notebook.ipynb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/notebooks/intro_notebook.ipynb b/docs/notebooks/intro_notebook.ipynb index 3541d4e..9c8f259 100644 --- a/docs/notebooks/intro_notebook.ipynb +++ b/docs/notebooks/intro_notebook.ipynb @@ -11,7 +11,7 @@ "\n", "Contact author: [Julia Gschwend](mailto:julia@linea.org.br)\n", "\n", - "Last verified run: 2024-Jan-23
" + "Last verified run: 2024-May-06
" ] }, { @@ -927,9 +927,9 @@ ], "metadata": { "kernelspec": { - "display_name": "pz-lib", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "pz-lib" + "name": "python3" }, "language_info": { "codemirror_mode": {