Skip to content

Commit

Permalink
migrate to setup.cfg (#299)
Browse files Browse the repository at this point in the history
* migrate to setup.cfg

* extract package's version from __init__.py

* factorize extra deps

* Update changelog

* Fix flake8 dep

---------

Co-authored-by: Steven Loria <[email protected]>
  • Loading branch information
deronnax and sloria authored Dec 15, 2023
1 parent 9b88b71 commit dd89d6c
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 68 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Other changes:

- _Backwards-incompatible_: Drop support for EOL Python 3.6 and 3.7.
- Test against Python 3.11.
- Migrate to setup.cfg. Thanks [deronnax](https://github.com/deronnax) for the PR.

## 9.5.0 (2022-01-30)

Expand Down
59 changes: 57 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,60 @@
[bdist_wheel]
universal=1
[metadata]
name = environs
version = attr: environs.__version__
author = Steven Loria
author_email = [email protected]
license = MIT
description = simplified environment variable parsing
keywords =
environment
variables
parsing
config
configuration
12factor
envvars
url = https://github.com/sloria/environs
long_description = file: README.md
long_description_content_type = text/markdown
classifiers =
Intended Audience :: Developers
License :: OSI Approved :: MIT License
Natural Language :: English
Programming Language :: Python :: 3
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Typing :: Typed
project_urls =
Issues = https://github.com/sloria/environs/issues
Changelog = https://github.com/sloria/environs/blob/master/CHANGELOG.md

[options]
packages = environs
zip_safe = False
install_requires = marshmallow>=3.0.0; python-dotenv
python_requires = >=3.7

[options.extras_require]
django =
dj-database-url
dj-email-url
django-cache-url
tests =
pytest
environs[django]
lint =
flake8==6.1.0
flake8-bugbear==23.11.28
mypy==0.910
pre-commit~=3.6
dev =
environs[tests,lint]
tox

[options.package_data]
environs = py.typed

[flake8]
ignore = E203, E266, E501, W503, B907
Expand Down
67 changes: 1 addition & 66 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,68 +1,3 @@
import re

from setuptools import setup

INSTALL_REQUIRES = ["marshmallow>=3.0.0", "python-dotenv"]
DJANGO_REQUIRES = ["dj-database-url", "dj-email-url", "django-cache-url"]
EXTRAS_REQUIRE = {
"django": DJANGO_REQUIRES,
"tests": ["pytest"] + DJANGO_REQUIRES,
"lint": ["flake8==6.1.0", "flake8-bugbear==23.11.28", "mypy==0.910", "pre-commit~=3.6"],
}
EXTRAS_REQUIRE["dev"] = EXTRAS_REQUIRE["tests"] + EXTRAS_REQUIRE["lint"] + ["tox"]
PYTHON_REQUIRES = ">=3.8"


def find_version(fname):
version = ""
with open(fname) as fp:
reg = re.compile(r'__version__ = [\'"]([^\'"]*)[\'"]')
for line in fp:
m = reg.match(line)
if m:
version = m.group(1)
break
if not version:
raise RuntimeError("Cannot find version information")
return version


def read(fname):
with open(fname) as fp:
content = fp.read()
return content


setup(
name="environs",
packages=["environs"],
package_data={"environs": ["py.typed"]},
version=find_version("environs/__init__.py"),
description="simplified environment variable parsing",
long_description=read("README.md"),
long_description_content_type="text/markdown",
author="Steven Loria",
author_email="[email protected]",
url="https://github.com/sloria/environs",
install_requires=INSTALL_REQUIRES,
extras_require=EXTRAS_REQUIRE,
license="MIT",
zip_safe=False,
python_requires=PYTHON_REQUIRES,
keywords="environment variables parsing config configuration 12factor envvars",
classifiers=[
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Typing :: Typed",
],
project_urls={
"Issues": "https://github.com/sloria/environs/issues",
"Changelog": "https://github.com/sloria/environs/blob/master/CHANGELOG.md",
},
)
setup()

0 comments on commit dd89d6c

Please sign in to comment.