From cacceb6cd099aaab3a17b7bda0ee0499d85b6168 Mon Sep 17 00:00:00 2001 From: Michal Wolski Date: Thu, 16 Jan 2025 07:42:10 -0500 Subject: [PATCH] upgrade to pyproject format --- .github/workflows/pythonpublish.yml | 46 ++++++++++++++++------------- .gitignore | 7 +++++ pyproject.toml | 30 +++++++++++++++++++ run | 2 +- setup.cfg | 2 ++ setup.py | 43 --------------------------- 6 files changed, 66 insertions(+), 64 deletions(-) create mode 100644 pyproject.toml create mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index cad4a99..7682a78 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -6,27 +6,33 @@ name: Upload Python Package on: release: types: [created] + push: + tags: + - "v*" jobs: - deploy: - runs-on: ubuntu-latest + publish: + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build Wheel - run: | - python setup.py sdist bdist_wheel - - name: Publish - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} - run: | - twine upload dist/* + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.9" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build twine + + - name: Build the package + run: python -m build + - name: Publish + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + run: | + twine upload dist/* diff --git a/.gitignore b/.gitignore index 9bc2833..7b8ad70 100644 --- a/.gitignore +++ b/.gitignore @@ -110,3 +110,10 @@ ENV/ # mypy .mypy_cache/ +scratch.ipynb +scratch.py + + + +.DS_Store +.cadence/ \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..64ef87e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,30 @@ +[build-system] +requires = ["setuptools>=61.0", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "yann" +version = "0.0.40" +description = "yet another neural network library" +readme = "README.md" +license = { text = "MIT" } +authors = [ + { name = "Michal Wolski", email = "michal@bite.ai" } +] +requires-python = ">=3.7" +dependencies = [ + "numpy", + "scipy", + "scikit-learn", + "torch>=1.0.0", + "matplotlib", + "torchvision", + "tqdm" +] + +[project.optional-dependencies] +cli = ["click>=6.7"] +pretrainedmodels = ["pretrainedmodels"] + +[project.scripts] +yann = "yann.cli:main" diff --git a/run b/run index 445cdc7..091ddc0 100755 --- a/run +++ b/run @@ -15,7 +15,7 @@ function watch-tests() { function release() { rm -rf ./dist rm -rf ./build - python setup.py sdist bdist_wheel + python -m build twine upload dist/* } diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..9c7280d --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[metadata] +url = https://github.com/michalwols/yann diff --git a/setup.py b/setup.py deleted file mode 100644 index dbd0edc..0000000 --- a/setup.py +++ /dev/null @@ -1,43 +0,0 @@ -from setuptools import setup, find_packages - -# with open("README.md", "r") as fh: -# long_description = fh.read() - - -long_description = f""" -# yann (Yet Another Neural Network Library) - -Yann is an extended version of torch.nn, adding a ton of sugar to make training models as fast and easy as possible. - -""" - - -setup( - name='yann', - version='0.0.40', - description='yet another neural network library', - long_description=long_description, - long_description_content_type="text/markdown", - url='https://github.com/michalwols/yann', - author='Michal Wolski', - author_email='michal@bite.ai', - license='MIT', - packages=find_packages(), - entry_points={ - 'console_scripts': ['yann=yann.cli:main'], - }, - extras_require={ - 'cli': ['click>=6.7'], - 'pretrainedmodels': ['pretrainedmodels'] - }, - install_requires=[ - 'numpy', - 'scipy', - 'scikit-learn', - 'torch>=1.0.0', - 'matplotlib', - 'torchvision', - 'tqdm' - ], - python_requires='>=3.7', - zip_safe=False)