Skip to content

Commit 9b5b91f

Browse files
committed
setup change
1 parent 194a2b8 commit 9b5b91f

File tree

10 files changed

+116
-137
lines changed

10 files changed

+116
-137
lines changed

.devcontainer.json

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

Makefile

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,11 @@
11
.ONESHELL:
22
SHELL := /bin/bash
3-
SRC = $(wildcard Nbs/*.ipynb)
4-
5-
all: model_constructor docs
6-
7-
model_constructor: $(SRC)
8-
nbdev_build_lib
9-
touch model_constructor
10-
11-
sync:
12-
nbdev_update_lib
13-
14-
docs_serve: docs
15-
cd docs && bundle exec jekyll serve
16-
17-
docs: $(SRC)
18-
nbdev_build_docs
19-
touch docs
20-
21-
test:
22-
nbdev_test_nbs
23-
24-
release: pypi conda_release
25-
nbdev_bump_version
26-
27-
conda_release:
28-
fastrelease_conda_package
293

304
pypi: dist
315
twine upload --repository pypi dist/*
326

337
dist: clean
34-
python setup.py sdist bdist_wheel
8+
python3 -m build
359

3610
clean:
3711
rm -rf dist

docker-compose.yml

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

model_constructor/_nbdev.py

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

model_constructor/version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "0.1.10"

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# pytorch
2+
# numpy

requirements_test.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pytest
2+
pytest-cov
3+
coverage[toml]
4+
flake8

setup.cfg

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[metadata]
2+
name = model_constructor
3+
author = Yasyrev Andrei
4+
author_email = a.yasyrev@gmail.com
5+
description = Pytorch models constructor.
6+
keywords = pytorch models
7+
long_description = file: README.md
8+
long_description_content_type = text/markdown
9+
url = https://github.com/ayasyrev/model_constructor
10+
license = apache2
11+
classifiers =
12+
Programming Language :: Python :: 3
13+
License :: OSI Approved :: Apache Software License
14+
Operating System :: OS Independent
15+
16+
[options]
17+
package_dir =
18+
= model_constructor
19+
packages = find:
20+
python_requires = >=3.7
21+
22+
[options.packages.find]
23+
where = model_constructor

setup.py

Lines changed: 35 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,36 @@
1-
from pkg_resources import parse_version
2-
from configparser import ConfigParser
3-
import setuptools
4-
assert parse_version(setuptools.__version__)>=parse_version('36.2')
5-
6-
# note: all settings are in settings.ini; edit there, not here
7-
config = ConfigParser(delimiters=['='])
8-
config.read('settings.ini')
9-
cfg = config['DEFAULT']
10-
11-
cfg_keys = 'version description keywords author author_email'.split()
12-
expected = cfg_keys + "lib_name user branch license status min_python audience language".split()
13-
for o in expected: assert o in cfg, "missing expected setting: {}".format(o)
14-
setup_cfg = {o:cfg[o] for o in cfg_keys}
15-
16-
licenses = {
17-
'apache2': ('Apache Software License 2.0','OSI Approved :: Apache Software License'),
18-
'mit': ('MIT License', 'OSI Approved :: MIT License'),
19-
'gpl2': ('GNU General Public License v2', 'OSI Approved :: GNU General Public License v2 (GPLv2)'),
20-
'gpl3': ('GNU General Public License v3', 'OSI Approved :: GNU General Public License v3 (GPLv3)'),
21-
'bsd3': ('BSD License', 'OSI Approved :: BSD License'),
22-
}
23-
statuses = [ '1 - Planning', '2 - Pre-Alpha', '3 - Alpha',
24-
'4 - Beta', '5 - Production/Stable', '6 - Mature', '7 - Inactive' ]
25-
py_versions = '2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8'.split()
26-
27-
requirements = cfg.get('requirements','').split()
28-
min_python = cfg['min_python']
29-
lic = licenses.get(cfg['license'].lower(), (cfg['license'], None))
30-
31-
setuptools.setup(
32-
name = cfg['lib_name'],
33-
license = lic[0],
34-
classifiers = [
35-
'Development Status :: ' + statuses[int(cfg['status'])],
36-
'Intended Audience :: ' + cfg['audience'].title(),
37-
'Natural Language :: ' + cfg['language'].title(),
38-
] + ['Programming Language :: Python :: '+o for o in py_versions[py_versions.index(min_python):]] + (['License :: ' + lic[1] ] if lic[1] else []),
39-
url = cfg['git_url'],
40-
packages = setuptools.find_packages(),
41-
include_package_data = True,
42-
install_requires = requirements,
43-
dependency_links = cfg.get('dep_links','').split(),
44-
python_requires = '>=' + cfg['min_python'],
45-
long_description = open('README.md').read(),
46-
long_description_content_type = 'text/markdown',
47-
zip_safe = False,
48-
entry_points = { 'console_scripts': cfg.get('console_scripts','').split() },
49-
**setup_cfg)
1+
from setuptools import setup
502

3+
4+
VERSION_FILENAME = 'model_constructor/version.py'
5+
REQUIREMENTS_FILENAME = 'requirements.txt'
6+
REQUIREMENTS_TEST_FILENAME = 'requirements_test.txt'
7+
8+
9+
# Requirements
10+
try:
11+
with open(REQUIREMENTS_FILENAME, encoding="utf-8") as fh:
12+
REQUIRED = fh.read().split("\n")
13+
except FileNotFoundError:
14+
REQUIRED = []
15+
16+
try:
17+
with open(REQUIREMENTS_TEST_FILENAME, encoding="utf-8") as fh:
18+
TEST_REQUIRED = fh.read().split("\n")
19+
except FileNotFoundError:
20+
TEST_REQUIRED = []
21+
22+
# What packages are optional?
23+
EXTRAS = {"test": TEST_REQUIRED}
24+
25+
# Load the package's __version__ from version.py
26+
version = {}
27+
with open(VERSION_FILENAME, 'r', encoding="utf-8") as fh:
28+
exec(fh.read(), version)
29+
VERSION = version['__version__']
30+
31+
32+
setup(
33+
version=VERSION,
34+
install_requires=REQUIRED,
35+
extras_require=EXTRAS,
36+
)

setup_.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
from pkg_resources import parse_version
2+
from configparser import ConfigParser
3+
import setuptools
4+
assert parse_version(setuptools.__version__)>=parse_version('36.2')
5+
6+
# note: all settings are in settings.ini; edit there, not here
7+
config = ConfigParser(delimiters=['='])
8+
config.read('settings.ini')
9+
cfg = config['DEFAULT']
10+
11+
cfg_keys = 'version description keywords author author_email'.split()
12+
expected = cfg_keys + "lib_name user branch license status min_python audience language".split()
13+
for o in expected: assert o in cfg, "missing expected setting: {}".format(o)
14+
setup_cfg = {o:cfg[o] for o in cfg_keys}
15+
16+
licenses = {
17+
'apache2': ('Apache Software License 2.0','OSI Approved :: Apache Software License'),
18+
'mit': ('MIT License', 'OSI Approved :: MIT License'),
19+
'gpl2': ('GNU General Public License v2', 'OSI Approved :: GNU General Public License v2 (GPLv2)'),
20+
'gpl3': ('GNU General Public License v3', 'OSI Approved :: GNU General Public License v3 (GPLv3)'),
21+
'bsd3': ('BSD License', 'OSI Approved :: BSD License'),
22+
}
23+
statuses = [ '1 - Planning', '2 - Pre-Alpha', '3 - Alpha',
24+
'4 - Beta', '5 - Production/Stable', '6 - Mature', '7 - Inactive' ]
25+
py_versions = '2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8'.split()
26+
27+
requirements = cfg.get('requirements','').split()
28+
min_python = cfg['min_python']
29+
lic = licenses.get(cfg['license'].lower(), (cfg['license'], None))
30+
31+
setuptools.setup(
32+
name = cfg['lib_name'],
33+
license = lic[0],
34+
classifiers = [
35+
'Development Status :: ' + statuses[int(cfg['status'])],
36+
'Intended Audience :: ' + cfg['audience'].title(),
37+
'Natural Language :: ' + cfg['language'].title(),
38+
] + ['Programming Language :: Python :: '+o for o in py_versions[py_versions.index(min_python):]] + (['License :: ' + lic[1] ] if lic[1] else []),
39+
url = cfg['git_url'],
40+
packages = setuptools.find_packages(),
41+
include_package_data = True,
42+
install_requires = requirements,
43+
dependency_links = cfg.get('dep_links','').split(),
44+
python_requires = '>=' + cfg['min_python'],
45+
long_description = open('README.md').read(),
46+
long_description_content_type = 'text/markdown',
47+
zip_safe = False,
48+
entry_points = { 'console_scripts': cfg.get('console_scripts','').split() },
49+
**setup_cfg)
50+

0 commit comments

Comments
 (0)