Skip to content

Commit

Permalink
use pyproject.toml for static info
Browse files Browse the repository at this point in the history
  • Loading branch information
tusharsadhwani committed Nov 20, 2023
1 parent e30744a commit 0977095
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
17 changes: 16 additions & 1 deletion _compiled_pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
[project]
name = "compiled"
version = "0.2.1"
description = "Compiled versions of the stdlib."
# TODO: Add README
authors = [
{name = "Tushar Sadhwani", email = "[email protected]"},
]
requires-python = ">=3.11"

[project.urls]
Homepage = "https://github.com/tusharsadhwani/compiled"

[project.scripts]
pycompile = "compiled:cli"

[build-system]
requires = [
"setuptools",
"wheel",
"mypy[mypyc]",
]

build-backend = "setuptools.build_meta"
16 changes: 4 additions & 12 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
TEST_BASE_DIR = os.path.join(ROOT_DIR, "Lib/test")
TMP_LIB_DIR = "/tmp/pycompiled"

PACKAGE_VERSION = "0.2.1"
SUPPORTED_LIBRARIES = ["tomllib", "difflib"]

# get rid of this once mypyc fixes relative imports
Expand Down Expand Up @@ -239,38 +238,31 @@ def main() -> int:
init_file.write(contents)

# copy cibuildwheel config to build dir
shutil.copy("./cibw_config.toml", build_dir)
pyproject_toml_path = os.path.join(build_dir, "pyproject.toml")
shutil.copy("./_compiled_pyproject.toml", pyproject_toml_path)

# setup.py contains the `pycompile` console script, present in `__init__.py`
with contextlib.chdir(build_dir):
setup_code = dedent(
# TODO: use a setup.cfg for README, version, and all the static stuff.
r"""
from setuptools import setup, find_packages
from mypyc.build import mypycify
setup(
name="compiled",
version=%r,
description="Compiled versions of the stdlib.",
long_description="# compiled\n\nCompiled versions of the stdlib.",
url="https://github.com/tusharsadhwani/compiled",
author="Tushar Sadhwani",
author_email="[email protected]",
packages=find_packages(),
ext_modules=mypycify(["--strict", *%r]),
entry_points={
"console_scripts": ["pycompile=compiled:cli"],
},
)
"""
% (PACKAGE_VERSION, ext_modules)
% (ext_modules,)
)
with open("./setup.py", "w") as setup_file:
setup_file.write(setup_code)

process = subprocess.run(["cibuildwheel", "--config-file=cibw_config.toml"])
process = subprocess.run(["cibuildwheel"])
return process.returncode

library_name = args.library
Expand Down

0 comments on commit 0977095

Please sign in to comment.