From 63fa7102ffc3187577db2017e93597026bbff415 Mon Sep 17 00:00:00 2001 From: Killian Date: Tue, 5 Mar 2024 00:00:45 -0500 Subject: [PATCH] update --- MANIFEST.in | 3 +-- README.md | 3 +++ pyproject.toml | 3 +-- setup.cfg | 4 --- setup.py | 73 +++++++++++++++++--------------------------------- 5 files changed, 30 insertions(+), 56 deletions(-) delete mode 100644 setup.cfg diff --git a/MANIFEST.in b/MANIFEST.in index 14c752d..67c7fd2 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1 @@ -global-include *.mplstyle -global-include *.md \ No newline at end of file +global-include *.mplstyle \ No newline at end of file diff --git a/README.md b/README.md index 0a38e4f..49acd71 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,9 @@ ![PyPI Version](https://img.shields.io/pypi/v/LovelyPlots.svg) ![PyPI Downloads](https://static.pepy.tech/badge/LovelyPlots) [![doi](https://img.shields.io/badge/DOI-10.5281%2Fzenodo.6903937-blue)]( http://doi.org/10.5281/zenodo.6903937) +> **Warning** +> : As of version 1.0.0, you need to add ``import LovelyPlots`` before setting the style (``plt.style.use('ipynb')``). + LovelyPlots is a repository containing ``matplotlib`` style sheets to nicely format figures for scientific papers, thesis and presentations while keeping them fully editable in ``Adobe Illustrator``. Additonaly, ``.svg`` exports options allows figures to automatically adapt their font to your document's font. For example, ``.svg`` figures imported in a ``.tex`` file will automatically be generated with the text font used in your ``.tex`` file.

diff --git a/pyproject.toml b/pyproject.toml index 5ff220e..63d41d7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,2 @@ [build-system] -requires = ["setuptools", "matplotlib"] - +requires = ["setuptools", "matplotlib"] \ No newline at end of file diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 8bfd5a1..0000000 --- a/setup.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[egg_info] -tag_build = -tag_date = 0 - diff --git a/setup.py b/setup.py index 4087963..1cfe802 100644 --- a/setup.py +++ b/setup.py @@ -2,59 +2,44 @@ # to setup on Pypi: https://towardsdatascience.com/how-to-upload-your-python-package-to-pypi-de1b363a1b3 -"""Install SciencePlots. -This script (setup.py) will copy the matplotlib styles (*.mplstyle) into the -appropriate directory on your computer (OS dependent). -This code is based on a StackOverflow answer: -https://stackoverflow.com/questions/31559225/how-to-ship-or-distribute-a-matplotlib-stylesheet +"""Install LovelyPlots. + +This script (setup.py) will install the LovelyPlots package. +In order to expose .mplstyle files to matplotlib, "import lovelyplots" +must be called before plt.style.use(...). """ -import atexit -import glob import os -import shutil - -import matplotlib -from setuptools import setup, find_packages -from setuptools.command.install import install - - -def install_styles(): - # Find all style files - stylefiles = glob.glob("LovelyPlots/styles/**/*.mplstyle", recursive=True) - # Find stylelib directory (where the *.mplstyle files go) - mpl_stylelib_dir = os.path.join(matplotlib.get_configdir(), "stylelib") - if not os.path.exists(mpl_stylelib_dir): - os.makedirs(mpl_stylelib_dir) - # Copy files over - print("Installing styles into", mpl_stylelib_dir) - for stylefile in stylefiles: - print(os.path.basename(stylefile)) - print(mpl_stylelib_dir) - shutil.copy(stylefile, os.path.join(mpl_stylelib_dir, os.path.basename(stylefile))) - - -class PostInstallMoveFile(install): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - atexit.register(install_styles) +from setuptools import setup # Get description from README root = os.path.abspath(os.path.dirname(__file__)) -with open(os.path.join(root, "README.md"), "r", encoding="utf-8") as f: +with open(os.path.join(root, 'README.md'), 'r', encoding='utf-8') as f: long_description = f.read() setup( - name="LovelyPlots", - version="0.0.27", - packages=find_packages(exclude=["tests.*", "tests", "figs", "examples"]), + name='LovelyPlots', + version='1.0.0', author="Killian Sheriff", - author_email="ksheriff@mit.edu", + author_email="killian.sheriff@gmail.com", description="Format Matplotlib Plots for thesis, scientific papers and reports.", long_description=long_description, - long_description_content_type="text/markdown", + long_description_content_type='text/markdown', license="MIT", + url="https://github.com/killiansheriff/LovelyPlots", + + install_requires=['matplotlib'], + packages=["LovelyPlots"], + package_data={ + 'scienceplots': ['styles/**/*.mplstyle'], + }, + + classifiers=[ + 'Framework :: Matplotlib', + 'License :: OSI Approved :: MIT License', + 'Programming Language :: Python :: 3' + ], keywords=[ "matplotlib-style-sheets", "matplotlib-figures", @@ -66,12 +51,4 @@ def __init__(self, *args, **kwargs): "Latex", "latex-figures", ], - url="https://github.com/killiansheriff/LovelyPlots", - install_requires=[ - "matplotlib", - ], - cmdclass={ - "install": PostInstallMoveFile, - }, - include_package_data=True, -) +) \ No newline at end of file