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

Remove gulp from package data, code base and CI tests #3789

Merged
merged 8 commits into from
Apr 28, 2024

Conversation

DanielYang59
Copy link
Contributor

@DanielYang59 DanielYang59 commented Apr 28, 2024

Exclude gulp from package data

After removal, the package size decreased from 6.9 MB to 3.0 MB.

  • Should we even include them inside the code base?

  • Two test files are included but I'm not seeing them inside setup.py?:

    pymatgen-2024.4.13 % ls tests 
    test_cli.py test_pkg.py
    

Copy link

coderabbitai bot commented Apr 28, 2024

Walkthrough

The changes involve streamlining configurations, updating URLs, and enhancing error messages across the project files. These adjustments aim to improve setup clarity, documentation accuracy, and user guidance within the project components.

Changes

File Changed Summary of Changes
setup.py, .github/workflows/test.yml Removed redundant "cmd_line": ["**/*"] from setup.py package data. Eliminated GULP_LIB declaration and Ubuntu step in .github/workflows/test.yml.
pymatgen/command_line/gulp_caller.py Updated docstring URL to https://gulp.curtin.edu.au/index.html. Enhanced GulpError exception message with a download link.
.gitattributes, .pre-commit-config.yaml Adjusted file paths in .gitattributes for linguist-vendored. Modified exclusion pattern in .pre-commit-config.yaml to exclude tasks.py.

<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->
<!--


setup.py: ## Short Summary
Removed the `"cmd_line": ["**/*"],` entry from the `package_data` dictionary in `setup.py`.

## Alterations to the declarations of exported or public entities
- Removed `"cmd_line": ["**/*"],` from the `package_data` dictionary in `setup.py`.

---

.github/workflows/test.yml: ### Summary
In the `.github/workflows/test.yml` file:
- Removed the `GULP_LIB` environment variable declaration.
- Removed the step to copy GULP to bin for Ubuntu systems.

---

pymatgen/command_line/gulp_caller.py: ## Short Summary
The functionality change involves updating the URL in the docstring and enhancing the error message in the `GulpError` exception to include a download link.

## Alterations to the Declarations of Exported or Public Entities
- Docstring URL updated from `http://projects.ivec.org` to `https://gulp.curtin.edu.au/index.html`
- Exception message in `GulpError` modified to include a download link: 
  - Before: `raise GulpError("Executable not found")`
  - After: `raise GulpError("Executable not found, please download from https://gulp.curtin.edu.au/index.html.")`

---

.gitattributes: ## Alterations to the declarations of exported or public entities

- `cmd_line/*` in `.gitattributes` => Removed from `linguist-vendored`

---

.pre-commit-config.yaml: ## Short Summary
The change in functionality involves modifying the exclusion pattern in the configuration file `.pre-commit-config.yaml` to exclude a specific file (`tasks.py`) from certain processes.

## Alterations to the declarations of exported or public entities
- `exclude: ^(docs|tests/files|cmd_line|tasks.py)` in `.pre-commit-config.yaml` => `exclude: ^(docs|tests/files|tasks.py)` in `.pre-commit-config.yaml`

-->
<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->
<!--


### PR Objectives

The Pull Request #3789 aims to optimize the `pymatgen` package by excluding outdated `gulp` binaries and libraries, significantly reducing the package size from 6.9 MB to 3.0 MB. The PR questions the necessity of retaining these outdated elements in the codebase and highlights the absence of two test files (`test_cli.py` and `test_pkg.py`) in the `setup.py` configuration. These changes streamline the package content and potentially enhance its maintainability.

### Comments Summary

In the comments, there is a suggestion to direct users to download `gulp` from an external source if needed, as the original link seems to be broken. The discussion also points to a working link from Curtin University as an alternative. This implies a potential shift towards a more modular approach, where external dependencies like `gulp` are not bundled with the package but are recommended for separate installation if required.

### AI-Generated Summary of Generated Summaries

The PR #3789 optimizes the `pymatgen` package by removing outdated `gulp` components, leading to a substantial size reduction. Key changes include updating `setup.py` to exclude the `cmd_line` directory housing `gulp` files and enhancing error messages in `gulp_caller.py` to provide users with a download link for `gulp`. Adjustments in the test workflow and considerations for external `gulp` downloads indicate a shift towards a more streamlined and efficient package structure.

### Alterations to the Declarations of Exported or Public Entities

**File: `setup.py`**
- **Before Change:**
  - Included `"cmd_line": ["**/*"],` in the `package_data` dictionary.
  
- **After Change:**
  - Removed `"cmd_line": ["**/*"],` from `package_data`.

**File: `.github/workflows/test.yml`**
- **Before Change:**
  - Declared `GULP_LIB` environment variable.
  - Included a step to copy `GULP` to `bin` for Ubuntu systems.
  
- **After Change:**
  - Removed `GULP_LIB` environment variable declaration.
  - Eliminated the step to copy `GULP` to `bin` for Ubuntu systems.

**File: `pymatgen/command_line/gulp_caller.py`**
- **Before Change:**
  - Docstring URL: `http://projects.ivec.org`.
  - `GulpError` exception message: "Executable not found".
  
- **After Change:**
  - Updated docstring URL to `https://gulp.curtin.edu.au/index.html`.
  - Modified `GulpError` exception message to include a download link.

-->
<!-- end of auto-generated comment: short summary by coderabbit.ai -->

---

<details>

<summary>Recent Review Details</summary>

**Configuration used: .coderabbit.yaml**
**Review profile: CHILL**

<details>
<summary>Commits</summary>
Files that changed from the base of the PR and between c954808d504141ccb48ed6aab565ed9d914f9658 and 354b6d762df7ffff818d5d94b111977e7bf6556d.
</details>


<details>
<summary>Files selected for processing (3)</summary>

* .gitattributes (1 hunks)
* .pre-commit-config.yaml (1 hunks)
* setup.py (2 hunks)

</details>




<details>
<summary>Files skipped from review due to trivial changes (2)</summary>

* .gitattributes
* .pre-commit-config.yaml

</details>

<details>
<summary>Files skipped from review as they are similar to previous changes (1)</summary>

* setup.py

</details>





</details><!-- commit_ids_reviewed_start -->

<!-- d71dfcf446e44eafd5420ff90bed8b4b11752a5a -->
<!-- c954808d504141ccb48ed6aab565ed9d914f9658 -->
<!-- 354b6d762df7ffff818d5d94b111977e7bf6556d -->

<!-- commit_ids_reviewed_end --><!-- tips_start -->

---

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?

<details>
<summary>Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):

- 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.`

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 as PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai help` to get help.


Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.

### CodeRabbit Configration 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](https://docs.coderabbit.ai/guides/configure-coderabbit) 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](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

@DanielYang59
Copy link
Contributor Author

@coderabbitai ignore

@janosh janosh added ux User experience pkg Package health and distribution related stuff labels Apr 28, 2024
Copy link
Member

@janosh janosh left a comment

Choose a reason for hiding this comment

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

Should we even include them inside the code base?

i think it would be much better to remove and point people at the download page for GULP in a message to the user if pymatgen can't find the binary. but needs to be confirmed with @shyuep

@DanielYang59
Copy link
Contributor Author

Should we even include them inside the code base?

i think it would be much better to remove and point people at the download page for GULP in a message to the user if pymatgen can't find the binary.

Yes I agree with this. But the original link does not work on my side for some reason?

"""Interface with command line GULP.
http://projects.ivec.org
WARNING: you need to have GULP installed on your system.
"""

But this website from Curtin University seems to work (I'm not sure if these two point to the same package though): https://gulp.curtin.edu.au/index.html

@@ -61,11 +60,6 @@ jobs:
- name: Install uv
run: micromamba run -n pmg pip install uv

- name: Copy GULP to bin
Copy link
Contributor Author

@DanielYang59 DanielYang59 Apr 28, 2024

Choose a reason for hiding this comment

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

I removed tests for gulp from CI because it's not being run (nor supported to run) anyway:

gulp_present = which("gulp") and os.getenv("GULP_LIB") and ("win" not in sys.platform)
# disable gulp tests for now. Right now, it is compiled against libgfortran3, which is no longer supported in the new
# Ubuntu 20.04.
gulp_present = False

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

Out of diff range and nitpick comments (1)
pymatgen/command_line/gulp_caller.py (1)

659-659: The updated error message in the GulpCaller constructor now helpfully includes a download link, which is a good user experience improvement.

Consider adding more specific error handling for different failure scenarios, such as permissions issues or network problems, to provide more targeted guidance to the user.

@DanielYang59 DanielYang59 requested a review from janosh April 28, 2024 13:34
…m vendored files in .gitattributes and from exclude patterns in .pre-commit-config.yaml
Copy link
Member

@janosh janosh left a comment

Choose a reason for hiding this comment

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

thanks so much @DanielYang59. this is excellent!! will result in shorter install times from the next pymatgen release onwards thanks to no longer downloading outdated gulp files.

btw, there's this nice tool that allows you to get a list of files in a pypi package

@janosh janosh merged commit c9292ed into materialsproject:master Apr 28, 2024
22 checks passed
@DanielYang59 DanielYang59 deleted the package branch April 29, 2024 01:48
@DanielYang59
Copy link
Contributor Author

DanielYang59 commented Apr 29, 2024

thanks so much @DanielYang59. this is excellent!! will result in shorter install times from the next pymatgen release onwards thanks to no longer downloading outdated gulp files.

Thanks for reviewing. Not sure about the installation time, but the package size is reduced by half :) The GULP package has been sneaky inside the package for such a long time.

btw, there's this nice tool that allows you to get a list of files in a pypi package

Thanks for sharing, it would be very helpful.

Meanwhile it might be hard to automate the download process because the new website requires a form being filled.

i think it's fine to ask users to install manually. this is not core pymatgen functionality

I'm more concerned about autonomous package downloading in CI tests, but we would see when we need it because it's not supported by Ubuntu 20.04 afterwards anyway.

@DanielYang59 DanielYang59 changed the title Exclude gulp from package data Remove gulp from package data, code base and CI tests Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg Package health and distribution related stuff ux User experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants