abhinavk99/jikanpy

setup.py installs CHANGELOG.md in the root of dest dir

Closed this issue · 5 comments

The setup.py installs CHANGELOG.md in the root of dest dir, when installed system wide, it does do /usr/CHANGLOG.md. I believe this shouldn't happen.

Do you know where it should be installed? I'm not sure why it would install to /usr instead of in the root directory of the package. What commands are you running to install it?

whenever I install jikanpy, it puts the CHANGELOG.md into my ~/.local directory (so ~/.local/CHANGELOG.md)

I believe this is because its defined as a data_file and not part of the package_data:

https://github.com/abhinavk99/jikanpy/blob/master/setup.py#L19

https://stackoverflow.com/questions/4519127/setuptools-package-data-folder-location

The data_files parameter is for data files who isn't a part of the package. You should probably use package_data instead.

https://stackoverflow.com/questions/5192386/installing-my-sdist-from-pypi-puts-the-files-in-unexpected-places

Sorry for not responding, I've been busy with work and other things. I did an initial investigation and using package_data didn't seem to work so I'm kind of stumped. I'm not sure when I'll have more time to spend on this.

Hmm

The only reason you have it read the changelog is so that its part of the pypi description right?

Since versions are built locally (which will always have the changelog) and then pushed to pypi, so this doesn't really require the user to have the CHANGELOG.md file locally, its not needed for jikanpy to run.

Could make reading the changelog optional, and not include the changelog with the release, something like:

diff --git a/setup.py b/setup.py
index 1871a41..04dc3fa 100644
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,8 @@ from setuptools import setup
 
 HERE = pathlib.Path(__file__).parent
 README = (HERE / "README.md").read_text()
-CHANGELOG = (HERE / "CHANGELOG.md").read_text()
+CHANGELOG_FILE = (HERE / "CHANGELOG.md")
+CHANGELOG = CHANGELOG_FILE.read_text() if CHANGELOG_FILE.exists() else ""
 
 setup(
     name="jikanpy",
@@ -16,7 +17,6 @@ setup(
     author_email="abhinavkasamsetty@gmail.com",
     package_data={"jikanpy": ["py.typed"]},
     packages=["jikanpy"],
-    data_files=[(".", ["CHANGELOG.md"])],
     url="https://github.com/abhinavk99/jikanpy",
     install_requires=["requests", "aiohttp", "simplejson"],
     keywords=["jikan", "jikanpy", "api", "myanimelist"],

probably doesn't even need to be that safe, but doesn't hurt to do the check

Can PR that if that seems fine with you

If that is, would you want me to bump the minor version as well?

That sounds good to me, it'd be great if you could make the PR as well. I think we should bump the minor version since the package is getting changed.