Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1016 - migrate setup.py to pyproject.toml #1311

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/test_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ jobs:
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ hashFiles('setup.py') }}-${{ hashFiles('test-requirements.txt') }}
key: ${{ hashFiles('setup.py') }}-${{ hashFiles('pyproject.toml') }}
- name: Install cartography
run: |
pip install -e .
pip install -r test-requirements.txt
pip install .[dev]
- name: Wait for neo4j 4 to be ready
timeout-minutes: 1
run: (docker logs -f neo4j-4 & ) | grep -q Started
Expand Down Expand Up @@ -77,11 +77,11 @@ jobs:
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ hashFiles('setup.py') }}-${{ hashFiles('test-requirements.txt') }}
key: ${{ hashFiles('setup.py') }}-${{ hashFiles('pyproject.toml') }}
- name: Install cartography
run: |
pip install -e .
pip install -r test-requirements.txt
pip install .[dev]
- name: Wait for neo4j 5 to be ready
timeout-minutes: 1
run: (docker logs -f neo4j-5 & ) | grep -q Started
Expand Down
8 changes: 2 additions & 6 deletions cartography/util.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import asyncio
import logging
import re
import sys
from functools import partial
from functools import wraps
from importlib.resources import open_binary
from importlib.resources import read_text
from string import Template
from typing import Any
from typing import Awaitable
Expand All @@ -30,11 +31,6 @@
from cartography.stats import ScopedStatsClient


if sys.version_info >= (3, 7):
from importlib.resources import open_binary, read_text
else:
from importlib_resources import open_binary, read_text

logger = logging.getLogger(__name__)


Expand Down
2 changes: 1 addition & 1 deletion dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RUN apt-get update && \
# Install dependencies.
WORKDIR /var/cartography
COPY . /var/cartography
RUN pip install -r test-requirements.txt && \
RUN pip install .[dev] && \
pip install -U -e . && \
chmod -R a+w /var/cartography

Expand Down
105 changes: 105 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
[build-system]
requires = [
"setuptools",
"setuptools-scm",
"wheel"
]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
# See configuration details in https://github.com/pypa/setuptools_scm
write_to = "cartography/_version.py"

[project]
name = "cartography"
description = "Explore assets and their relationships across your technical infrastructure."
readme = "README.md"
license = {text = "apache2"}
maintainers = [
{ name = "Cartography Contributors" }
]
classifiers = [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Natural Language :: English',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.10',
'Topic :: Security',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
]
requires-python = ">=3.10"
dependencies = [
"backoff>=2.1.2",
"boto3>=1.15.1",
"botocore>=1.18.1",
"dnspython>=1.15.0",
"neo4j>=4.4.4,<5.0.0",
"policyuniverse>=1.1.0.0",
"google-api-python-client>=1.7.8",
"oauth2client>=4.1.3",
"marshmallow>=3.0.0rc7",
"oci>=2.71.0",
"okta<1.0.0",
"pyyaml>=5.3.1",
"requests>=2.22.0",
"statsd",
"packaging",
"python-digitalocean>=1.16.0",
"adal>=1.2.4",
"azure-cli-core>=2.26.0",
"azure-mgmt-compute>=5.0.0",
"azure-mgmt-resource>=10.2.0",
"azure-mgmt-cosmosdb>=6.0.0",
"msrestazure >= 0.6.4",
"azure-mgmt-storage>=16.0.0",
"azure-mgmt-sql<=1.0.0",
"azure-identity>=1.5.0",
"kubernetes>=22.6.0",
"pdpyras>=4.3.0",
"crowdstrike-falconpy>=0.5.1",
"python-dateutil",
"xmltodict",
"duo-client",
]
# Comes from Git tag
dynamic = [ "version" ]

# TODO when moving to uv or something other than pip, move this to [dependency-groups].dev.
[project.optional-dependencies]
dev = [
"backoff>=2.1.2",
"moto",
"pre-commit",
"pytest>=6.2.4",
"pytest-mock",
"pytest-cov==2.10.0",
"pytest-rerunfailures",
"types-PyYAML",
"types-requests<2.31.0.7",
]

# Makes sure to look inside cartography/cartography/ for cli command
[tool.setuptools.packages.find]
where = ["."]
include = ["cartography*"]

[project.scripts]
cartography = "cartography.cli:main"
cartography-detectdrift = "cartography.driftdetect.cli:main"

[tool.setuptools.package-data]
"cartography" = ["py.typed"]
"cartography.data" = ["*.cypher", "*.yaml"]
"cartography.data.jobs.analysis" = ["*.json"]
"cartography.data.jobs.scoped_analysis" = ["*.json"]
"cartography.data.jobs.cleanup" = ["*.json"]

[project.urls]
Homepage = "https://cartography-cncf.github.io/cartography"
Documentation = "https://cartography-cncf.github.io/cartography"
Repository = "https://github.com/cartography-cncf/cartography"
Issues = "https://github.com/cartography-cncf/cartography/issues"
Changelog = "https://github.com/cartography-cncf/cartography/releases"
88 changes: 1 addition & 87 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,90 +1,4 @@
from setuptools import find_packages
from setuptools import setup

__version__ = '0.98.0rc2'


setup(
name='cartography',
version=__version__,
description='Explore assets and their relationships across your technical infrastructure.',
long_description='file: README.md',
long_description_content_type='text/markdown',
url='https://www.github.com/cartography-cncf/cartography',
maintainer='Cartography Contributors',
license='apache2',
packages=find_packages(exclude=['tests*']),
package_data={
'cartography': ['py.typed'],
'cartography.data': [
'*.cypher',
'*.yaml',
],
'cartography.data.jobs.analysis': [
'*.json',
],
'cartography.data.jobs.scoped_analysis': [
'*.json',
],
'cartography.data.jobs.cleanup': [
'*.json',
],
},
dependency_links=[],
install_requires=[
"backoff>=2.1.2",
"boto3>=1.15.1",
"botocore>=1.18.1",
"dnspython>=1.15.0",
"neo4j>=4.4.4,<5.0.0",
"policyuniverse>=1.1.0.0",
"google-api-python-client>=1.7.8",
"oauth2client>=4.1.3",
"marshmallow>=3.0.0rc7",
"oci>=2.71.0",
"okta<1.0.0",
"pyyaml>=5.3.1",
"requests>=2.22.0",
"statsd",
"packaging",
"python-digitalocean>=1.16.0",
"adal>=1.2.4",
"azure-cli-core>=2.26.0",
"azure-mgmt-compute>=5.0.0",
"azure-mgmt-resource>=10.2.0",
"azure-mgmt-cosmosdb>=6.0.0",
"msrestazure >= 0.6.4",
"azure-mgmt-storage>=16.0.0",
"azure-mgmt-sql<=1.0.0",
"azure-identity>=1.5.0",
"kubernetes>=22.6.0",
"pdpyras>=4.3.0",
"crowdstrike-falconpy>=0.5.1",
"python-dateutil",
"xmltodict",
"duo-client",
],
extras_require={
':python_version<"3.7"': [
"importlib-resources",
],
},
entry_points={
'console_scripts': [
'cartography = cartography.cli:main',
'cartography-detectdrift = cartography.driftdetect.cli:main',
],
},
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Natural Language :: English',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.10',
'Topic :: Security',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
],
)
setup()
11 changes: 0 additions & 11 deletions test-requirements.txt

This file was deleted.

Loading