From c843ad476a38d4bc570e8ce1fd2188f43aeebc22 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Wed, 25 Sep 2024 22:01:22 -0400 Subject: [PATCH 01/15] Add workflow files --- .github/workflows/check-news-item.yml | 12 +++++ .github/workflows/docs.yml | 43 --------------- .github/workflows/main.yml | 54 ------------------- .../matrix-and-codecov-on-merge-to-main.yml | 21 ++++++++ .github/workflows/publish-docs-on-release.yml | 14 +++++ .github/workflows/tests-on-pr.yml | 16 ++++++ 6 files changed, 63 insertions(+), 97 deletions(-) create mode 100644 .github/workflows/check-news-item.yml delete mode 100644 .github/workflows/docs.yml delete mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/matrix-and-codecov-on-merge-to-main.yml create mode 100644 .github/workflows/publish-docs-on-release.yml create mode 100644 .github/workflows/tests-on-pr.yml diff --git a/.github/workflows/check-news-item.yml b/.github/workflows/check-news-item.yml new file mode 100644 index 0000000..44aac3d --- /dev/null +++ b/.github/workflows/check-news-item.yml @@ -0,0 +1,12 @@ +name: Check for News + +on: + pull_request_target: + branches: + - main + +jobs: + build: + uses: Billingegroup/release-scripts/.github/workflows/_check-news-item.yml@v0 + with: + project: bg-mpl-stylesheets diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index a4661f5..0000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Build Documentation - -on: - push: - branches: - - main - release: - -jobs: - test: - runs-on: ubuntu-latest - defaults: - run: - shell: bash -l {0} - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - uses: conda-incubator/setup-miniconda@v2 - with: - activate-environment: build - auto-update-conda: true - - - name: install requirements - run: >- - conda install -n build -c conda-forge - --file requirements/build.txt - --file requirements/run.txt - --file requirements/docs.txt - --quiet --yes - - - name: install the package - run: python -m pip install . --no-deps - - - name: build documents - run: make -C doc html - - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./doc/build/html diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 198f8ea..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: CI - -on: - push: - branches: - - main - - CI - pull_request: - workflow_dispatch: - -jobs: - miniconda: - name: Miniconda ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: ["ubuntu-latest"] - steps: - - name: check out bg-mpl-stylesheets - uses: actions/checkout@v3 - with: - repository: billingegroup/bg-mpl-stylesheets - path: . - fetch-depth: 0 # avoid shallow clone with no tags - - - name: initialize miniconda - # this uses a marketplace action that sets up miniconda in a way that makes - # it easier to use. I tried setting it up without this and it was a pain - uses: conda-incubator/setup-miniconda@v2 - with: - activate-environment: test - # environment.yml file is needed by this action. Because I don't want - # maintain this but rather maintain the requirements files it just has - # basic things in it like conda and pip - environment-file: ./environment.yml - python-version: 3 - auto-activate-base: false - - - name: install bg-mpl-stylesheets requirements - shell: bash -l {0} - run: | - conda config --set always_yes yes --set changeps1 no - conda config --add channels conda-forge - conda activate test - conda install --file requirements/run.txt - conda install --file requirements/test.txt - pip install . --no-deps - - name: Validate bg-mpl-stylesheets - shell: bash -l {0} - run: | - conda activate test - coverage run -m pytest -vv -s - coverage report -m - codecov diff --git a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml new file mode 100644 index 0000000..1745572 --- /dev/null +++ b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml @@ -0,0 +1,21 @@ +name: CI + +on: + push: + branches: + - main + release: + types: + - prereleased + - published + workflow_dispatch: + +jobs: + coverage: + uses: Billingegroup/release-scripts/.github/workflows/_matrix-and-codecov-on-merge-to-main.yml@v0 + with: + project: bg-mpl-stylesheets + c_extension: false + headless: false + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/publish-docs-on-release.yml b/.github/workflows/publish-docs-on-release.yml new file mode 100644 index 0000000..737b699 --- /dev/null +++ b/.github/workflows/publish-docs-on-release.yml @@ -0,0 +1,14 @@ +name: Build and Deploy Docs + +on: + release: + types: + - published + workflow_dispatch: + +jobs: + docs: + uses: Billingegroup/release-scripts/.github/workflows/_publish-docs-on-release.yml@v0 + with: + project: bg-mpl-stylesheets + c_extension: false diff --git a/.github/workflows/tests-on-pr.yml b/.github/workflows/tests-on-pr.yml new file mode 100644 index 0000000..b22d6b4 --- /dev/null +++ b/.github/workflows/tests-on-pr.yml @@ -0,0 +1,16 @@ +name: Tests on PR + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +jobs: + validate: + uses: Billingegroup/release-scripts/.github/workflows/_tests-on-pr.yml@v0 + with: + project: bg-mpl-stylesheets + c_extension: false + headless: false From a0d9442151d1fa8fb09b273fbf27a70fd51177b2 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Wed, 25 Sep 2024 22:01:50 -0400 Subject: [PATCH 02/15] Add test_version --- tests/conftest.py | 111 +++++------------------------------------- tests/test_version.py | 10 ++++ 2 files changed, 22 insertions(+), 99 deletions(-) create mode 100644 tests/test_version.py diff --git a/tests/conftest.py b/tests/conftest.py index b842ca1..e3b6313 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,106 +1,19 @@ -import pytest - +import json +from pathlib import Path -def create_svg_with_layers(): - # Define the SVG content as a string - svg_content = """ - - - - - - - - - - - - - - - - - - - - - - - - - - - -""" - return svg_content +import pytest @pytest.fixture def user_filesystem(tmp_path): - base_dir = tmp_path - svg = base_dir / "test.svg" + base_dir = Path(tmp_path) + home_dir = base_dir / "home_dir" + home_dir.mkdir(parents=True, exist_ok=True) + cwd_dir = base_dir / "cwd_dir" + cwd_dir.mkdir(parents=True, exist_ok=True) - with open(svg, "w") as f: - f.write(create_svg_with_layers()) + home_config_data = {"username": "home_username", "email": "home@email.com"} + with open(home_dir / "diffpyconfig.json", "w") as f: + json.dump(home_config_data, f) - yield base_dir + yield tmp_path diff --git a/tests/test_version.py b/tests/test_version.py new file mode 100644 index 0000000..0a38ad9 --- /dev/null +++ b/tests/test_version.py @@ -0,0 +1,10 @@ +"""Unit tests for __version__.py +""" + +import bg-mpl-stylesheets + + +def test_package_version(): + """Ensure the package version is defined and not set to the initial placeholder.""" + assert hasattr(bg-mpl-stylesheets, "__version__") + assert bg-mpl-stylesheets.__version__ != "0.0.0" From 2f5f0f966c5e7a13ce37efc2376a1b39dd57e556 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Wed, 25 Sep 2024 22:19:51 -0400 Subject: [PATCH 03/15] Add attributes, precommit --- .gitattributes | 1 - .gitignore | 2 +- .pre-commit-config.yaml | 5 ++++- 3 files changed, 5 insertions(+), 3 deletions(-) delete mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 872e1aa..0000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -bg_mpl_stylesheets/_version.py export-subst diff --git a/.gitignore b/.gitignore index e113117..893fec5 100644 --- a/.gitignore +++ b/.gitignore @@ -93,7 +93,7 @@ target/ # version information setup.cfg -/src/bg-mpl-stylesheets/*/version.cfg +/src/billingegroup/*/version.cfg # Rever rever/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c458806..3070e19 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,10 @@ repos: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace - exclude: '\.(rst|txt)$' + - id: check-case-conflict + - id: check-merge-conflict + - id: check-toml + - id: check-added-large-files - repo: https://github.com/psf/black rev: 24.4.2 hooks: From d8905fb54bc2c4c9c661d52156b8335625c25d51 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Wed, 25 Sep 2024 22:21:15 -0400 Subject: [PATCH 04/15] Add pyproject --- pyproject.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 59bb22a..73a602c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools>=62.0", "setuptools-git-versioning<2"] +requires = ["setuptools>=62.0", "setuptools-git-versioning>=2.0"] build-backend = "setuptools.build_meta" [project] @@ -11,7 +11,7 @@ authors = [ maintainers = [ { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, ] -description = "A package for using Billinge group style files" +description = "A package for using Billinge group style files." keywords = [] readme = "README.rst" requires-python = ">=3.10" @@ -33,8 +33,8 @@ classifiers = [ ] [project.urls] -Homepage = "https://github.com/bg-mpl-stylesheets/bg-mpl-stylesheets/" -Issues = "https://github.com/bg-mpl-stylesheets/bg-mpl-stylesheets/issues/" +Homepage = "https://github.com/billingegroup/bg-mpl-stylesheets/" +Issues = "https://github.com/billingegroup/bg-mpl-stylesheets/issues/" [tool.setuptools-git-versioning] enabled = true @@ -45,7 +45,7 @@ dirty_template = "{tag}" [tool.setuptools.packages.find] where = ["src"] # list of folders that contain the packages (["."] by default) include = ["*"] # package names should match these glob patterns (["*"] by default) -exclude = ["bg-mpl-stylesheets.tests*"] # exclude packages matching these glob patterns (empty by default) +exclude = [] # exclude packages matching these glob patterns (empty by default) namespaces = false # to disable scanning PEP 420 namespaces (true by default) [tool.setuptools.dynamic] From a77b285fc857a3c1045997f647a9f819290a494e Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Wed, 25 Sep 2024 22:23:21 -0400 Subject: [PATCH 05/15] Add requirements, manifest --- AUTHORS.rst | 4 ++-- MANIFEST.in | 26 ++++++++++++-------------- requirements/build.txt | 2 -- requirements/test.txt | 1 + 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 42ab14c..37693e3 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -1,10 +1,10 @@ Authors ======= -Billinge Group and community contibutors. +Billinge Group and community contributors. Contributors ------------ For a list of contributors, visit -https://github.com/bg-mpl-stylesheets/bg-mpl-stylesheets/graphs/contributors +https://github.com/billingegroup/bg-mpl-stylesheets/graphs/contributors diff --git a/MANIFEST.in b/MANIFEST.in index c403ac9..f1a78ee 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,14 +1,12 @@ -include AUTHORS.rst -include LICENSE -include README.rst -include requirements.txt - -recursive-exclude * __pycache__ -recursive-exclude * *.py[co] - -recursive-include docs *.rst conf.py Makefile make.bat - -include bg_mpl_stylesheets/version.py - -# If including data files in the package, add them like: -# include path/to/data_file +graft src +graft tests +graft requirements + +include AUTHORS.rst LICENSE*.rst README.rst + +# Exclude all bytecode files and __pycache__ directories +global-exclude *.py[cod] # Exclude all .pyc, .pyo, and .pyd files. +global-exclude .DS_Store # Exclude Mac filesystem artifacts. +global-exclude __pycache__ # Exclude Python cache directories. +global-exclude .git* # Exclude git files and directories. +global-exclude .idea # Exclude PyCharm project settings. diff --git a/requirements/build.txt b/requirements/build.txt index f72d870..e69de29 100644 --- a/requirements/build.txt +++ b/requirements/build.txt @@ -1,2 +0,0 @@ -python -setuptools diff --git a/requirements/test.txt b/requirements/test.txt index 6f9ccf8..a727786 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -2,4 +2,5 @@ flake8 pytest codecov coverage +pytest-cov pytest-env From 9802f22763c0299df4d40cbe366f76a85538e03a Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Wed, 25 Sep 2024 22:26:04 -0400 Subject: [PATCH 06/15] Add doc --- README.rst | 41 ++++++----- doc/make.bat | 72 +++++++++---------- doc/source/api/bg-mpl-stylesheets.rst | 45 ++++++++++++ .../bg_mpl_stylesheets.example_package.rst | 31 -------- doc/source/api/bg_mpl_stylesheets.rst | 30 -------- doc/source/index.rst | 6 +- 6 files changed, 106 insertions(+), 119 deletions(-) create mode 100644 doc/source/api/bg-mpl-stylesheets.rst delete mode 100644 doc/source/api/bg_mpl_stylesheets.example_package.rst delete mode 100644 doc/source/api/bg_mpl_stylesheets.rst diff --git a/README.rst b/README.rst index c72382b..e89538a 100644 --- a/README.rst +++ b/README.rst @@ -1,15 +1,25 @@ -bg-mpl-stylesheets -================== +|Icon| |title|_ +=============== + +.. |title| replace:: bg-mpl-stylesheets +.. _title: https://billingegroup.github.io/bg-mpl-stylesheets + +.. |Icon| image:: https://avatars.githubusercontent.com/billingegroup + :target: https://billingegroup.github.io/bg-mpl-stylesheets + :height: 100px |PyPi| |Forge| |PythonVersion| |PR| -|Codecov| |Black| |Tracking| +|CI| |Codecov| |Black| |Tracking| .. |Black| image:: https://img.shields.io/badge/code_style-black-black :target: https://github.com/psf/black -.. |Codecov| image:: https://codecov.io/gh/Billingegroup/bg-mpl-stylesheets/branch/main/graph/badge.svg - :target: https://codecov.io/gh/Billingegroup/bg-mpl-stylesheets +.. |CI| image:: https://github.com/billingegroup/bg-mpl-stylesheets/actions/workflows/matrix-and-codecov-on-merge-to-main.yml/badge.svg + :target: https://github.com/billingegroup/bg-mpl-stylesheets/actions/workflows/matrix-and-codecov-on-merge-to-main.yml + +.. |Codecov| image:: https://codecov.io/gh/billingegroup/bg-mpl-stylesheets/branch/main/graph/badge.svg + :target: https://codecov.io/gh/billingegroup/bg-mpl-stylesheets .. |Forge| image:: https://img.shields.io/conda/vn/conda-forge/bg-mpl-stylesheets :target: https://anaconda.org/conda-forge/bg-mpl-stylesheets @@ -23,7 +33,7 @@ bg-mpl-stylesheets :target: https://pypi.org/project/bg-mpl-stylesheets/ .. |Tracking| image:: https://img.shields.io/badge/issue_tracking-github-blue - :target: https://github.com/Billingegroup/bg-mpl-stylesheets/issues + :target: https://github.com/billingegroup/bg-mpl-stylesheets/issues A package for using Billinge group style files @@ -55,26 +65,21 @@ The following creates and activates a new environment named ``bg-mpl-stylesheets Then, to fully install ``bg-mpl-stylesheets`` in our active environment, run :: - conda install --file requirements/examples.txt conda install bg-mpl-stylesheets Another option is to use ``pip`` to download and install the latest release from `Python Package Index `_. -To install using ``pip`` into your ``bg-mpl-stylesheets_env`` environment, we will also have to install dependencies :: - - pip install -r https://raw.githubusercontent.com/billingegroup/bg-mpl-stylesheets/main/requirements/run.txt - -and then install the package :: +To install using ``pip`` into your ``bg-mpl-stylesheets_env`` environment, type :: pip install bg-mpl-stylesheets If you prefer to install from sources, after installing the dependencies, obtain the source archive from -`GitHub `_. Once installed, ``cd`` into your ``bg-mpl-stylesheets`` directory +`GitHub `_. Once installed, ``cd`` into your ``bg-mpl-stylesheets`` directory and run the following :: pip install . -Usage +sage ----- ``matplotlib`` can accept a manually defined stylesheet file that is located remotely or locally. @@ -271,7 +276,7 @@ Support and Contribute `Diffpy user group `_ is the discussion forum for general questions and discussions about the use of bg-mpl-stylesheets. Please join the bg-mpl-stylesheets users community by joining the Google group. The bg-mpl-stylesheets project welcomes your expertise and enthusiasm! -If you see a bug or want to request a feature, please `report it as an issue `_ and/or `submit a fix as a PR `_. You can also post it to the `Diffpy user group `_. +If you see a bug or want to request a feature, please `report it as an issue `_ and/or `submit a fix as a PR `_. You can also post it to the `Diffpy user group `_. Feel free to fork the project and contribute. To install bg-mpl-stylesheets in a development mode, with its sources being directly used by Python @@ -294,11 +299,9 @@ trying to commit again. Improvements and fixes are always appreciated. -Before contribuing, please read our `Code of Conduct `_. - - +Before contribuing, please read our `Code of Conduct `_. Contact ------- -For more information on bg-mpl-stylesheets please email Prof. Simon Billinge at sb2896@columbia.edu. +For more information on bg-mpl-stylesheets please visit the project `web-page `_ or email Prof. Simon Billinge at sb2896@columbia.edu. diff --git a/doc/make.bat b/doc/make.bat index 2be8306..ac53d5b 100644 --- a/doc/make.bat +++ b/doc/make.bat @@ -1,36 +1,36 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set SOURCEDIR=source -set BUILDDIR=build -set SPHINXPROJ=PackagingScientificPython - -if "%1" == "" goto help - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% - -:end -popd +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +set BUILDDIR=build +set SPHINXPROJ=PackagingScientificPython + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% + +:end +popd diff --git a/doc/source/api/bg-mpl-stylesheets.rst b/doc/source/api/bg-mpl-stylesheets.rst new file mode 100644 index 0000000..c802fd5 --- /dev/null +++ b/doc/source/api/bg-mpl-stylesheets.rst @@ -0,0 +1,45 @@ +:tocdepth: -1 + +bg-mpl-stylesheets package +========================== + +.. automodule:: bg-mpl-stylesheets + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +bg-mpl-stylesheets.inkscape_tools module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: bg-mpl-stylesheets.inkscape_tools + :members: + :undoc-members: + :show-inheritance: + +bg-mpl-stylesheets.translate module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: bg-mpl-stylesheets.translate + :members: + :undoc-members: + :show-inheritance: + +bg-mpl-stylesheets.styles module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: bg-mpl-stylesheets.styles + :members: + :undoc-members: + :show-inheritance: + +bg-mpl-stylesheets.colors module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: bg-mpl-stylesheets.colors + :members: + :undoc-members: + :show-inheritance: + diff --git a/doc/source/api/bg_mpl_stylesheets.example_package.rst b/doc/source/api/bg_mpl_stylesheets.example_package.rst deleted file mode 100644 index 35ee2b5..0000000 --- a/doc/source/api/bg_mpl_stylesheets.example_package.rst +++ /dev/null @@ -1,31 +0,0 @@ -.. _example_package documentation: - -|title| -======= - -.. |title| replace:: bg_mpl_stylesheets.example_package package - -.. automodule:: bg_mpl_stylesheets.example_package - :members: - :undoc-members: - :show-inheritance: - -|foo| ------ - -.. |foo| replace:: bg_mpl_stylesheets.example_package.foo module - -.. automodule:: bg_mpl_stylesheets.example_package.foo - :members: - :undoc-members: - :show-inheritance: - -|bar| ------ - -.. |bar| replace:: bg_mpl_stylesheets.example_package.bar module - -.. automodule:: bg_mpl_stylesheets.example_package.foo - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/source/api/bg_mpl_stylesheets.rst b/doc/source/api/bg_mpl_stylesheets.rst deleted file mode 100644 index adc9b28..0000000 --- a/doc/source/api/bg_mpl_stylesheets.rst +++ /dev/null @@ -1,30 +0,0 @@ -:tocdepth: -1 - -|title| -======= - -.. |title| replace:: bg-mpl-stylesheets package - -.. automodule:: bg_mpl_stylesheets - :members: - :undoc-members: - :show-inheritance: - -Subpackages ------------ - -.. toctree:: - bg_mpl_stylesheets.example_package - -Submodules ----------- - -|module| --------- - -.. |module| replace:: bg_mpl_stylesheets.example_submodule module - -.. automodule:: bg_mpl_stylesheets.example_submodule - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/source/index.rst b/doc/source/index.rst index a4a213c..79f04a4 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -4,7 +4,7 @@ .. |title| replace:: bg-mpl-stylesheets documentation -bg-mpl-stylesheets - A package for using Billinge group style files. +bg-mpl-stylesheets - A package for using Billinge group style files.. | Software version |release|. | Last updated |today|. @@ -17,13 +17,13 @@ bg-mpl-stylesheets is developed by Billinge Group and its community contributors. For a detailed list of contributors see -https://github.com/Billingegroup/bg-mpl-stylesheets/graphs/contributors. +https://github.com/billingegroup/bg-mpl-stylesheets/graphs/contributors. ============ Installation ============ -See the `README `_ +See the `README `_ file included with the distribution. ================= From 28797cb87e9f6d92f834d7d60230085b2229844e Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Wed, 25 Sep 2024 22:31:10 -0400 Subject: [PATCH 07/15] sage to usage in readme --- README.rst | 2 +- tests/test_version.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index e89538a..8074329 100644 --- a/README.rst +++ b/README.rst @@ -79,7 +79,7 @@ and run the following :: pip install . -sage +Usage ----- ``matplotlib`` can accept a manually defined stylesheet file that is located remotely or locally. diff --git a/tests/test_version.py b/tests/test_version.py index 0a38ad9..fb9e5fd 100644 --- a/tests/test_version.py +++ b/tests/test_version.py @@ -1,10 +1,10 @@ """Unit tests for __version__.py """ -import bg-mpl-stylesheets +import bg_mpl_stylesheets def test_package_version(): """Ensure the package version is defined and not set to the initial placeholder.""" - assert hasattr(bg-mpl-stylesheets, "__version__") - assert bg-mpl-stylesheets.__version__ != "0.0.0" + assert hasattr(bg_mpl_stylesheets, "__version__") + assert bg_mpl_stylesheets.__version__ != "0.0.0" From 28be544cefd19a3dee2326ac8d50ab09f2b17558 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Wed, 25 Sep 2024 22:36:20 -0400 Subject: [PATCH 08/15] Maintian conftest --- tests/conftest.py | 107 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index e3b6313..3976a91 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -17,3 +17,110 @@ def user_filesystem(tmp_path): json.dump(home_config_data, f) yield tmp_path + +import pytest + + +def create_svg_with_layers(): + # Define the SVG content as a string + svg_content = """ + + + + + + + + + + + + + + + + + + + + + + + + + + + +""" + return svg_content + + +@pytest.fixture +def user_filesystem(tmp_path): + base_dir = tmp_path + svg = base_dir / "test.svg" + + with open(svg, "w") as f: + f.write(create_svg_with_layers()) + + yield base_dir From ccd107f09bf18bcb678e21ffbd097a42cf675e10 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2024 02:38:28 +0000 Subject: [PATCH 09/15] [pre-commit.ci] auto fixes from pre-commit hooks --- README.rst | 10 +++++----- doc/source/api/bg-mpl-stylesheets.rst | 1 - doc/source/license.rst | 4 ++-- tests/conftest.py | 1 + 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.rst b/README.rst index 8074329..010fc22 100644 --- a/README.rst +++ b/README.rst @@ -37,7 +37,7 @@ A package for using Billinge group style files -* bg-mpl-stylesheets is a Python software package that creates a standardized matplotlib figure format. This includes specialized fonts, figure border, color cycle, tick parameters, and more. +* bg-mpl-stylesheets is a Python software package that creates a standardized matplotlib figure format. This includes specialized fonts, figure border, color cycle, tick parameters, and more. Citation -------- @@ -86,7 +86,7 @@ Usage By default the package uses LaTeX fonts for mathematical symbols. This feature requires a Latex package on your computer. It is not required for the use of the style-sheet but gives better results for things like angstrom symbols. Matplotlib will look for your installed latex package, for example TeXLive or MikTex. If it can't find a latex package it will look for non-latex font replacements. To use the stylesheet, near the beginning your python script type :: - + from bg_mpl_stylesheets.styles import all_styles plt.style.use(all_styles[""]) @@ -118,7 +118,7 @@ Not that the ``rcParams`` are global. It can get very confusing if these are upd import matplotlib.pyplot as plt @mpl.rc_context({'lines.linewidth': 1, 'axes.linewidth': 0.7, 'xtick.major.size': - 0.7, 'xtick.major.width': 0.7, 'xtick.labelsize': 5, 'legend.frameon': False, + 0.7, 'xtick.major.width': 0.7, 'xtick.labelsize': 5, 'legend.frameon': False, 'legend.loc': 'best', 'font.size': 5, 'axes.labelsize': 5, 'ytick.left': False, 'ytick.labelleft': False, 'ytick.right': False }) @@ -215,7 +215,7 @@ You may select a specific color to plot from `Colors`: :: # if you know the hex and need the name. E.g., you want to make the plot shown here for i, hex in enumerate(cycle): ax.plot(x, y + offset * i, label=Colors(hex).name, color=hex, linestyle="-") - + Color list ---------------- @@ -276,7 +276,7 @@ Support and Contribute `Diffpy user group `_ is the discussion forum for general questions and discussions about the use of bg-mpl-stylesheets. Please join the bg-mpl-stylesheets users community by joining the Google group. The bg-mpl-stylesheets project welcomes your expertise and enthusiasm! -If you see a bug or want to request a feature, please `report it as an issue `_ and/or `submit a fix as a PR `_. You can also post it to the `Diffpy user group `_. +If you see a bug or want to request a feature, please `report it as an issue `_ and/or `submit a fix as a PR `_. You can also post it to the `Diffpy user group `_. Feel free to fork the project and contribute. To install bg-mpl-stylesheets in a development mode, with its sources being directly used by Python diff --git a/doc/source/api/bg-mpl-stylesheets.rst b/doc/source/api/bg-mpl-stylesheets.rst index c802fd5..873d91e 100644 --- a/doc/source/api/bg-mpl-stylesheets.rst +++ b/doc/source/api/bg-mpl-stylesheets.rst @@ -42,4 +42,3 @@ bg-mpl-stylesheets.colors module :members: :undoc-members: :show-inheritance: - diff --git a/doc/source/license.rst b/doc/source/license.rst index cfab61c..9ae52a9 100644 --- a/doc/source/license.rst +++ b/doc/source/license.rst @@ -9,9 +9,9 @@ OPEN SOURCE LICENSE AGREEMENT ============================= BSD 3-Clause License -Copyright (c) 2024, The Trustees of Columbia University in +Copyright (c) 2024, The Trustees of Columbia University in the City of New York. -All Rights Reserved. +All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/tests/conftest.py b/tests/conftest.py index 3976a91..59ac01a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -18,6 +18,7 @@ def user_filesystem(tmp_path): yield tmp_path + import pytest From 8a0334e2c4ae6839693159b35e2c58a1a8778a65 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Wed, 25 Sep 2024 22:39:02 -0400 Subject: [PATCH 10/15] Instruction for example.txt run --- README.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 8074329..d8550b9 100644 --- a/README.rst +++ b/README.rst @@ -64,7 +64,8 @@ The following creates and activates a new environment named ``bg-mpl-stylesheets conda activate bg-mpl-stylesheets_env Then, to fully install ``bg-mpl-stylesheets`` in our active environment, run :: - + + conda install --file requirements/examples.txt conda install bg-mpl-stylesheets Another option is to use ``pip`` to download and install the latest release from From 391395739a1729c329008ce1a66a0ca56cd72fbb Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Wed, 25 Sep 2024 22:40:41 -0400 Subject: [PATCH 11/15] Import pytest up top --- tests/conftest.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 3976a91..03ba475 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -18,8 +18,6 @@ def user_filesystem(tmp_path): yield tmp_path -import pytest - def create_svg_with_layers(): # Define the SVG content as a string From 90ff8d91e6adb8d8fb334e04b19232aba0e36a10 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Wed, 25 Sep 2024 22:43:17 -0400 Subject: [PATCH 12/15] Add news --- news/recut.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 news/recut.rst diff --git a/news/recut.rst b/news/recut.rst new file mode 100644 index 0000000..2007024 --- /dev/null +++ b/news/recut.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* re-cookiecut repo to group's package standard + +**Security:** + +* From 89358bf83d78e06e710e00d8add6a727e083897d Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Wed, 25 Sep 2024 23:02:31 -0400 Subject: [PATCH 13/15] /srcbg-mpl-stylesheets to bg_mpl_styleseets in .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 893fec5..d8cf4b1 100644 --- a/.gitignore +++ b/.gitignore @@ -93,7 +93,7 @@ target/ # version information setup.cfg -/src/billingegroup/*/version.cfg +/src/bg_mpl_stylesheets/*/version.cfg # Rever rever/ From 2f51cb8c9c5eb763a602707587b4dd8984ec67d4 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Wed, 25 Sep 2024 23:05:15 -0400 Subject: [PATCH 14/15] Add package for matplotlib style files --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 73a602c..20d3a15 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ authors = [ maintainers = [ { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, ] -description = "A package for using Billinge group style files." +description = "A package for using Billinge group Matplotlib style files." keywords = [] readme = "README.rst" requires-python = ">=3.10" From f9542e72d5e8952fcbecc3d37af4eaa05d5590f4 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Wed, 25 Sep 2024 23:05:47 -0400 Subject: [PATCH 15/15] package for using Billinge group Matplotlib style files in index.rst --- doc/source/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/index.rst b/doc/source/index.rst index 79f04a4..d6e8986 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -4,7 +4,7 @@ .. |title| replace:: bg-mpl-stylesheets documentation -bg-mpl-stylesheets - A package for using Billinge group style files.. +bg-mpl-stylesheets - A package for using Billinge group Matplotlib style files. | Software version |release|. | Last updated |today|.