Skip to content

Commit

Permalink
Use PEP 517 for packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
christiansandberg committed Oct 10, 2021
1 parent cacc419 commit c46228f
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 38 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var/
.installed.cfg
*.egg
build-deb/
_version.py

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
10 changes: 4 additions & 6 deletions canopen/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
from pkg_resources import get_distribution, DistributionNotFound
from .network import Network, NodeScanner
from .node import RemoteNode, LocalNode
from .sdo import SdoCommunicationError, SdoAbortedError
from .objectdictionary import import_od, ObjectDictionary, ObjectDictionaryError
from .profiles.p402 import BaseNode402

Node = RemoteNode

try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
from ._version import version as __version__
except ImportError:
# package is not installed
__version__ = "unknown"

Node = RemoteNode

__pypi_url__ = "https://pypi.org/project/canopen/"
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[build-system]
requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "canopen/_version.py"
23 changes: 23 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[metadata]
name = canopen
description = CANopen stack implementation
long_description = file: README.rst
project_urls =
Documentation = http://canopen.readthedocs.io/en/stable/
Source Code = https://github.com/christiansandberg/canopen
author = Christian Sandberg
author_email = [email protected]
classifier =
Development Status :: 5 - Production/Stable
License :: OSI Approved :: MIT License
Operating System :: OS Independent
Programming Language :: Python :: 3 :: Only
Intended Audience :: Developers
Topic :: Scientific/Engineering

[options]
packages = find:
python_requires = >=3.6
install_requires =
python-can >= 3.0.0
include_package_data = True
34 changes: 2 additions & 32 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,3 @@
from setuptools import setup, find_packages
from setuptools import setup

description = open("README.rst").read()
# Change links to stable documentation
description = description.replace("/latest/", "/stable/")

setup(
name="canopen",
url="https://github.com/christiansandberg/canopen",
use_scm_version=True,
packages=find_packages(),
author="Christian Sandberg",
author_email="[email protected]",
description="CANopen stack implementation",
keywords="CAN CANopen",
long_description=description,
license="MIT",
platforms=["any"],
classifiers=[
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Intended Audience :: Developers",
"Topic :: Scientific/Engineering"
],
install_requires=["python-can>=3.0.0"],
extras_require={
"db_export": ["canmatrix"]
},
setup_requires=["setuptools_scm"],
include_package_data=True
)
setup()

0 comments on commit c46228f

Please sign in to comment.