diff --git a/.gitignore b/.gitignore index e214e42..d1beb1d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ ### Project-specific ### .vscode +.direnv/ +.envrc # Created by https://www.toptal.com/developers/gitignore/api/windows,linux,macos,vim,emacs,visualstudiocode,jetbrains+all,python # Edit at https://www.toptal.com/developers/gitignore?templates=windows,linux,macos,vim,emacs,visualstudiocode,jetbrains+all,python diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..5fd6f52 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1767379071, + "narHash": "sha256-EgE0pxsrW9jp9YFMkHL9JMXxcqi/OoumPJYwf+Okucw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "fb7944c166a3b630f177938e478f0378e64ce108", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..3e16d44 --- /dev/null +++ b/flake.nix @@ -0,0 +1,47 @@ +{ + description = "AsyncAPI Python Code Generator - type-safe async Python from AsyncAPI 3 specs"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = + { + self, + nixpkgs, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + python = pkgs.python310; + in + { + devShells.default = pkgs.mkShell { + name = "asyncapi-python"; + + packages = with pkgs; [ + python + uv + ]; + + shellHook = '' + export UV_PYTHON_PREFERENCE=only-system + + if [ ! -d .venv ]; then + echo "Creating virtual environment..." + uv venv + fi + + source .venv/bin/activate + + echo "AsyncAPI Python development environment" + echo "Python: $(python --version)" + echo "uv: $(uv --version)" + ''; + }; + } + ); +} diff --git a/pyproject.toml b/pyproject.toml index a56aea1..dfedeb5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,8 @@ dependencies = ["pydantic>=2", "pytz"] [project.optional-dependencies] codegen = [ "jinja2>=3.1.4", - "typer[all]>=0.12.5", + "typer>=0.15.0", + "click>=8.0.0", "pyyaml", "datamodel-code-generator[http]>=0.26.4", "black", diff --git a/uv.lock b/uv.lock index 4bd3842..c4560de 100644 --- a/uv.lock +++ b/uv.lock @@ -64,7 +64,7 @@ wheels = [ [[package]] name = "asyncapi-python" -version = "0.3.0rc9" +version = "0.3.0rc10" source = { editable = "." } dependencies = [ { name = "pydantic" },