Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: python projects #514

Merged
merged 33 commits into from
Feb 4, 2021
Merged

feat: python projects #514

merged 33 commits into from
Feb 4, 2021

Conversation

Chriscbr
Copy link
Contributor

@Chriscbr Chriscbr commented Jan 24, 2021

Closes #359

Introduces a new python project type which can be created via npx projen new python. See docs/python.md for more information.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link
Contributor Author

@Chriscbr Chriscbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to also have some kind of task that would activate the virtual environment in the developer's shell, but tasks currently just run in a child process IIRC so it's yet not possible to do that. But I don't think it's strictly needed for a MVP.

src/__tests__/__snapshots__/new.test.ts.snap Outdated Show resolved Hide resolved
src/python/requirements-file.ts Outdated Show resolved Hide resolved
src/python/python-project.ts Show resolved Hide resolved
src/python/python-project.ts Outdated Show resolved Hide resolved
@codecov-io
Copy link

codecov-io commented Feb 1, 2021

Codecov Report

Merging #514 (39cbbcc) into master (16a3c45) will increase coverage by 1.18%.
The diff coverage is 81.94%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #514      +/-   ##
==========================================
+ Coverage   76.65%   77.83%   +1.18%     
==========================================
  Files          75       86      +11     
  Lines        2831     3091     +260     
  Branches      732      779      +47     
==========================================
+ Hits         2170     2406     +236     
- Misses        658      684      +26     
+ Partials        3        1       -2     
Impacted Files Coverage Δ
src/jsii-project.ts 85.91% <60.00%> (+10.91%) ⬆️
src/python/venv.ts 64.70% <64.70%> (ø)
src/python/requirements-file.ts 68.00% <68.00%> (ø)
src/python/poetry.ts 75.00% <75.00%> (ø)
src/publisher.ts 77.77% <77.77%> (ø)
src/node-project.ts 74.60% <80.00%> (+0.27%) ⬆️
src/python/python-project.ts 81.03% <81.03%> (ø)
src/python/pip.ts 88.88% <88.88%> (ø)
src/index.ts 100.00% <100.00%> (ø)
src/python/index.ts 100.00% <100.00%> (ø)
... and 21 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e74ee65...39cbbcc. Read the comment docs.

Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

Feels like we should find a more robust pattern for "toolchain selection". It's a repeating pattern and maybe we can do better than a set of hard-coded booleans (which is what we've done so far, I know...)

I'll try to sketch something and share.

docs/python.md Outdated Show resolved Hide resolved
```

> At this point, projenrc is in JavaScript, but in the future we plan to allow
> specifying your project definitions in python.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yass sooner rather then later. happy to help out with that

docs/python.md Outdated Show resolved Hide resolved
docs/python.md Outdated Show resolved Hide resolved
docs/python.md Outdated Show resolved Hide resolved
src/python/pip.ts Show resolved Hide resolved
src/python/python-deps.ts Show resolved Hide resolved
src/python/python-project.ts Show resolved Hide resolved
src/python/python-project.ts Show resolved Hide resolved
src/python/requirements-file.ts Outdated Show resolved Hide resolved
@Chriscbr
Copy link
Contributor Author

Chriscbr commented Feb 1, 2021

Feels like we should find a more robust pattern for "toolchain selection". It's a repeating pattern and maybe we can do better than a set of hard-coded booleans (which is what we've done so far, I know...)

I'll try to sketch something and share.

Cool, I'm totally down. 👍

src/python/python-project.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. See minor comment.

src/cli/macros.ts Outdated Show resolved Hide resolved
src/python/poetry.ts Outdated Show resolved Hide resolved
src/python/python-project.ts Show resolved Hide resolved
Base automatically changed from master to main February 3, 2021 14:45
@Chriscbr
Copy link
Contributor Author

Chriscbr commented Feb 4, 2021

Updated the docs and PR description.

cc @garnaat Feel free to take a look. The docs rendered here give an overview of what we have so far.

There are still some high level features like github workflows and configuration through projenrc.py left, but I'll leave those for a later PR.

I think the mental model I've captured here for several of the python tools is a good enough start, but like @eladb mentioned, there might be a better way to structure the APIs for choosing between these tools.

As far as what the components actually do under the hood, most of it I feel OK with, although I wonder if Pip should be doing more -- like perhaps freezing the requirements and automatically diff'ing the results with the previous version and showing the changes to the user etc. But I don't have much python dependency management experience to build off of, so I'm mostly reading docs online to see what the options are. I just know we want the different language project types to feel similar to use.

Anyway, I'm looking forward to having this merged. :D

@mergify mergify bot merged commit bf6b6af into projen:main Feb 4, 2021
campionfellin pushed a commit to campionfellin/projen that referenced this pull request Feb 5, 2021
Closes projen#359 

Introduces a new python project type which can be created via `npx projen new python`. See docs/python.md for more information.

---
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFC: Support for Python project
3 participants