rbanffy / pip-chill

A more relaxed `pip freeze`
Other
555 stars 25 forks source link

Enable python -m pip-chill #42

Closed ckartchner closed 3 years ago

ckartchner commented 3 years ago

Hi Ricardo. Thanks for your work on this project! It has helped me clean-up some of the sprawling dependencies in a few of the web applications I work on. :+1:

As an attempt to give back, I've tried to address issue #30 (pip-chill not executable as a package) with this PR

For packages that use no special characters, adding a __main__.py to the package directory is enough to enable python -m <package_name>, however, in this case, since the package is in the directory pip_chill (and pip-chill is an invalid module name), this only enables python -m pip_chill and not python -m pip-chill.

The work around in this PR is to both add a pip-chill.py to the top level directory which behaves identically to the __main__.py, and add this file to the py_modules section of setup.py

With these changes, python -m pip-chill, python -m pip_chill and pip-chill are all valid ways to execute the program.

The inspiration for this change came from the solution pip-run is using.


As an aside, maybe consider increasing the amount of time it takes for an issue to auto-close as stale, or remove auto-closing all together? I started looking at this issue last weekend, but didn't comment as I was merely exploring and didn't want to make any commitments. I was surprised to find the issue closed when I came back to create my PR today. It looks like this isn't the first potentially useful enhancement that auto-closer has moved to the closed pile.

sourcery-ai[bot] commented 3 years ago

Sourcery Code Quality Report

βœ…  Merging this PR will increase code quality in the affected files by 0.27%.

Quality metrics Before After Change
Complexity 0.40 ⭐ 0.42 ⭐ 0.02 πŸ‘Ž
Method Length 33.33 ⭐ 32.70 ⭐ -0.63 πŸ‘
Working memory 7.55 πŸ™‚ 7.35 πŸ™‚ -0.20 πŸ‘
Quality 85.76% ⭐ 86.03% ⭐ 0.27% πŸ‘
Other metrics Before After Change
Lines 194 207 13
Changed files Quality Before Quality After Quality Change
setup.py 53.93% πŸ™‚ 53.52% πŸ™‚ -0.41% πŸ‘Ž
pip_chill/init.py 98.83% ⭐ 99.00% ⭐ 0.17% πŸ‘
tests/test_pip_chill.py 87.48% ⭐ 87.43% ⭐ -0.05% πŸ‘Ž

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
tests/test_pip_chill.py TestPip_chill.test_pip_ommitted.test_all.test_hashes.test_command_line_interface_omits_ignored 1 ⭐ 52 ⭐ 10 😞 75.17% ⭐ Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

The πŸ‘ and πŸ‘Ž indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Let us know what you think of it by mentioning @sourcery-ai in a comment.

github-actions[bot] commented 3 years ago

Stale pull request message