Skip to content

Commit c64066f

Browse files
committed
Package python-ldap with pyproject.toml
1 parent 30b24d5 commit c64066f

File tree

5 files changed

+188
-110
lines changed

5 files changed

+188
-110
lines changed

.coveragerc

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

Doc/installing.rst

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,23 @@ The CVS repository of FreeBSD contains the package
7676
macOS
7777
-----
7878

79-
You can install directly with pip::
79+
You can install directly with pip. First install Xcode command line tools::
8080

8181
$ xcode-select --install
82-
$ pip install python-ldap \
83-
--global-option=build_ext \
84-
--global-option="-I$(xcrun --show-sdk-path)/usr/include/sasl"
82+
83+
Then install python-ldap::
84+
85+
$ pip install python-ldap
86+
87+
For custom installations, you may need to set environment variables::
88+
89+
$ export CPPFLAGS="-I$(xcrun --show-sdk-path)/usr/include/sasl"
90+
$ pip install python-ldap
91+
92+
If using Homebrew::
93+
94+
$ brew install openldap
95+
$ pip install python-ldap
8596

8697

8798
.. _install-source:
@@ -90,11 +101,18 @@ Installing from Source
90101
======================
91102

92103

93-
python-ldap is built and installed using the Python setuptools.
94-
From a source repository::
104+
python-ldap is built and installed using modern Python packaging standards
105+
with pyproject.toml configuration. From a source repository::
106+
107+
$ pip install .
108+
109+
For development installation with editable mode::
110+
111+
$ pip install -e .
112+
113+
With optional development dependencies::
95114

96-
$ python -m pip install setuptools
97-
$ python setup.py install
115+
$ pip install -e .[dev,doc]
98116

99117
If you have more than one Python interpreter installed locally, you should
100118
use the same one you plan to use python-ldap with.

INSTALL

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Quick build instructions:
22

33
edit setup.cfg (see Build/ for platform-specific examples)
4-
python setup.py build
5-
python setup.py install
4+
python -m build
5+
pip install .
66

77
Detailed instructions are in Doc/installing.rst, or online at:
88

pyproject.toml

Lines changed: 156 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,157 @@
1+
[build-system]
2+
requires = [
3+
"setuptools>=61.0",
4+
"wheel",
5+
"setuptools-scm",
6+
]
7+
build-backend = "setuptools.build_meta"
8+
9+
[project]
10+
name = "python-ldap"
11+
license.text = "python-ldap" # Replace with 'license' once Python 3.8 is dropped
12+
dynamic = ["version"]
13+
description = "Python modules for implementing LDAP clients"
14+
# TODO: Make sure we have the info displayed correctly
15+
# long_description = """python-ldap:
16+
# python-ldap provides an object-oriented API to access LDAP directory servers
17+
# from Python programs. Mainly it wraps the OpenLDAP 2.x libs for that purpose.
18+
# Additionally the package contains modules for other LDAP-related stuff
19+
# (e.g. processing LDIF, LDAPURLs, LDAPv3 schema, LDAPv3 extended operations
20+
# and controls, etc.).
21+
# """
22+
authors = [
23+
{name = "python-ldap project", email = "python-ldap@python.org"},
24+
]
25+
readme = "README.rst"
26+
requires-python = ">=3.6"
27+
keywords = ["ldap", "directory", "authentication"]
28+
classifiers = [
29+
"Development Status :: 5 - Production/Stable",
30+
"Intended Audience :: Developers",
31+
"Intended Audience :: System Administrators",
32+
"Operating System :: OS Independent",
33+
"Operating System :: MacOS :: MacOS X",
34+
"Operating System :: Microsoft :: Windows",
35+
"Operating System :: POSIX",
36+
"Programming Language :: C",
37+
"Programming Language :: Python",
38+
"Programming Language :: Python :: 3",
39+
"Programming Language :: Python :: 3.6",
40+
"Programming Language :: Python :: 3.7",
41+
"Programming Language :: Python :: 3.8",
42+
"Programming Language :: Python :: 3.9",
43+
"Programming Language :: Python :: 3.10",
44+
"Programming Language :: Python :: 3.11",
45+
"Programming Language :: Python :: 3.12",
46+
"Programming Language :: Python :: 3.13",
47+
"Topic :: Database",
48+
"Topic :: Internet",
49+
"Topic :: Software Development :: Libraries :: Python Modules",
50+
"Topic :: System :: Systems Administration :: Authentication/Directory :: LDAP",
51+
"License :: OSI Approved :: Python Software Foundation License",
52+
]
53+
dependencies = [
54+
"pyasn1 >= 0.3.7",
55+
"pyasn1_modules >= 0.1.5",
56+
]
57+
58+
[project.urls]
59+
Homepage = "https://www.python-ldap.org/"
60+
Documentation = "https://python-ldap.readthedocs.io/"
61+
Repository = "https://github.com/python-ldap/python-ldap"
62+
Download = "https://pypi.org/project/python-ldap/"
63+
Changelog = "https://github.com/python-ldap/python-ldap/blob/main/CHANGES"
64+
65+
[project.optional-dependencies]
66+
dev = [
67+
"tox",
68+
"pytest",
69+
"coverage",
70+
"black",
71+
"isort",
72+
]
73+
doc = [
74+
"docutils",
75+
"markdown",
76+
"sphinx",
77+
"sphinxcontrib-spelling",
78+
]
79+
80+
[tool.setuptools]
81+
zip-safe = false
82+
include-package-data = true
83+
license-files = ["LICENCE", "LICENCE.MIT"]
84+
85+
[tool.setuptools.dynamic]
86+
version = {attr = "ldap.pkginfo.__version__"}
87+
88+
[tool.setuptools.packages.find]
89+
where = ["Lib"]
90+
91+
[tool.setuptools.package-dir]
92+
"" = "Lib"
93+
94+
[tool.black]
95+
line-length = 88
96+
target-version = ['py36', 'py37', 'py38', 'py39', 'py310', 'py311', 'py312']
97+
extend-exclude = '''
98+
/(
99+
\.eggs
100+
| \.git
101+
| \.hg
102+
| \.mypy_cache
103+
| \.tox
104+
| \.venv
105+
| _build
106+
| buck-out
107+
| build
108+
| dist
109+
| Modules
110+
)/
111+
'''
112+
1113
[tool.isort]
2-
line_length=88
3-
known_first_party=['ldap', '_ldap', 'ldapurl', 'ldif', 'slapdtest']
4-
sections=['FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER']
114+
profile = "black"
115+
line_length = 88
116+
known_first_party = ["ldap", "_ldap", "ldapurl", "ldif", "slapdtest"]
117+
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
118+
skip_glob = ["Modules/*"]
119+
120+
[tool.pytest.ini_options]
121+
testpaths = ["Tests"]
122+
python_files = ["t_*.py"]
123+
filterwarnings = [
124+
"error",
125+
"ignore::ldap.LDAPBytesWarning",
126+
]
127+
128+
[tool.coverage.run]
129+
branch = true
130+
source = [
131+
"ldap",
132+
"ldif",
133+
"ldapurl",
134+
"slapdtest",
135+
]
136+
137+
[tool.coverage.paths]
138+
source = [
139+
"Lib/",
140+
".tox/*/lib/python*/site-packages/",
141+
]
142+
143+
[tool.coverage.report]
144+
ignore_errors = false
145+
precision = 1
146+
exclude_lines = [
147+
"pragma: no cover",
148+
"raise NotImplementedError",
149+
"if 0:",
150+
"if __name__ == .__main__.:",
151+
"if PY2",
152+
"if not PY2",
153+
]
154+
155+
[tool.coverage.html]
156+
directory = "build/htmlcov"
157+
title = "python-ldap coverage report"

setup.py

Lines changed: 4 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
"""
2-
setup.py - Setup package with the help Python's DistUtils
2+
setup.py - C extension module configuration for python-ldap
33
44
See https://www.python-ldap.org/ for details.
5+
This file handles only the C extension modules (_ldap) configuration,
6+
while pyproject.toml handles all project metadata, dependencies, and other settings.
57
"""
68

79
import sys,os
@@ -54,52 +56,8 @@ class OpenLDAP2:
5456
LDAP_CLASS.extra_link_args.append('-pg')
5557
LDAP_CLASS.libs.append('gcov')
5658

57-
#-- Let distutils/setuptools do the rest
58-
name = 'python-ldap'
59-
59+
#-- C extension modules configuration only
6060
setup(
61-
#-- Package description
62-
name = name,
63-
license=pkginfo.__license__,
64-
version=pkginfo.__version__,
65-
description = 'Python modules for implementing LDAP clients',
66-
long_description = """python-ldap:
67-
python-ldap provides an object-oriented API to access LDAP directory servers
68-
from Python programs. Mainly it wraps the OpenLDAP 2.x libs for that purpose.
69-
Additionally the package contains modules for other LDAP-related stuff
70-
(e.g. processing LDIF, LDAPURLs, LDAPv3 schema, LDAPv3 extended operations
71-
and controls, etc.).
72-
""",
73-
author = 'python-ldap project',
74-
author_email = 'python-ldap@python.org',
75-
url = 'https://www.python-ldap.org/',
76-
download_url = 'https://pypi.org/project/python-ldap/',
77-
classifiers = [
78-
'Development Status :: 5 - Production/Stable',
79-
'Intended Audience :: Developers',
80-
'Intended Audience :: System Administrators',
81-
'Operating System :: OS Independent',
82-
'Operating System :: MacOS :: MacOS X',
83-
'Operating System :: Microsoft :: Windows',
84-
'Operating System :: POSIX',
85-
'Programming Language :: C',
86-
87-
'Programming Language :: Python',
88-
'Programming Language :: Python :: 3',
89-
'Programming Language :: Python :: 3.9',
90-
'Programming Language :: Python :: 3.10',
91-
'Programming Language :: Python :: 3.11',
92-
'Programming Language :: Python :: 3.12',
93-
'Programming Language :: Python :: 3.13',
94-
# Note: when updating Python versions, also change tox.ini and .github/workflows/*
95-
96-
'Topic :: Database',
97-
'Topic :: Internet',
98-
'Topic :: Software Development :: Libraries :: Python Modules',
99-
'Topic :: System :: Systems Administration :: Authentication/Directory :: LDAP',
100-
'License :: OSI Approved :: Python Software Foundation License',
101-
],
102-
#-- C extension modules
10361
ext_modules = [
10462
Extension(
10563
'_ldap',
@@ -135,28 +93,4 @@ class OpenLDAP2:
13593
]
13694
),
13795
],
138-
#-- Python "stand alone" modules
139-
py_modules = [
140-
'ldapurl',
141-
'ldif',
142-
143-
],
144-
packages = [
145-
'ldap',
146-
'ldap.controls',
147-
'ldap.extop',
148-
'ldap.schema',
149-
'slapdtest',
150-
'slapdtest.certs',
151-
],
152-
package_dir = {'': 'Lib',},
153-
data_files = LDAP_CLASS.extra_files,
154-
include_package_data=True,
155-
install_requires=[
156-
'pyasn1 >= 0.3.7',
157-
'pyasn1_modules >= 0.1.5',
158-
],
159-
zip_safe=False,
160-
python_requires='>=3.9',
161-
test_suite = 'Tests',
16296
)

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