Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,22 @@ ARG VARIANT="3"

FROM mcr.microsoft.com/vscode/devcontainers/python:${VARIANT}

ARG NODE_VERSION="20"
ARG POETRY_VERSION="1.8.2"
ARG POETRY_SRC="https://install.python-poetry.org"

# https://github.com/microsoft/vscode-dev-containers/blob/main/containers/go/.devcontainer/base.Dockerfile
ENV USERNAME=vscode
ENV LIBRARY_SCRIPTS_SRC="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/containers/go/.devcontainer/library-scripts/node-debian.sh"
ENV NVM_DIR=/usr/local/share/nvm
ENV NVM_SYMLINK_CURRENT=true \
PATH=${NVM_DIR}/current/bin:${PATH}
RUN mkdir /tmp/library-scripts \
&& curl -fsSL -o /tmp/library-scripts/node-debian.sh "${LIBRARY_SCRIPTS_SRC}"
RUN bash /tmp/library-scripts/node-debian.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}" \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/library-scripts

USER vscode
WORKDIR /home/vscode

Expand Down
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"build": {
"dockerfile": "Dockerfile",
"args": {
"NODE_VERSION": "20",
"POETRY_VERSION": "1.8.2",
"VARIANT": "3.12"
}
Expand All @@ -17,6 +18,6 @@
"ms-python.python",
"EditorConfig.EditorConfig"
],
"postCreateCommand": "poetry install",
"postCreateCommand": "poetry install && npm install",
"remoteUser": "vscode"
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
seami/** linguist-generated
38 changes: 38 additions & 0 deletions .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Setup Node.js
description: Setup Node.js and install dependencies.

inputs:
node_version:
description: The Node.js version.
required: false
default: '20'
registry_url:
description: The Node.js package registry URL.
required: false
default: https://registry.npmjs.org
install_dependencies:
description: Install dependencies.
required: false
default: 'true'

runs:
using: composite
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
if: inputs.install_dependencies == 'true'
with:
cache: npm
node-version: ${{ inputs.node_version }}
registry-url: ${{ inputs.registry_url }}
- name: Setup Node.js without cache
uses: actions/setup-node@v4
if: inputs.install_dependencies == 'false'
with:
node-version: ${{ inputs.node_version }}
registry-url: ${{ inputs.registry_url }}
- name: Install dependencies
if: inputs.install_dependencies == 'true'
shell: bash
run: npm ci
6 changes: 5 additions & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,17 @@ jobs:
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Setup
uses: ./.github/actions/setup
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Format
run: make format
- name: Format with Prettier
run: npm run format
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v5
if: always()
with:
commit_message: Run format
commit_message: 'ci: Format code'
commit_user_name: ${{ secrets.GIT_USER_NAME }}
commit_user_email: ${{ secrets.GIT_USER_EMAIL }}
commit_author: ${{ secrets.GIT_USER_NAME }} <${{ secrets.GIT_USER_EMAIL }}>
10 changes: 9 additions & 1 deletion .github/workflows/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,20 @@ jobs:
uses: ./.github/actions/setup
with:
install_dependencies: 'false'
- name: Setup Node.js
uses: ./.github/actions/setup-node
with:
install_dependencies: 'false'
- name: Normalize poetry.lock
run: poetry lock --no-update
- name: Normalize package-lock.json
run: npm install
- name: Generate code
run: npm run generate
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Generate code
commit_message: 'ci: Generate code'
commit_user_name: ${{ secrets.GIT_USER_NAME }}
commit_user_email: ${{ secrets.GIT_USER_EMAIL }}
commit_author: ${{ secrets.GIT_USER_NAME }} <${{ secrets.GIT_USER_EMAIL }}>
150 changes: 150 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,153 @@ cython_debug/
# 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/

# Build directories
package

# Environment versions file
.versions

# Tern
.tern-project
.tern-port

# npm config
.npmrc

# Temporary development files
tmp

# Yarn lockfile (only package-lock.json supported)
yarn.lock

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# 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/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# 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
.cache

# 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.*
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semi": false,
"singleQuote": true,
"jsxSingleQuote": true,
"endOfLine": "lf"
}
5 changes: 4 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,17 @@ Clone the project with
Requirements
~~~~~~~~~~~~

You will need `Python 3`_ and Poetry_.
You will need `Python 3`_ and Poetry_ and Node.js_ with npm_.

Install the development dependencies with

::

$ poetry install
$ npm install

.. _Node.js: https://nodejs.org/
.. _npm: https://www.npmjs.com/
.. _Poetry: https://poetry.eustace.io/
.. _Python 3: https://www.python.org/

Expand Down
28 changes: 28 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "@seamapi/python",
"private": true,
"type": "module",
"scripts": {
"generate": "true",
"format": "prettier --write --ignore-path .gitignore ."
},
"devDependencies": {
"prettier": "^3.2.5"
}
}
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ rstcheck = "^6.1.2"
[build-system]
requires = ["poetry>=1.8"]
build-backend = "poetry.masonry.api"

[tool.pytest.ini_options]
norecursedirs = [
"node_modules"
]