diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c26f4db --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,62 @@ +name: Release + +on: + push: + branches: + - main + - next + +permissions: + contents: write + issues: write + pull-requests: write + +jobs: + # Job to detect which files have changed + paths: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: main + persist-credentials: true + - name: Set Git User + run: | + git config user.name "GitHub Action" + git config user.email "action@github.com" + - name: Pull latest changes from origin/main + run: git pull --rebase origin main + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: "latest" + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: "lts/*" + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + - name: Update npm + run: npm install -g npm@latest + - run: bun install + - name: Install Python dependencies + run: | + python3 -m pip install --upgrade pip + python3 -m pip install build twine + - name: Build + run: bun run build + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + run: npx semantic-release --ci \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5df5ea1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,345 @@ +# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore + +# Logs + +logs +_.log +npm-debug.log_ +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Caches + +.cache + +# Diagnostic reports (https://nodejs.org/api/report.html) + +report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json + +# Runtime data + +pids +_.pid +_.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover + +lib-cov + +# Coverage directory used by tools like istanbul + +coverage +*.lcov + +# nyc test coverage + +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) + +.grunt + +# Bower dependency directory (https://bower.io/) + +bower_components + +# node-waf configuration + +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) + +build/Release + +# Dependency directories + +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) + +web_modules/ + +# TypeScript cache + +*.tsbuildinfo + +# Optional npm cache directory + +.npm + +# Optional eslint cache + +.eslintcache + +# Optional stylelint cache + +.stylelintcache + +# Microbundle cache + +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history + +.node_repl_history + +# Output of 'npm pack' + +*.tgz + +# Yarn Integrity file + +.yarn-integrity + +# dotenv environment variable files + +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) + +.parcel-cache + +# Next.js build output + +.next +out + +# Nuxt.js build / generate output + +.nuxt +dist + +# Gatsby files + +# Comment in the public line in if your project uses Gatsby and not Next.js + +# https://nextjs.org/blog/next-9-1#public-directory-support + +# public + +# vuepress build output + +.vuepress/dist + +# vuepress v2.x temp and cache directory + +.temp + +# Docusaurus cache and generated files + +.docusaurus + +# Serverless directories + +.serverless/ + +# FuseBox cache + +.fusebox/ + +# DynamoDB Local files + +.dynamodb/ + +# TernJS port file + +.tern-port + +# Stores VSCode versions used for testing VSCode extensions + +.vscode-test + +# yarn v2 + +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +# IntelliJ based IDEs +.idea + +# Finder (MacOS) folder config +.DS_Store + + + + + +# Python Specific + + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/latest/usage/project/#working-with-version-control +.pdm.toml +.pdm-python +.pdm-build/ + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ \ No newline at end of file diff --git a/LICENSE b/LICENSE index 261eeb9..5713c33 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + Copyright 2024 Ducflair Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index a1c35f4..6d9c984 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# pdf-to-duc -Library to transform CAD PDF's into duc files. This will enable ease of transition from old CAD projects. +# PDF-to-Duc +Library to transform CAD PDF's into Duc CAD files. This will enable ease of transition from old CAD projects. diff --git a/bun.lockb b/bun.lockb new file mode 100755 index 0000000..b864e25 Binary files /dev/null and b/bun.lockb differ diff --git a/package.json b/package.json new file mode 100644 index 0000000..304ad30 --- /dev/null +++ b/package.json @@ -0,0 +1,16 @@ +{ + "name": "pdf-to-duc", + "version": "0.0.0-development", + "private": true, + "scripts": { + "install-deps": "python3 -m pip install -r requirements.txt", + "build": "python3 -m build", + "test": "python3 -m unittest discover tests", + "prepublish": "python3 setup.py sdist bdist_wheel", + "semantic-release": "semantic-release" + }, + "devDependencies": { + "@types/bun": "latest", + "semantic-release": "^24.1.2" + } +} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..02fa92d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,35 @@ +[build-system] +requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.2"] +build-backend = "setuptools.build_meta" + +[project] +name = "pdf-to-duc" +version = "0.1.0" +requires-python = ">=3.7" +dependencies = ["ducflair_duc"] + +description = "Transform PDF's into Duc CAD files" +readme = { file = "README.md", content-type = "text/markdown" } +license = { text = "Apache-2.0" } + +authors = [ + { name = "Ducflair", email = "support@ducflair.com" } +] + +classifiers = [ + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", +] + +[project.urls] +"Homepage" = "https://ducflair.com" +"Source" = "https://github.com/ducflair/pdf-to-duc" + +[tool.setuptools.packages.find] +where = ["src"] +include = ["pdf_to_duc*"] diff --git a/release.config.cjs b/release.config.cjs new file mode 100644 index 0000000..beae42a --- /dev/null +++ b/release.config.cjs @@ -0,0 +1,19 @@ +module.exports = { + branches: ["main", { name: "next", prerelease: true }], + plugins: [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + [ + "@semantic-release/exec", + { + // Clean the dist directory and update version in pyproject.toml + prepareCmd: + 'pip install build && rm -rf dist && sed -i "s/version = \\"[^\\"].*\\"/version = \\"${nextRelease.version}\\"/" pyproject.toml && python3 -m build', + publishCmd: + "python3 -m twine upload dist/* -u __token__ -p ${process.env.PYPI_TOKEN}" + } + ], + "@semantic-release/github", + ], + tagFormat: "${version}" +}; diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..553ad60 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +build +wheel +setuptools \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..0682739 --- /dev/null +++ b/setup.py @@ -0,0 +1,6 @@ +from setuptools import setup, find_packages + +setup( + packages=find_packages(where="src"), + package_dir={"": "src"}, +) diff --git a/src/pdf_to_duc/__init__.py b/src/pdf_to_duc/__init__.py new file mode 100644 index 0000000..9d4490e --- /dev/null +++ b/src/pdf_to_duc/__init__.py @@ -0,0 +1 @@ +from pdf_to_duc.main import * \ No newline at end of file diff --git a/src/pdf_to_duc/main.py b/src/pdf_to_duc/main.py new file mode 100644 index 0000000..32b88a4 --- /dev/null +++ b/src/pdf_to_duc/main.py @@ -0,0 +1,10 @@ + +# Just for demo purposes +if __name__ == "__main__": + print("Hello, World!") + + + + +# Expose all public methods for external use +# __all__ = ['']