Skip to content

Commit 09d7611

Browse files
committed
pyproject
1 parent f99a4b8 commit 09d7611

File tree

6 files changed

+86
-70
lines changed

6 files changed

+86
-70
lines changed

.github/workflows/pythonpackage.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ jobs:
2626
- name: Install dependencies
2727
run: |
2828
python -m pip install --upgrade pip
29-
pip install -r requirements-dev.txt
30-
pip install -e .
29+
pip install .[dev]
3130
- name: Test with pytest
3231
run: |
3332
pytest

publish.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# build and publish to
22
# https://pypi.org/project/livelossplot/
3-
rm -r dist/
4-
python setup.py sdist bdist_wheel
3+
rm -rf dist/
4+
python -m build
55
twine upload dist/*

pyproject.toml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "livelossplot"
7+
dynamic = ["version"] # Version is read from version.py via setuptools config
8+
description = "Live training loss plot in Jupyter Notebook for Keras, PyTorch and others."
9+
readme = "README.md"
10+
requires-python = ">=3.7"
11+
license = {text = "MIT"}
12+
keywords = ["keras", "pytorch", "plot", "chart", "deep-learning"]
13+
authors = [
14+
{name = "Piotr Migdał", email = "[email protected]"}
15+
]
16+
classifiers = [
17+
"Development Status :: 4 - Beta",
18+
"Framework :: Jupyter",
19+
"Intended Audience :: Developers",
20+
"Intended Audience :: Education",
21+
"Intended Audience :: Science/Research",
22+
"Topic :: Scientific/Engineering",
23+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
24+
"Topic :: Scientific/Engineering :: Visualization",
25+
"License :: OSI Approved :: MIT License",
26+
"Programming Language :: Python :: 3",
27+
"Programming Language :: Python :: 3.7",
28+
"Programming Language :: Python :: 3.8",
29+
"Programming Language :: Python :: 3.9",
30+
"Programming Language :: Python :: 3.10",
31+
"Programming Language :: Python :: 3.11",
32+
"Programming Language :: Python :: 3.12",
33+
]
34+
dependencies = [
35+
'ipython==7.*; python_version<"3.8"',
36+
'matplotlib',
37+
'bokeh',
38+
'numpy<1.22; python_version<"3.8"',
39+
]
40+
41+
[project.urls]
42+
Homepage = "https://github.com/stared/livelossplot"
43+
44+
[project.optional-dependencies]
45+
dev = [
46+
"pytest",
47+
"flake8",
48+
"twine",
49+
"wheel",
50+
"build",
51+
# Add other dev dependencies if needed (e.g., from the old requirements-dev.txt)
52+
]
53+
54+
[tool.setuptools.dynamic]
55+
# Read version from livelossplot/version.py
56+
version = {attr = "livelossplot.version.__version__"}
57+
58+
[tool.setuptools.packages.find]
59+
# Look for packages in the root directory (no src layout)
60+
where = ["."]
61+
62+
[tool.flake8]
63+
exclude = ".git,*migrations*,build*,old*,dist"
64+
max-line-length = 120
65+
66+
[tool.yapf]
67+
based_on_style = "facebook"
68+
column_limit = 120
69+
70+
# --- Add configuration for tools like flake8 if desired ---
71+
# Example: [tool.flake8]
72+
# ignore = "E501,W503"
73+
# max-line-length = 88
74+
# exclude = ".git,__pycache__,build,dist"

requirements-dev.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

setup.cfg

Lines changed: 0 additions & 7 deletions
This file was deleted.

setup.py

Lines changed: 9 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,13 @@
1-
from setuptools import setup, find_packages
2-
from os import path
3-
import re
4-
5-
6-
def readme():
7-
with open('README.md', encoding='utf-8') as f:
8-
return f.read()
9-
10-
11-
def version():
12-
this_directory = path.abspath(path.dirname(__file__))
13-
with open(path.join(this_directory, 'livelossplot/version.py')) as f:
14-
version_file = f.read()
15-
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
16-
version = version_match.group(1)
17-
18-
return version
1+
from setuptools import setup
192

3+
# Most configuration is now in pyproject.toml
4+
# This setup.py remains for compatibility and
5+
# potentially for features not yet supported in pyproject.toml
6+
# or for dynamic configuration needs.
207

218
setup(
22-
name='livelossplot',
23-
version=version(),
24-
python_requires=">=3.7",
25-
install_requires=[
26-
'ipython==7.*;python_version<"3.8"',
27-
'matplotlib', 'bokeh',
28-
'numpy<1.22;python_version<"3.8"',
29-
],
30-
description='Live training loss plot in Jupyter Notebook for Keras, PyTorch and others.',
31-
long_description=readme(),
32-
long_description_content_type='text/markdown',
33-
url='https://github.com/stared/livelossplot',
34-
author='Piotr Migdał',
35-
author_email='[email protected]',
36-
keywords=['keras', 'pytorch', 'plot', 'chart', 'deep-learning'],
37-
license='MIT',
38-
classifiers=[
39-
'Development Status :: 4 - Beta',
40-
'Framework :: Jupyter',
41-
'Intended Audience :: Developers',
42-
'Intended Audience :: Education',
43-
'Intended Audience :: Science/Research',
44-
'Topic :: Scientific/Engineering',
45-
'Topic :: Scientific/Engineering :: Artificial Intelligence',
46-
'Topic :: Scientific/Engineering :: Visualization',
47-
'License :: OSI Approved :: MIT License',
48-
'Programming Language :: Python :: 3',
49-
'Programming Language :: Python :: 3.7',
50-
'Programming Language :: Python :: 3.8',
51-
'Programming Language :: Python :: 3.9',
52-
'Programming Language :: Python :: 3.10',
53-
'Programming Language :: Python :: 3.11',
54-
'Programming Language :: Python :: 3.12',
55-
],
56-
packages=find_packages(),
57-
zip_safe=False
9+
# If you need to pass specific arguments to setuptools that
10+
# cannot be configured in pyproject.toml, you can add them here.
11+
# For example:
12+
# ext_modules=...
5813
)

0 commit comments

Comments
 (0)