-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replace setup.py with pyproject.toml
- Loading branch information
Showing
12 changed files
with
183 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
f05d835901f7edd722a77ee4dd976e47bed47556555ce6c8ea991bc750cbc89f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from .builder import ready, build | ||
|
||
|
||
if ready(): | ||
print("No changes since last build.") | ||
else: | ||
build() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from setuptools.build_meta import * | ||
from setuptools_scm import get_version | ||
import warnings | ||
|
||
import builder | ||
|
||
|
||
default_build_sdist = build_sdist | ||
default_build_wheel = build_wheel | ||
|
||
|
||
class UnsupportedOperation(Exception): | ||
pass | ||
|
||
|
||
def ensure_js_build(autobuild=False): | ||
if builder.ready(): | ||
return | ||
builder.log_hash() | ||
version = get_version() | ||
if ".dev" in version: | ||
warnings.warn( | ||
"Speed up dev builds by running python -m packages.builder first." | ||
) | ||
if autobuild: | ||
builder.build() | ||
else: | ||
raise UnsupportedOperation( | ||
"Run python -m packages.builder and commit before releasing." | ||
) | ||
|
||
|
||
def build_sdist(*args, **kwargs): | ||
ensure_js_build(False) | ||
return default_build_sdist(*args, **kwargs) | ||
|
||
|
||
def build_wheel(*args, **kwargs): | ||
ensure_js_build(True) | ||
return default_build_wheel(*args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import pathlib | ||
import hashlib | ||
import subprocess | ||
|
||
root = pathlib.Path(__file__).parent.parent | ||
|
||
|
||
def ready(): | ||
if get_stored_hash() == compute_hash(): | ||
return True | ||
else: | ||
return False | ||
|
||
|
||
def get_hash_path(): | ||
return root / "data_wizard" / "static" / "srchash.txt" | ||
|
||
|
||
def get_stored_hash(): | ||
return get_hash_path().read_text() | ||
|
||
|
||
def set_stored_hash(value): | ||
return get_hash_path().write_text(value) | ||
|
||
|
||
def compute_hash(log=False): | ||
sha = hashlib.sha256() | ||
|
||
def add_files(pattern): | ||
for path in sorted(root.glob(pattern)): | ||
if log: | ||
print(" ", path.relative_to(root)) | ||
sha.update(path.read_bytes()) | ||
|
||
add_files("packages/*/src/**/*.js") | ||
add_files("packages/*/package.json") | ||
|
||
return sha.hexdigest() | ||
|
||
|
||
def log_hash(): | ||
print("Computing hash...") | ||
new_hash = compute_hash(log=True) | ||
print("Old Hash:", get_stored_hash()) | ||
print("New Hash:", new_hash) | ||
|
||
|
||
def build(): | ||
subprocess.check_call(["npm", "install"]) | ||
subprocess.check_call(["npm", "run", "build"]) | ||
set_stored_hash(compute_hash()) | ||
|
||
|
||
if __name__ == "__main__": | ||
if ready(): | ||
print("No changes since last build.") | ||
else: | ||
log_hash() | ||
build() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
[build-system] | ||
requires = ["setuptools", "setuptools-scm"] | ||
build-backend = "backend" | ||
backend-path = ["packages"] | ||
|
||
[project] | ||
name = "data-wizard" | ||
dynamic = ["version"] | ||
authors = [ | ||
{name = "S. Andrew Sheppard", email = "andrew@wq.io"}, | ||
] | ||
description = "Interactive web-based wizard for importing structured data into Django models." | ||
readme = "README.md" | ||
requires-python = ">=3.7" | ||
license = {text = "MIT"} | ||
classifiers = [ | ||
"Development Status :: 5 - Production/Stable", | ||
"Environment :: Web Environment", | ||
"License :: OSI Approved :: MIT License", | ||
"Natural Language :: English", | ||
"Programming Language :: JavaScript", | ||
"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", | ||
"Framework :: Django", | ||
"Framework :: Django :: 3.2", | ||
"Framework :: Django :: 4.0", | ||
"Framework :: Django :: 4.1", | ||
"Framework :: Django :: 4.2", | ||
"Topic :: Scientific/Engineering :: GIS", | ||
"Topic :: Database :: Database Engines/Servers", | ||
] | ||
dependencies = [ | ||
"djangorestframework", | ||
"itertable>=2.1.0", | ||
"natural-keys", | ||
"html-json-forms", | ||
"python-dateutil", | ||
] | ||
|
||
[project.urls] | ||
Homepage = "https://django-data-wizard.wq.io/" | ||
Documentation = "https://django-data-wizard.wq.io/" | ||
Source = "https://github.com/wq/django-data-wizard" | ||
"Release Notes" = "https://django-data-wizard.wq.io/releases/" | ||
Issues = "https://github.com/wq/django-data-wizard/issues" | ||
CI = "https://github.com/wq/django-data-wizard/actions/workflows/test.yml" | ||
|
||
[tool.setuptools] | ||
packages = [ | ||
"data_wizard", | ||
"data_wizard.backends", | ||
"data_wizard.management", | ||
"data_wizard.management.commands", | ||
"data_wizard.migrations", | ||
"data_wizard.sources", | ||
"data_wizard.sources.migrations", | ||
] | ||
|
||
[tool.setuptools_scm] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.