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

Modernize to agree with cisagov/skeleton-python-library #108

Merged
merged 1 commit into from
Nov 6, 2024
Merged
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
48 changes: 35 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
- https://blog.ionelmc.ro/2014/05/25/python-packaging/#the-structure
"""

# Standard Python Libraries
import codecs
from os.path import abspath, dirname, join

# Third-Party Libraries
from setuptools import setup

Expand All @@ -18,12 +22,22 @@ def readme():
return f.read()


def package_vars(version_file):
"""Read in and return the variables defined by the version_file."""
pkg_vars = {}
with open(version_file) as f:
exec(f.read(), pkg_vars) # nosec
return pkg_vars
# Below two methods were pulled from:
# https://packaging.python.org/guides/single-sourcing-package-version/
def read(rel_path):
"""Open a file for reading from a given relative path."""
here = abspath(dirname(__file__))
with codecs.open(join(here, rel_path), "r") as fp:
return fp.read()


def get_version(version_file):
"""Extract a version number from the given file path."""
for line in read(version_file).splitlines():
if line.startswith("__version__"):
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
raise RuntimeError("Unable to find version string.")


setup(
Expand All @@ -33,13 +47,17 @@ def package_vars(version_file):
description="Documentation for Github projects in the cisagov organization.",
long_description=readme(),
long_description_content_type="text/markdown",
# NCATS "homepage"
url="https://www.us-cert.gov/resources/ncats",
# The project's main homepage
download_url="https://github.com/cisagov/skeleton-python-library",
# Landing page for CISA's cybersecurity mission
url="https://www.cisa.gov/cybersecurity",
# Additional URLs for this project per
# https://packaging.python.org/guides/distributing-packages-using-setuptools/#project-urls
project_urls={
"Source": "https://github.com/cisagov/development-guide",
"Tracker": "https://github.com/cisagov/development-guide/issues",
},
# Author details
author="Cyber and Infrastructure Security Agency",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
author="Cyber and Infrastructure Security Agency",
author="Cybersecurity and Infrastructure Security Agency",

author_email="ncats@hq.dhs.gov",
author_email="github@cisa.dhs.gov",
license="License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication",
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
Expand All @@ -55,11 +73,15 @@ def package_vars(version_file):
# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
],
python_requires=">=3.6",
python_requires=">=3.7",
# What does your project relate to?
keywords="documentation",
package_dir={"": "project_setup/scripts"},
Expand Down