Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate setup.cfg and pyproject.toml; drop tox; revamp sphinx docs #88

Merged
merged 16 commits into from
Sep 5, 2024

Conversation

rlskoeser
Copy link
Member

@rlskoeser rlskoeser commented Jul 19, 2024

ref #80

  • move configuration from setup.cfg to pyproject.toml and remove setup.cfg and setup.py
  • switch build from setuptools to hatchling
  • remove tox; update configs and documentation to remove references to tox
  • update sphinx docs to use myst parser instead of m2r2 for markdown
  • revise and harmonize markdown files for display on github and inclusion in sphinx docs
  • preliminary logo for inclusion in readme and sphinx docs
  • added dhtech logo to sphinx docs sidebar with custom template & styles

Summary by CodeRabbit

  • New Features

    • Expanded contributor roles in the contributions section to include "ideas" and enhanced visibility with a new badge template.
    • Introduced a new documentation structure that dynamically includes content from various markdown files, improving accessibility and consistency.
  • Bug Fixes

    • Updated the caching mechanism for dependencies in GitHub Actions workflows to align with modern Python packaging standards.
  • Documentation

    • Improved clarity and structure in CONTRIBUTING.md, README.md, and other documentation files, enhancing usability for contributors.
    • Updated project metadata and configuration in pyproject.toml to reflect modern practices and improve discoverability.
  • Style

    • Enhanced the visual presentation of documentation with updated CSS for better aesthetics and user experience.

Copy link

codecov bot commented Jul 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.29%. Comparing base (00ede70) to head (0ddc395).
Report is 7 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop      #88      +/-   ##
===========================================
- Coverage    99.00%   98.29%   -0.72%     
===========================================
  Files            6        7       +1     
  Lines          302      293       -9     
===========================================
- Hits           299      288      -11     
- Misses           3        5       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rlskoeser rlskoeser force-pushed the feature/pyproject-setup-refactor branch from 900ea54 to 011dd50 Compare July 19, 2024 22:12
@rlskoeser rlskoeser changed the title Consolidate setup.cfg and pyproject.toml; drop tox Consolidate setup.cfg and pyproject.toml; drop tox; revamp sphinx docs Jul 20, 2024
@rlskoeser
Copy link
Member Author

@coderabbitai full review

Copy link

coderabbitai bot commented Aug 30, 2024

Actions performed

Full review triggered.

Copy link

coderabbitai bot commented Aug 30, 2024

Walkthrough

The changes encompass updates to documentation files, contributor recognition, GitHub Actions workflows, and project configuration. Key modifications include the enhancement of contributor roles, updates to Python versioning and dependency management, restructuring of documentation for clarity, and a transition to modern packaging standards using hatchling. The overall aim is to improve project organization, contributor acknowledgment, and documentation accessibility.

Changes

Files Change Summary
.all-contributorsrc, CONTRIBUTORS.md Enhanced contributor roles and updated badge link for better representation of contributions.
.github/workflows/*.yml Updated Python version, caching mechanism, and testing commands for improved workflow efficiency.
CONTRIBUTING.md, README.md Simplified titles and improved clarity in navigation and instructions for contributors.
DEVELOPER_NOTES.md, docs/*.md Introduced inclusion directives for modular documentation and improved clarity in developer notes.
pyproject.toml Transitioned to hatchling, added project metadata, dependencies, and optional dependencies.
docs/conf.py, docs/index.rst Updated project metadata, Sphinx configuration, and restructured the table of contents.
docs/_templates/sidebar_dhtech.html Added a "powered by" section to enhance branding in documentation.
docs/_static/custom.css Improved sidebar styling for better visual presentation.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Docs
    participant Contributors
    participant CI/CD
    participant Project

    User->>Docs: Access documentation
    Docs->>Contributors: Fetch contributor info
    Contributors->>Docs: Return updated contributor roles
    Docs->>User: Display enhanced contributor section

    User->>Project: Submit contribution
    Project->>CI/CD: Trigger workflow
    CI/CD->>Project: Run tests and build
    Project->>User: Acknowledge contribution
Loading

🐰 "In the garden, changes bloom,
Roles for all, dispelling gloom.
Python's new, the docs align,
Contributions now brightly shine.
Hopping forth, we celebrate,
Together, we create our fate!" 🐇


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (5)
docs/CONTRIBUTING.md (1)

1-2: Incorrect {include} directive path in docs/CONTRIBUTING.md.

The {include} directive in docs/CONTRIBUTING.md references a non-existent file at ../CONTRIBUTING.md. The correct path should be adjusted to include the CONTRIBUTING.md file from the root directory. This will ensure the content is correctly incorporated into the documentation.

  • Update the path in the {include} directive to point to the correct location of CONTRIBUTING.md.
Analysis chain

Approve the use of {include} directive.

The {include} directive is correctly used to incorporate content from ../CONTRIBUTING.md, ensuring that updates to the contributing guidelines are reflected across all documentation that includes this file.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the existence of the included file at the specified path.

# Test: Check if the file exists. Expect: File exists at the specified path.
if [ -f "../CONTRIBUTING.md" ]; then
  echo "File exists."
else
  echo "File does not exist."
fi

Length of output: 82


Script:

#!/bin/bash
# Search for the CONTRIBUTING.md file in the repository to check if it exists under a different path.
fd CONTRIBUTING.md

Length of output: 57

docs/DEVELOPER_NOTES.md (1)

1-2: Correct the {include} directive path.

The {include} directive is currently pointing to a non-existent path (../DEVELOPER_NOTES.md). Please update the path to one of the existing files: DEVELOPER_NOTES.md or docs/DEVELOPER_NOTES.md to ensure the inclusion works correctly.

  • Update the path in the {include} directive to match an existing file location.
Analysis chain

Approve the use of {include} directive.

The {include} directive is correctly used to incorporate content from ../DEVELOPER_NOTES.md, ensuring that updates to the developer notes are reflected across all documentation that includes this file.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the existence of the included file at the specified path.

# Test: Check if the file exists. Expect: File exists at the specified path.
if [ -f "../DEVELOPER_NOTES.md" ]; then
  echo "File exists."
else
  echo "File does not exist."
fi

Length of output: 85


Script:

#!/bin/bash
# Search for the DEVELOPER_NOTES.md file in the repository to find its actual location.
fd --type f --name DEVELOPER_NOTES.md

Length of output: 290


Script:

#!/bin/bash
# Correct the command to search for the DEVELOPER_NOTES.md file in the repository.
fd --type f 'DEVELOPER_NOTES.md'

Length of output: 75

DEVELOPER_NOTES.md (1)

48-48: Consider varying sentence structure for clarity.

The repeated use of "We" at the beginning of sentences in the pre-commit hooks section could be varied to improve readability. Consider rephrasing to integrate the sentences more smoothly.

Tools
LanguageTool

[style] ~48-~48: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... sh pip install -e ".[dev]" ### Install pre-commit hooks ```sh pre-commit inst...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

.github/workflows/unit_tests.yml (1)

36-36: Issue Found: Incorrect [test] section in pyproject.toml.

The [test] section is not correctly defined in the pyproject.toml file. Instead, there is a section named undate[test], which seems to be a typo or misconfiguration. This needs to be corrected to ensure that the pip install -e ".[test]" command installs the necessary test dependencies during the CI process.

  • Verify and correct the [test] section in pyproject.toml.
Analysis chain

Approved: Update to package installation command.

The change to install the package with test dependencies (pip install -e ".[test]") is appropriate for focusing the CI environment on testing. Verify that all necessary test dependencies are correctly defined under the [test] setup.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the `[test]` setup in `pyproject.toml`.

# Test: Search for the `[test]` setup in `pyproject.toml`. Expect: Correct definition of test dependencies.
rg --type toml -A 5 $'\[test\]' pyproject.toml

Length of output: 203

.all-contributorsrc (1)

80-80: Missing Contributor Badge in README.md

The contributor badge is not present in the README.md file. Ensure that the badge is added to the README.md to display contributor statistics effectively on GitHub.

  • Verify if the badge markdown is present elsewhere in the repository.
  • Consider adding the badge to the README.md if it's missing.
Analysis chain

Approved: Addition of badgeTemplate field.

The new badgeTemplate field enhances the visibility of contributor statistics. Verify that the badge displays correctly on GitHub to ensure it serves its intended purpose effectively.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the display of the contributor badge on GitHub.

# Test: Check the README.md for the correct display of the badge. Expect: Badge displayed correctly.
cat README.md | grep '![All Contributors]'

Length of output: 141

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2280254 and 129b82e.

Files ignored due to path filters (5)
  • _static/undate_logo.png is excluded by !**/*.png
  • docs/_static/dhtech-logo.png is excluded by !**/*.png
  • docs/_static/dhtech-logo.svg is excluded by !**/*.svg
  • docs/_static/logo.png is excluded by !**/*.png
  • docs/_static/undate_logo.png is excluded by !**/*.png
Files selected for processing (18)
  • .all-contributorsrc (4 hunks)
  • .github/workflows/check.yml (2 hunks)
  • .github/workflows/unit_tests.yml (1 hunks)
  • CONTRIBUTING.md (2 hunks)
  • CONTRIBUTORS.md (1 hunks)
  • DEVELOPER_NOTES.md (4 hunks)
  • README.md (4 hunks)
  • docs/CONTRIBUTING.md (1 hunks)
  • docs/CONTRIBUTORS.md (1 hunks)
  • docs/DEVELOPER_NOTES.md (1 hunks)
  • docs/LICENSE.md (1 hunks)
  • docs/_static/custom.css (1 hunks)
  • docs/_templates/sidebar_dhtech.html (1 hunks)
  • docs/conf.py (3 hunks)
  • docs/index.rst (1 hunks)
  • docs/readme.md (1 hunks)
  • docs/undate.rst (1 hunks)
  • pyproject.toml (1 hunks)
Additional context used
actionlint
.github/workflows/unit_tests.yml

37-37: property "python-cache" is not defined in object type {}

(expression)

LanguageTool
DEVELOPER_NOTES.md

[style] ~48-~48: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... sh pip install -e ".[dev]" ### Install pre-commit hooks ```sh pre-commit inst...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

Additional comments not posted (28)
docs/CONTRIBUTORS.md (1)

1-2: Approve the use of {include} directive.

The {include} directive is correctly used to incorporate content from ../CONTRIBUTORS.md, ensuring that updates to the contributors list are reflected across all documentation that includes this file.

docs/LICENSE.md (1)

1-4: Good use of Sphinx {include} directive.

The inclusion of the LICENSE.md file using the Sphinx {include} directive is a good practice. It ensures that the license information remains consistent across different parts of the documentation by maintaining a single source of truth.

docs/readme.md (1)

1-4: Effective use of Sphinx {include} directive with additional options.

Including the README.md using the Sphinx {include} directive along with options for relative paths is an effective way to ensure that the README content integrates seamlessly into the Sphinx documentation. The use of :relative-docs: and :relative-images: options helps in resolving paths correctly, which is crucial for maintaining link integrity in the documentation.

docs/_static/custom.css (1)

2-6: CSS Enhancements for Sphinx Sidebar.

The CSS rules applied to div.sphinxsidebar .powered_by a enhance the visual consistency of the sidebar by removing text decorations and borders, and centering the text. These changes are likely to improve the user interface of the documentation.

Consider verifying the visual consistency of these CSS changes across different browsers to ensure a uniform user experience.

docs/undate.rst (1)

Line range hint 1-8: Documentation Enhancements Approved

The shift to "API documentation" and the structured use of .. autoclass:: directives for the Undate and UndateInterval classes enhance the clarity and usability of the documentation. This approach ensures that all class members are documented, including those without explicit docstrings, which is crucial for maintaining an up-to-date and comprehensive API documentation.

docs/_templates/sidebar_dhtech.html (1)

1-8: Custom Sidebar Integration Approved

The new custom sidebar for the Sphinx documentation, featuring the DH-Tech logo and a link to the community page, enhances the visual appeal and usability of the documentation. This addition not only improves the aesthetics but also promotes greater community engagement by providing easy access to the DH-Tech community resources.

docs/index.rst (1)

1-16: Documentation Structure Enhancements Approved

The changes to the index.rst file, including the shift to lowercase in the title and the restructuring of the table of contents, are well-executed. The simplification of the navigation hierarchy by reducing the maxdepth to 2 and the reorganization to emphasize contributions and developer-related information significantly enhance the usability and focus of the documentation. These changes are likely to improve user experience and facilitate easier navigation and understanding of the library's development and contribution processes.

.github/workflows/check.yml (2)

16-21: Approve Python setup and cache configuration.

The upgrade to Python 3.12 and the update to the cache dependency path are aligned with modern Python practices. However, ensure compatibility with all project dependencies.

Verification successful

Python 3.12 Compatibility Confirmed

The pyproject.toml file confirms compatibility with Python 3.12, as it is explicitly listed among the supported versions. The upgrade should not introduce any compatibility issues with the project's dependencies.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify Python 3.12 compatibility with project dependencies.

# Test: Check for Python 3.12 compatibility issues in the project's dependency list.
cat pyproject.toml | grep -i "python"

Length of output: 640


32-32: Approve the change to the documentation build command.

Switching from tox -e docs to sphinx-build docs docs/_build simplifies the process and aligns with the PR's objectives to streamline tools. Ensure the output of the new command meets all documentation standards.

Verification successful

The change to use sphinx-build is valid.

The docs directory contains the necessary Sphinx configuration and structure, supporting the change from tox -e docs to sphinx-build docs docs/_build. Ensure that Sphinx is installed in the environment where the workflow runs.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the Sphinx documentation build output.

# Test: Build the documentation and check for errors or warnings.
sphinx-build docs docs/_build -W

Length of output: 114


Script:

#!/bin/bash
# Check for the presence of Sphinx configuration file in the docs directory.
fd conf.py docs

# List the contents of the docs directory to verify the structure.
ls -R docs

Length of output: 299

CONTRIBUTING.md (2)

1-1: Title Simplification Approved

The simplification of the title to "Contributing to undate" enhances clarity and focus, making it immediately clear what the document is about.


23-23: Link Update Approved

Updating the link to the examples folder to include a full URL improves navigation and clarity, ensuring contributors can easily locate the appropriate folder.

pyproject.toml (1)

2-92: Comprehensive Configuration Update Approved

The transition to using hatchling as the build system and the addition of new fields and sections in pyproject.toml modernize the project's configuration. These changes enhance the project's compatibility with contemporary Python packaging standards and improve metadata clarity.

Please ensure that these changes integrate smoothly with existing workflows and that all dependencies are correctly managed.

Run the following script to verify the integration with existing workflows:

docs/conf.py (1)

Line range hint 20-89: Documentation Configuration Update Approved

The updates to project metadata, Sphinx configuration, and theme settings in docs/conf.py enhance the documentation's functionality and user experience. The transition to the alabaster theme and the inclusion of the myst_parser extension are particularly noteworthy.

Please verify that all new configurations function as expected and that the documentation builds correctly with these settings.

Run the following script to verify the functionality of new configurations:

DEVELOPER_NOTES.md (4)

23-23: Clarification on git flow initialization approved.

The addition of explicit instructions for initializing git flow enhances the clarity and usability of the setup instructions.


58-64: Streamlining unit test instructions approved.

The simplification of the unit testing instructions to focus on pytest enhances clarity and aligns with modern Python practices.


66-66: Enhanced Python type checking instructions approved.

The detailed instructions for using mypy to enforce typing on pull requests improve the development workflow and ensure code quality.


77-89: Updated documentation building instructions approved.

The transition to using sphinx for building documentation is well-documented, providing clear and updated commands for generating HTML documentation.

CONTRIBUTORS.md (5)

1-1: Title change to 'All Contributors' approved.

The new title emphasizes inclusivity and aligns with the All Contributors initiative, enhancing the document's presentation.


6-6: Updated badge link for contributors approved.

The dynamic link to the GitHub repository's contributors page enhances the accuracy and functionality of the badge, promoting transparency and community engagement.


17-20: Expansion of contributor categories approved.

The addition of categories like "Ideas, Planning, & Feedback" provides a clearer and more comprehensive picture of each contributor's involvement, enhancing the document's functionality.


9-9: New section header 'Contributors' approved.

The addition of a clear section header improves document structure and navigation, making it easier for readers to find contributor information.


9-9: Inclusion of related blog posts approved.

The related blog posts section adds value by providing context and further reading opportunities, enhancing community engagement and document functionality.

README.md (3)

1-1: Title change to 'undate overview' approved.

The new title better reflects the purpose of the document and provides a clearer introduction to the library.


3-3: Addition of undate logo approved.

The inclusion of the logo enhances the visual appeal and branding of the library, making the README more engaging and informative.


22-22: Updated badge link for contributors approved.

The direct link to the CONTRIBUTORS.md file improves navigation and accessibility, making it easier for users to find detailed contribution information.

.github/workflows/unit_tests.yml (2)

33-33: Approved: Update to cache dependency path.

The update to use **/pyproject.toml for the cache dependency path aligns with modern Python packaging practices and the PR's objective to consolidate configuration files.


41-46: Approved: Transition to pytest for running tests.

The switch from tox to pytest simplifies the testing process and is a positive change. Ensure that pytest is correctly set up in the project and that all tests are appropriately configured to run with pytest.

Verification successful

Verified: pytest is correctly set up and used in the project.

The transition from tox to pytest for running tests is successful. The test files make extensive use of pytest features, confirming that the setup is correct and the tests are appropriately configured to run with pytest.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the `pytest` setup in the project.

# Test: Search for `pytest` configurations in the project. Expect: Correct setup and test configurations.
rg --type py -A 5 $'pytest' tests/

Length of output: 7069

.all-contributorsrc (1)

17-18: Approved: Enhancements to contributor roles.

The addition of new roles such as "ideas" and "review" for contributors broadens the recognition of diverse contributions, fostering greater community engagement and acknowledgment.

Also applies to: 42-44, 56-57

Copy link
Collaborator

@ColeDCrawford ColeDCrawford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice QOL updates and doc improvements. Always nice when a project has a logo too!

if: steps.python-cache.outputs.cache-hit != 'true'

# for all versions but the one we use for code coverage, run normally
- name: Run unit tests normally
run: tox
run: pytest
if: ${{ matrix.python != env.COV_PYTHON_VERSION }}

# run code coverage in one version only
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to swap this out and remove tox!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome

]
all = [
"undate[dev]",
"undate[test]",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeRabbit seems to be wrong about this - I like binding the two groups together into all

@rlskoeser rlskoeser merged commit a375e93 into develop Sep 5, 2024
5 checks passed
@rlskoeser rlskoeser deleted the feature/pyproject-setup-refactor branch September 5, 2024 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants