Skip to content

Commit 04cea3d

Browse files
committed
Move to modern setuptools with pyproject.toml
Also moves the version to a common ̀`version.txt` that is read by both the .NET and Python builds.
1 parent e258cee commit 04cea3d

File tree

5 files changed

+59
-49
lines changed

5 files changed

+59
-49
lines changed

Directory.Build.props

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
<?xml version="1.0"?>
12
<Project>
23
<PropertyGroup>
3-
<VersionPrefix>3.0.0</VersionPrefix>
4-
<AssemblyCopyright>Copyright (c) 2006-2021 The Contributors of the Python.NET Project</AssemblyCopyright>
4+
<AssemblyCopyright>Copyright (c) 2006-2022 The Contributors of the Python.NET Project</AssemblyCopyright>
55
<AssemblyCompany>pythonnet</AssemblyCompany>
66
<AssemblyProduct>Python.NET</AssemblyProduct>
77
<LangVersion>10.0</LangVersion>
88
<IsPackable>false</IsPackable>
9+
<Version>$([System.IO.File]::ReadAllText("version.txt"))</Version>
910
</PropertyGroup>
1011
<ItemGroup>
1112
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
recursive-include src/ *
22
include Directory.Build.*
33
include pythonnet.sln
4+
include version.txt
45
global-exclude **/obj/* **/bin/*

pyproject.toml

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,53 @@
11
[build-system]
2-
requires = ["setuptools>=42", "wheel", "pycparser"]
2+
requires = ["setuptools>=61", "wheel"]
33
build-backend = "setuptools.build_meta"
44

5+
[project]
6+
name = "pythonnet"
7+
description = ".NET and Mono integration for Python"
8+
license = {text = "MIT"}
9+
10+
readme = "README.rst"
11+
12+
dependencies = [
13+
"clr_loader>=0.1.7"
14+
]
15+
16+
classifiers = [
17+
"Development Status :: 5 - Production/Stable",
18+
"Intended Audience :: Developers",
19+
"License :: OSI Approved :: MIT License",
20+
"Programming Language :: C#",
21+
"Programming Language :: Python :: 3",
22+
"Programming Language :: Python :: 3.7",
23+
"Programming Language :: Python :: 3.8",
24+
"Programming Language :: Python :: 3.9",
25+
"Programming Language :: Python :: 3.10",
26+
"Operating System :: Microsoft :: Windows",
27+
"Operating System :: POSIX :: Linux",
28+
"Operating System :: MacOS :: MacOS X",
29+
]
30+
31+
dynamic = ["version"]
32+
33+
[[project.authors]]
34+
name = "The Contributors of the Python.NET Project"
35+
email = "pythonnet@python.org"
36+
37+
[project.urls]
38+
Homepage = "https://pythonnet.github.io/"
39+
Sources = "https://github.com/pythonnet/pythonnet"
40+
41+
[tool.setuptools]
42+
zip-safe = false
43+
py-modules = ["clr"]
44+
45+
[tool.setuptools.dynamic.version]
46+
file = "version.txt"
47+
48+
[tool.setuptools.packages.find]
49+
include = ["pythonnet*"]
50+
551
[tool.pytest.ini_options]
652
xfail_strict = true
753
testpaths = [

setup.py

Lines changed: 7 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
#!/usr/bin/env python
22

3-
from setuptools import setup, Command, Extension
4-
from setuptools.command.build_ext import build_ext
53
import distutils
6-
from distutils.command import build
7-
from subprocess import check_output, check_call
4+
from distutils.command.build import build as _build
5+
from setuptools.command.develop import develop as _develop
6+
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
7+
from setuptools import Distribution
8+
from setuptools import setup, Command
89

9-
import sys, os
10+
import os
1011

1112
# Disable SourceLink during the build until it can read repo-format v1, #1613
1213
os.environ["EnableSourceControlManagerQueries"] = "false"
1314

15+
1416
class DotnetLib:
1517
def __init__(self, name, path, **kwargs):
1618
self.name = name
@@ -91,13 +93,6 @@ def run(self):
9193

9294

9395
# Add build_dotnet to the build tasks:
94-
from distutils.command.build import build as _build
95-
from setuptools.command.develop import develop as _develop
96-
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
97-
from setuptools import Distribution
98-
import setuptools
99-
100-
10196
class build(_build):
10297
sub_commands = _build.sub_commands + [("build_dotnet", None)]
10398

@@ -129,10 +124,6 @@ def finalize_options(self):
129124
"bdist_wheel": bdist_wheel,
130125
}
131126

132-
133-
with open("README.rst", "r") as f:
134-
long_description = f.read()
135-
136127
dotnet_libs = [
137128
DotnetLib(
138129
"python-runtime",
@@ -143,35 +134,5 @@ def finalize_options(self):
143134

144135
setup(
145136
cmdclass=cmdclass,
146-
name="pythonnet",
147-
version="3.0.0.dev1",
148-
description=".Net and Mono integration for Python",
149-
url="https://pythonnet.github.io/",
150-
project_urls={
151-
"Source": "https://github.com/pythonnet/pythonnet",
152-
},
153-
license="MIT",
154-
author="The Contributors of the Python.NET Project",
155-
author_email="pythonnet@python.org",
156-
packages=["pythonnet", "pythonnet.find_libpython"],
157-
install_requires=["clr_loader >= 0.1.7"],
158-
long_description=long_description,
159-
long_description_content_type="text/x-rst",
160-
py_modules=["clr"],
161137
dotnet_libs=dotnet_libs,
162-
classifiers=[
163-
"Development Status :: 5 - Production/Stable",
164-
"Intended Audience :: Developers",
165-
"License :: OSI Approved :: MIT License",
166-
"Programming Language :: C#",
167-
"Programming Language :: Python :: 3",
168-
"Programming Language :: Python :: 3.7",
169-
"Programming Language :: Python :: 3.8",
170-
"Programming Language :: Python :: 3.9",
171-
"Programming Language :: Python :: 3.10",
172-
"Operating System :: Microsoft :: Windows",
173-
"Operating System :: POSIX :: Linux",
174-
"Operating System :: MacOS :: MacOS X",
175-
],
176-
zip_safe=False,
177138
)

version.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0.0-dev1

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy