Skip to content

Commit

Permalink
Move project metadata to pyproject.toml (frescobaldi#155)
Browse files Browse the repository at this point in the history
Modern Python packaging standards rely on static metadata in
pyproject.toml rather than dynamic metadata in setup.py, which is
considered deprecated.

Porting notes:

- In modern packaging, console scripts are installed via entry points.
  The bin/ directory containing the ly and ly-server scripts is removed;
  instead, entry points specify a module and function to run, and pip
  automatically creates a wrapper script when installing the project.

- The pkginfo is trimmed down to contain only the version. This is
  because pyproject.toml is not Python code, and the ways in which it
  can read metadata dynamically are limited. The conf.py file for Sphinx
  now declares the metadata as well; this might be considered duplication,
  but things like the name 'python-ly' and the author 'Wilbert Berendsen'
  are unlikely to change.

- There are now a few more URLs in the [project.urls] table.

- This does not use setuptools_scm to display the version, but that could
  be done in the future (see frescobaldi#148). However, getting the version for conf.py
  needs having the package installed, so this will impose certain constraints
  for developers.

- This change was tested by executing "python -m build" before and after,
  unpacking the sdists, and checking that the differences were intended.
  • Loading branch information
jeanas authored and ksnortum committed Jul 7, 2023
1 parent 77f2fe4 commit 002073f
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 156 deletions.
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ include README.rst INSTALL.rst ChangeLog
include doc/*.rst
include doc/conf.py
include doc/Makefile
include ly/xml/*.ly
include ly/xml/*.ily
global-exclude *~
4 changes: 0 additions & 4 deletions bin/ly

This file was deleted.

4 changes: 0 additions & 4 deletions bin/ly-server

This file was deleted.

22 changes: 11 additions & 11 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
sys.path.insert(0, os.path.abspath('..'))
import ly.pkginfo


# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
Expand All @@ -49,8 +48,8 @@
master_doc = 'index'

# General information about the project.
project = ly.pkginfo.name
copyright = u'2015, ' + ly.pkginfo.maintainer
project = 'python-ly'
copyright = '2015, Wilbert Berendsen'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -233,9 +232,9 @@
# (source start file, name, description, authors, manual section).
man_pages = [
('command', 'ly', u'Manipulate LilyPond source files',
[ly.pkginfo.maintainer], 1),
['Wilbert Berendsen'], 1),
('servercmd', 'ly-server', u'Manipulate LilyPond source files via HTTP',
[ly.pkginfo.maintainer], 1),
['Wilbert Berendsen'], 1),
]

# If true, show URL addresses after external links.
Expand All @@ -248,8 +247,9 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', ly.pkginfo.name, u'python-ly Documentation',
u'Author', ly.pkginfo.name, ly.pkginfo.description,
('index', 'python-ly', 'python-ly Documentation',
'Author', 'python-ly',
'Tool and library for manipulating LilyPond files',
'Miscellaneous'),
]

Expand All @@ -269,10 +269,10 @@
# -- Options for Epub output ----------------------------------------------

# Bibliographic Dublin Core info.
epub_title = ly.pkginfo.name
epub_author = ly.pkginfo.maintainer
epub_publisher = ly.pkginfo.maintainer
epub_copyright = u'2015, ' + ly.pkginfo.maintainer
epub_title = 'python-ly'
epub_author = 'Wilbert Berendsen'
epub_publisher = 'Wilbert Berendsen'
epub_copyright = '2015, Wilbert Berendsen'

# The basename for the epub file. It defaults to the project name.
#epub_basename = u'ly'
Expand Down
9 changes: 0 additions & 9 deletions doc/ly.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,6 @@ ly.node module
:undoc-members:
:show-inheritance:

ly.pkginfo module
-----------------

.. automodule:: ly.pkginfo
:members:
:member-order: bysource

ly.reformat module
------------------

Expand Down Expand Up @@ -155,5 +148,3 @@ ly.words module
:members:
:undoc-members:
:show-inheritance:


3 changes: 1 addition & 2 deletions ly/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
Document class automatically parses and tokenizes the text, also when its
contents are changed.
A music tree can be built from a document using the ly.music module.
A music tree can be built from a document using the ly.music module.
In the near future, music trees can be built from scratch and also generate
LilyPond output from scratch. At that moment, ly.dom is deprecated.
Expand All @@ -52,4 +52,3 @@
"""

54 changes: 1 addition & 53 deletions ly/pkginfo.py
Original file line number Diff line number Diff line change
@@ -1,55 +1,3 @@
# This file is part of python-ly, https://pypi.python.org/pypi/python-ly
#
# Copyright (c) 2014 - 2015 by Wilbert Berendsen
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# See http://www.gnu.org/licenses/ for more information.
"""Meta-information about the LY package."""

"""
Meta-information about the LY package.
This information is used by the install script, and also for the
command ``ly --version``.
"""

from __future__ import unicode_literals

#: name of the package
name = "python-ly"

#: the current version
version = "0.9.7"

#: short description
description = "Tool and library for manipulating LilyPond files"

#: long description
long_description = \
"The python-ly package provides a Python library and a commandline tool " \
"that can be used to parse and manipulate LilyPond source files."

#: maintainer name
maintainer = "Wilbert Berendsen"

#: maintainer email
maintainer_email = "[email protected]"

#: homepage
url = "https://github.com/wbsoft/python-ly"

#: license
license = "GPL"

36 changes: 36 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[build-system]
requires = ["setuptools >= 64"]
build-backend = "setuptools.build_meta"

[project]
name = "python-ly"
description = "Tool and library for manipulating LilyPond files"
readme = "README.rst"
license.text = "GPL"
maintainers = [{name = "Wilbert Berendsen", email = "[email protected]"}]
classifiers = [
'Development Status :: 4 - Beta',
#'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: GNU General Public License (GPL)',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Topic :: Multimedia :: Sound/Audio',
'Topic :: Text Editors',
]
dynamic = ["version"]

[project.urls]
Homepage = "https://github.com/frescobaldi/python-ly"
Documentation = "https://python-ly.readthedocs.io"
Repository = "https://github.com/frescobaldi/python-ly"
"Issue tracker" = "https://github.com/frescobaldi/python-ly/issues"

[project.scripts]
ly = "ly.cli.main:main"
ly-server = "ly.server.main:main"

[tool.setuptools.dynamic]
version.attr = "ly.pkginfo.version"
73 changes: 0 additions & 73 deletions setup.py

This file was deleted.

0 comments on commit 002073f

Please sign in to comment.